/**
 * Modern Ambassador Dashboard Styles
 * File: assets/css/dashboard-modern.css
 */

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.abd-ambassador-dashboard-modern {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ============================================
   DASHBOARD HEADER
   ============================================ */

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    color: white;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="2"/></svg>');
    opacity: 0.1;
}

.header-welcome {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.welcome-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 8px;
    background: linear-gradient(45deg, #fff, #f0f8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ambassador-code-badge {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ambassador-code-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.code-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.code-value {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-dashboard-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-dashboard-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

/* ============================================
   QUICK STATS GRID
   ============================================ */

.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.stat-card.earnings::before {
    background: linear-gradient(90deg, #56ab2f, #a8e6cf);
}

.stat-card.referrals::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.stat-card.conversion::before {
    background: linear-gradient(90deg, #f093fb, #f5576c);
}

.stat-card.rank::before {
    background: linear-gradient(90deg, #ffecd2, #fcb69f);
}

.stat-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.25);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-change {
   display: inline-flex;
   align-items: center;
   gap: 4px;
   font-size: 0.75rem;
   font-weight: 600;
   padding: 4px 8px;
   border-radius: 12px;
   background: rgba(255, 255, 255, 0.2);
}

.stat-change.positive {
   color: #10b981;
   background: rgba(16, 185, 129, 0.1);
}

.stat-change.negative {
   color: #ef4444;
   background: rgba(239, 68, 68, 0.1);
}

.stat-change.neutral {
   color: #6b7280;
   background: rgba(107, 114, 128, 0.1);
}

/* ============================================
  NAVIGATION TABS
  ============================================ */

.dashboard-navigation {
   margin-bottom: 32px;
}

.nav-tabs-wrapper {
   display: flex;
   background: white;
   border-radius: 16px;
   padding: 8px;
   box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
   overflow-x: auto;
   gap: 4px;
}

.nav-tab {
   display: flex;
   align-items: center;
   gap: 8px;
   padding: 12px 20px;
   border: none;
   background: transparent;
   border-radius: 12px;
   font-size: 0.875rem;
   font-weight: 500;
   color: #6b7280;
   cursor: pointer;
   transition: all 0.2s ease;
   white-space: nowrap;
   position: relative;
}

.nav-tab:hover {
   background: #f3f4f6;
   color: #374151;
}

.nav-tab.active {
   background: #667eea;
   color: white;
   box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.nav-tab i {
   font-size: 1rem;
}

.tab-badge {
   background: #ef4444;
   color: white;
   font-size: 0.625rem;
   font-weight: 700;
   padding: 2px 6px;
   border-radius: 8px;
   min-width: 16px;
   text-align: center;
}

.nav-tab.active .tab-badge {
   background: rgba(255, 255, 255, 0.2);
}

.tab-indicator {
   background: #10b981;
   color: white;
   font-size: 0.625rem;
   font-weight: 700;
   padding: 2px 6px;
   border-radius: 8px;
   min-width: 16px;
   text-align: center;
}

/* ============================================
  TAB CONTENT
  ============================================ */

.dashboard-content {
   background: white;
   border-radius: 16px;
   box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
   overflow: hidden;
}

.tab-panel {
   display: none;
   padding: 32px;
}

.tab-panel.active {
   display: block;
}

/* ============================================
  OVERVIEW TAB STYLES
  ============================================ */

.overview-content {
   display: grid;
   gap: 32px;
}

.section-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 24px;
}

.section-header h3 {
   display: flex;
   align-items: center;
   gap: 12px;
   font-size: 1.25rem;
   font-weight: 600;
   color: #1f2937;
   margin: 0;
}

.section-header h3 i {
   color: #667eea;
}

/* Charts Section */
.charts-section {
   background: #f9fafb;
   border-radius: 16px;
   padding: 24px;
}

.charts-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
   gap: 24px;
}

.chart-card {
   background: white;
   border-radius: 12px;
   padding: 24px;
   box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 16px;
}

.chart-header h4 {
   font-size: 1rem;
   font-weight: 600;
   color: #374151;
   margin: 0;
}

.chart-value {
   font-size: 1.5rem;
   font-weight: 700;
   color: #667eea;
}

.chart-container {
   height: 200px;
   position: relative;
}

.period-selector {
   padding: 8px 12px;
   border: 1px solid #d1d5db;
   border-radius: 8px;
   font-size: 0.875rem;
   background: white;
}

/* Goals Section */
.goals-section {
   background: #f9fafb;
   border-radius: 16px;
   padding: 24px;
}

.goals-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
   gap: 20px;
}

.goal-card {
   background: white;
   border-radius: 12px;
   padding: 20px;
   box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
   transition: transform 0.2s ease;
}

.goal-card:hover {
   transform: translateY(-2px);
}

.goal-header {
   display: flex;
   align-items: flex-start;
   gap: 16px;
   margin-bottom: 16px;
}

.goal-icon {
   width: 48px;
   height: 48px;
   border-radius: 12px;
   background: linear-gradient(135deg, #667eea, #764ba2);
   display: flex;
   align-items: center;
   justify-content: center;
   color: white;
   font-size: 1.25rem;
   flex-shrink: 0;
}

.goal-details h4 {
   font-size: 1rem;
   font-weight: 600;
   color: #1f2937;
   margin: 0 0 4px;
}

.goal-description {
   font-size: 0.875rem;
   color: #6b7280;
}

.goal-progress {
   margin-bottom: 16px;
}

.progress-stats {
   display: flex;
   justify-content: space-between;
   align-items: baseline;
   margin-bottom: 8px;
}

.current-value {
   font-size: 1.5rem;
   font-weight: 700;
   color: #1f2937;
}

.target-value {
   font-size: 1rem;
   color: #6b7280;
}

.progress-bar {
   height: 8px;
   background: #f3f4f6;
   border-radius: 4px;
   overflow: hidden;
   margin-bottom: 8px;
}

.progress-fill {
   height: 100%;
   background: linear-gradient(90deg, #10b981, #34d399);
   border-radius: 4px;
   transition: width 0.5s ease;
}

.progress-percentage {
   text-align: right;
   font-size: 0.875rem;
   font-weight: 600;
   color: #10b981;
}

.goal-completed {
   background: #ecfdf5;
   border: 1px solid #d1fae5;
   border-radius: 8px;
   padding: 8px 12px;
   display: flex;
   align-items: center;
   gap: 8px;
   font-size: 0.875rem;
   font-weight: 500;
   color: #065f46;
}

.goal-completed i {
   color: #10b981;
}

.no-goals {
   grid-column: 1 / -1;
   text-align: center;
   padding: 40px 20px;
   color: #6b7280;
}

.no-goals i {
   font-size: 3rem;
   margin-bottom: 16px;
   opacity: 0.5;
}

/* Activity Section */
.activity-section {
   background: #f9fafb;
   border-radius: 16px;
   padding: 24px;
}

.activity-feed {
   display: grid;
   gap: 16px;
   max-height: 500px;
   overflow-y: auto;
}

.activity-item {
   background: white;
   border-radius: 12px;
   padding: 16px;
   display: flex;
   align-items: flex-start;
   gap: 16px;
   box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
   transition: transform 0.2s ease;
}

.activity-item:hover {
   transform: translateX(4px);
}

.activity-icon {
   width: 40px;
   height: 40px;
   border-radius: 10px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1rem;
   flex-shrink: 0;
}

.activity-icon.commission {
   background: linear-gradient(135deg, #10b981, #34d399);
   color: white;
}

.activity-icon.referral {
   background: linear-gradient(135deg, #667eea, #764ba2);
   color: white;
}

.activity-icon.listing {
   background: linear-gradient(135deg, #f59e0b, #fbbf24);
   color: white;
}

.activity-content {
   flex: 1;
   min-width: 0;
}

.activity-title {
   font-weight: 600;
   color: #1f2937;
   margin-bottom: 4px;
}

.activity-description {
   font-size: 0.875rem;
   color: #6b7280;
   margin-bottom: 8px;
}

.activity-meta {
   display: flex;
   justify-content: space-between;
   align-items: center;
   font-size: 0.75rem;
}

.activity-time {
   color: #9ca3af;
}

.activity-amount {
   background: #ecfdf5;
   color: #065f46;
   padding: 2px 8px;
   border-radius: 6px;
   font-weight: 600;
}

.no-activity {
   text-align: center;
   padding: 40px 20px;
   color: #6b7280;
}

.no-activity i {
   font-size: 3rem;
   margin-bottom: 16px;
   opacity: 0.5;
}

.view-all-btn {
   color: #667eea;
   text-decoration: none;
   font-weight: 500;
   font-size: 0.875rem;
   transition: color 0.2s ease;
}

.view-all-btn:hover {
   color: #4f46e5;
   text-decoration: underline;
}

/* ============================================
  REFERRALS TAB STYLES
  ============================================ */

.referrals-content {
   display: grid;
   gap: 32px;
}

.referrals-summary {
   background: #f9fafb;
   border-radius: 16px;
   padding: 24px;
}

.summary-cards {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 20px;
}

.summary-card {
   background: white;
   border-radius: 12px;
   padding: 20px;
   display: flex;
   align-items: center;
   gap: 16px;
   box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
   transition: transform 0.2s ease;
}

.summary-card:hover {
   transform: translateY(-2px);
}

.summary-card .card-icon {
   width: 48px;
   height: 48px;
   border-radius: 12px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1.25rem;
   color: white;
   flex-shrink: 0;
}

.summary-card.total .card-icon {
   background: linear-gradient(135deg, #667eea, #764ba2);
}

.summary-card.active .card-icon {
   background: linear-gradient(135deg, #10b981, #34d399);
}

.summary-card.conversion .card-icon {
   background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.summary-card.this-month .card-icon {
   background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.card-content {
   flex: 1;
}

.card-number {
   font-size: 1.875rem;
   font-weight: 700;
   color: #1f2937;
   line-height: 1;
   margin-bottom: 4px;
}

.card-label {
   font-size: 0.875rem;
   color: #6b7280;
   font-weight: 500;
}

/* Referrals Table */
.referrals-table-section {
   background: #f9fafb;
   border-radius: 16px;
   padding: 24px;
}

.table-actions {
   display: flex;
   gap: 16px;
   align-items: center;
}

.search-box {
   position: relative;
   max-width: 300px;
   flex: 1;
}

.search-box input {
   width: 100%;
   padding: 10px 16px 10px 40px;
   border: 1px solid #d1d5db;
   border-radius: 8px;
   font-size: 0.875rem;
}

.search-box i {
   position: absolute;
   left: 12px;
   top: 50%;
   transform: translateY(-50%);
   color: #9ca3af;
}

.status-filter {
   padding: 10px 16px;
   border: 1px solid #d1d5db;
   border-radius: 8px;
   font-size: 0.875rem;
   background: white;
   min-width: 120px;
}

.referrals-table-wrapper {
   background: white;
   border-radius: 12px;
   overflow: hidden;
   box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.referrals-table {
   width: 100%;
   border-collapse: collapse;
}

.referrals-table th {
   background: #f9fafb;
   padding: 16px;
   text-align: left;
   font-weight: 600;
   color: #374151;
   font-size: 0.875rem;
   border-bottom: 1px solid #e5e7eb;
}

.referrals-table td {
   padding: 16px;
   border-bottom: 1px solid #f3f4f6;
   vertical-align: top;
}

.referrals-table tr:hover {
   background: #f9fafb;
}

.referral-info {
   display: flex;
   flex-direction: column;
   gap: 4px;
}

.referral-name {
   font-weight: 600;
   color: #1f2937;
}

.referral-email {
   font-size: 0.875rem;
   color: #6b7280;
}

.referral-type {
   padding: 4px 12px;
   border-radius: 12px;
   font-size: 0.75rem;
   font-weight: 600;
   text-transform: uppercase;
}

.referral-type.business {
   background: #dbeafe;
   color: #1e40af;
}

.referral-type.user {
   background: #f3e8ff;
   color: #7c3aed;
}

.status-badge {
   padding: 4px 12px;
   border-radius: 12px;
   font-size: 0.75rem;
   font-weight: 600;
   text-transform: uppercase;
}

.status-active {
   background: #d1fae5;
   color: #065f46;
}

.status-pending {
   background: #fef3c7;
   color: #92400e;
}

.status-expired {
   background: #fee2e2;
   color: #991b1b;
}

.commission-info {
   display: flex;
   flex-direction: column;
   gap: 4px;
}

.commission-amount {
   font-weight: 600;
   color: #1f2937;
}

.commission-status.pending {
   font-size: 0.75rem;
   color: #f59e0b;
   font-weight: 500;
}

.date-info {
   display: flex;
   flex-direction: column;
   gap: 4px;
}

.date-main {
   font-weight: 500;
   color: #1f2937;
}

.date-time {
   font-size: 0.75rem;
   color: #9ca3af;
}

.action-buttons {
   display: flex;
   gap: 8px;
}

.view-details-btn,
.view-business-btn {
   width: 32px;
   height: 32px;
   border: none;
   border-radius: 6px;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   transition: all 0.2s ease;
   text-decoration: none;
}

.view-details-btn {
   background: #e0e7ff;
   color: #3730a3;
}

.view-details-btn:hover {
   background: #c7d2fe;
}

.view-business-btn {
   background: #dcfce7;
   color: #166534;
}

.view-business-btn:hover {
   background: #bbf7d0;
}

.empty-state {
   text-align: center;
   padding: 60px 20px;
   color: #6b7280;
}

.empty-state i {
   font-size: 4rem;
   margin-bottom: 24px;
   opacity: 0.5;
}

.empty-state h4 {
   font-size: 1.25rem;
   font-weight: 600;
   color: #374151;
   margin: 0 0 12px;
}

.empty-state p {
   margin-bottom: 24px;
   font-size: 1rem;
}

.button-primary {
   background: #667eea;
   color: white;
   padding: 12px 24px;
   border: none;
   border-radius: 8px;
   font-weight: 600;
   text-decoration: none;
   display: inline-block;
   transition: background 0.2s ease;
}

.button-primary:hover {
   background: #5a67d8;
}

/* ============================================
  RESPONSIVE DESIGN
  ============================================ */

@media (max-width: 768px) {
   .abd-ambassador-dashboard-modern {
       padding: 16px;
   }

   .dashboard-header {
       padding: 24px;
       margin-bottom: 24px;
   }

   .header-welcome {
       flex-direction: column;
       gap: 20px;
       align-items: flex-start;
   }

   .welcome-content h1 {
       font-size: 2rem;
   }

   .header-actions {
       flex-direction: column;
       align-items: flex-start;
       width: 100%;
   }

   .quick-stats-grid {
       grid-template-columns: 1fr;
       gap: 16px;
   }

   .nav-tabs-wrapper {
       padding: 6px;
   }

   .nav-tab {
       padding: 8px 12px;
       font-size: 0.8rem;
   }

   .nav-tab span:last-child {
       display: none;
   }

   .tab-panel {
       padding: 20px;
   }

   .charts-grid {
       grid-template-columns: 1fr;
       gap: 16px;
   }

   .goals-grid {
       grid-template-columns: 1fr;
       gap: 16px;
   }

   .summary-cards {
       grid-template-columns: repeat(2, 1fr);
       gap: 12px;
   }

   .card-number {
       font-size: 1.5rem;
   }

   .table-actions {
       flex-direction: column;
       gap: 12px;
       align-items: stretch;
   }

   .search-box {
       max-width: none;
   }

   .referrals-table-wrapper {
       overflow-x: auto;
   }

   .referrals-table {
       min-width: 600px;
   }
}

@media (max-width: 480px) {
   .welcome-content h1 {
       font-size: 1.75rem;
   }

   .stat-card {
       flex-direction: column;
       text-align: center;
       gap: 12px;
   }

   .summary-cards {
       grid-template-columns: 1fr;
   }

   .goal-header {
       flex-direction: column;
       text-align: center;
       gap: 12px;
   }

   .activity-item {
       flex-direction: column;
       text-align: center;
       gap: 12px;
   }

   .activity-meta {
       flex-direction: column;
       gap: 8px;
       text-align: center;
   }
}

/* ============================================
  LOADING & ANIMATIONS
  ============================================ */

@keyframes fadeIn {
   from {
       opacity: 0;
       transform: translateY(20px);
   }
   to {
       opacity: 1;
       transform: translateY(0);
   }
}

@keyframes slideIn {
   from {
       opacity: 0;
       transform: translateX(-20px);
   }
   to {
       opacity: 1;
       transform: translateX(0);
   }
}

.tab-panel.active {
   animation: fadeIn 0.3s ease;
}

.activity-item {
   animation: slideIn 0.3s ease;
}

.loading-spinner {
   display: inline-block;
   width: 20px;
   height: 20px;
   border: 3px solid rgba(102, 126, 234, 0.3);
   border-radius: 50%;
   border-top-color: #667eea;
   animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
   to {
       transform: rotate(360deg);
   }
}

/* ============================================
  DARK MODE SUPPORT (Optional)
  ============================================ */

@media (prefers-color-scheme: dark) {
   .abd-ambassador-dashboard-modern {
       background: #111827;
       color: #f9fafb;
   }

   .dashboard-content,
   .chart-card,
   .goal-card,
   .activity-item,
   .summary-card,
   .referrals-table-wrapper {
       background: #1f2937;
       border-color: #374151;
   }

   .section-header h3,
   .chart-header h4,
   .goal-details h4,
   .activity-title,
   .referral-name,
   .commission-amount,
   .date-main,
   .card-number {
       color: #f9fafb;
   }

   .welcome-subtitle,
   .goal-description,
   .activity-description,
   .referral-email,
   .date-time,
   .card-label {
       color: #d1d5db;
   }

   .charts-section,
   .goals-section,
   .activity-section,
   .referrals-summary,
   .referrals-table-section {
       background: #1f2937;
   }

   .referrals-table th {
       background: #374151;
       color: #f9fafb;
   }

   .nav-tab {
       color: #d1d5db;
   }

   .nav-tab:hover {
       background: #374151;
       color: #f9fafb;
   }

   .search-box input,
   .status-filter,
   .period-selector {
       background: #374151;
       border-color: #4b5563;
       color: #f9fafb;
   }
}