/* ==========================================================================
   📱 FULLY RESPONSIVE REFER & EARN PAGE & SIDEBAR STYLES (ALL DEVICES)
   ========================================================================== */

.refer-page {
  background-color: #f8f9fa;
  min-height: 100vh;
  padding: 40px 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}

.refer-page *, 
.refer-page *::before, 
.refer-page *::after {
  box-sizing: inherit;
}

.profile-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Breadcrumb */
.breadcrumb-container {
  margin-bottom: 24px;
}

.breadcrumb {
  font-size: 14px;
  color: #6c757d;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.breadcrumb span {
  margin: 0 8px;
  color: #adb5bd;
}

.breadcrumb strong {
  color: #1a1a1a;
  font-weight: 600;
}

/* Layout - Automatically wraps before squeezing sidebar */
.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
  width: 100%;
}

.main-content-referal {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  width: 100%;
}

/* Referral Hero Section */
.referral-hero {
  background: linear-gradient(135deg, #111111 0%, #2c2c2c 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  gap: 20px;
  width: 100%;
}

.hero-content {
  max-width: 500px;
  z-index: 1;
}

.referral-hero .badge {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffd700;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-bottom: 16px;
  backdrop-filter: blur(4px);
}

.referral-hero h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px 0;
  line-height: 1.2;
}

.referral-hero p {
  font-size: 12px;
  color: #d1d5db;
  margin: 0;
  line-height: 1.5;
}

.referral-hero img {
  max-width: 200px;
  height: auto;
  object-fit: contain;
  z-index: 1;
}

/* Referral Code Section */
.referral-code-section {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.referral-code-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
}

.code-box {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  width: 100%;
}

.code-box input {
  flex: 1;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 1px;
  outline: none;
  min-width: 0;
}

.code-box input:focus {
  border-color: #111111;
  background-color: #ffffff;
}

.btn-copy {
  background-color: #111111;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
  min-height: 44px;
  flex-shrink: 0;
}

.btn-copy:hover {
  background-color: #333333;
}

.btn-copy:active {
  transform: scale(0.98);
}

.helper-text {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.stat-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #f0f0f0;
  min-width: 0;
}

.stat-card small {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.5px;
}

.stat-card h3 {
  font-size: 24px;
  font-weight: 700;
  color: #111111;
  margin: 0;
}

/* --- Referral History Section Container --- */
.referral-bottom-row {
  margin-top: 0;
  width: 100%;
}

.history-section {
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid #f0f0f0;
  width: 100%;
}

.history-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f3f5;
  padding-bottom: 12px;
  gap: 12px;
}

.history-header-flex h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #212529;
}

.history-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* --- Row Card Base Styles --- */
.history-row-card {
  display: grid;
  align-items: center;
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
  width: 100%;
}

.history-row-card:hover {
  background: #f1f3f5;
}

/* --- Limited list layout (3 columns: User, Status, Reward) --- */
#limitedHistoryList .history-row-card {
  grid-template-columns: 2fr 1.2fr 1fr;
  gap: 16px;
}

/* --- Full list layout (5 columns: User, Email, Date, Status, Reward) --- */
#fullHistoryList .history-row-card {
  grid-template-columns: 1fr 1.6fr 1fr 1.2fr 0.9fr;
  gap: 12px;
}

/* --- Information Columns & Text Handling --- */
.history-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0; 
}

#limitedHistoryList .history-row-card .history-info:last-child,
#fullHistoryList .history-row-card .history-info:last-child {
  justify-content: flex-end;
}

.history-label {
  color: #868e96;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  display: none; 
}

.referred-user-name,
.history-date {
  font-size: 13px;
  color: #495057;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.referred-user-name strong {
  color: #212529;
  font-size: 14px;
}

.reward-amount {
  font-weight: 600;
  color: #2b8a3e;
  font-size: 15px;
  white-space: nowrap;
}

/* --- Status Badge Styling --- */
.status-badge {
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: inline-block;
}

.status-badge.completed, 
.status-badge.rewarded {
  background: #e6fcf5;
  color: #0ca678;
}

.status-badge.pending {
  background: #fff3bf;
  color: #f08c00;
}

/* --- View All Button --- */
.btn-view-all {
  background: #ffffff;
  border: 1px solid #ced4da;
  color: #495057;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 36px;
}

.btn-view-all:hover {
  background: #e9ecef;
  color: #212529;
}

/* --- Utility States --- */
.no-history {
  color: #868e96;
  font-style: italic;
  margin: 0;
  text-align: center;
  padding: 20px;
}

.text-muted {
  color: #adb5bd;
  font-size: 13px;
}


/* ==========================================================================
   📱 RESPONSIVE MEDIA QUERIES (BREAKPOINT EXTENDED TO 1024px TO PREVENT SIDEBAR CRUSHING)
   ========================================================================== */

/* Tablets, Smaller Laptops & Mobile (Max Width: 1024px) */
@media screen and (max-width: 1024px) {
  .refer-page {
    padding: 24px 15px;
  }

  /* Stack layout vertically so sidebar never gets congested */
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Switch sidebar into a clean scrollable horizontal layout */
  .profile-sidebar {
    display: block;
    width: 100%;
    max-width: 1100px;
    flex: unset;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .profile-sidebar::-webkit-scrollbar {
    display: none;
  }

  /* Hide user header on horizontal strip layout */
  .sidebar-user-header {
    display: none;
  }

  .nav-item {
    padding: 8px 12px;
    font-size: 13px;
    gap: 8px;
    border-radius: 8px;
    flex-shrink: 0;
    white-space: nowrap;
  }


  .sidebar-icon {
    width: 14px;
    height: 14px;
  }

  .referral-hero {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 20px;
    padding: 30px 24px;
  }

  .referral-hero img {
    max-width: 150px;
    align-self: center;
  }

  .hero-content {
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
}

/* Mobile Devices (Max Width: 768px) */
@media screen and (max-width: 768px) {
  .refer-page {
    padding: 16px 10px;
  }

  .referral-hero {
    padding: 24px 20px;
    border-radius: 12px;
  }

  .referral-hero h2 {
    font-size: 22px;
  }

  .referral-hero p {
    font-size: 14px;
  }

  .referral-code-section {
    padding: 20px;
    border-radius: 12px;
  }

  .code-box {
    flex-direction: column;
    gap: 10px;
  }

  .btn-copy {
    width: 50%;
    padding: 10px 3px;
    font-size: 10px;
  }
  

  .stats-grid {
    grid-template-columns:1, 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 14px 20px;
    border-radius: 12px;
  }

  .stat-card small{
      font-size: 10px;
  }

  .stat-card h3{
      font-size: 12px;
  }

  .history-section {
    padding: 18px 16px;
    border-radius: 12px;
  }

  /* Transition multi-column lists into clean stacked card rows on mobile */
  #limitedHistoryList .history-row-card,
  #fullHistoryList .history-row-card {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 16px;
  }

  /* Reveal inline column labels on mobile views for clarity */
  .history-label {
    display: inline-block;
  }

  .history-info {
    justify-content: space-between;
    width: 100%;
  }

  .referred-user-name,
  .history-date {
    white-space: normal;
  }
}

/* Extra Small Mobile Devices (Max Width: 480px) */
@media screen and (max-width: 480px) {
  .referral-hero {
    padding: 20px 16px;
    font-size: 10px;
  }

  .referral-hero h2 {
    font-size: 10px;
  }

  .referral-code-section {
    padding: 16px 14px;
  }

  .code-box input {
    font-size: 12px;
    padding: 10px 12px;
  }

  .history-header-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .btn-view-all {
    width: 100%;
    text-align: center;
  }
}

/* Tiny Devices / Foldables (Max Width: 360px) */
@media screen and (max-width: 360px) {
  .refer-page {
    padding: 12px 6px;
  }

  .referral-hero h2 {
    font-size: 10px;
  }

  .referral-hero p {
    font-size: 8px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-card h3 {
    font-size: 10px;
  }

  .history-row-card {
    padding: 10px 12px;
  }
}