/* Admin-specific styles */

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: var(--spacing-2);
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--spacing-2);
}

.tab-btn {
  padding: var(--spacing-3) var(--spacing-6);
  background: none;
  border: none;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  position: relative;
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.tab-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

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

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

/* Widget Leads Table */
.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table th,
.leads-table td {
  padding: var(--spacing-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leads-table th {
  background-color: var(--background);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.5px;
}

.leads-table tbody tr:hover {
  background-color: var(--background);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: var(--spacing-1) var(--spacing-2);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
}

.score-badge.excellent {
  background-color: #d1fae5;
  color: #065f46;
}

.score-badge.good {
  background-color: #dbeafe;
  color: #1e40af;
}

.score-badge.fair {
  background-color: #fef3c7;
  color: #92400e;
}

.score-badge.poor {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Clients Table */
.clients-table {
  width: 100%;
  border-collapse: collapse;
}

.clients-table th,
.clients-table td {
  padding: var(--spacing-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.clients-table th {
  background-color: var(--background);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.5px;
}

.clients-table tbody tr:hover {
  background-color: var(--background);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-1) var(--spacing-3);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-xl);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.status-badge.paid {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-badge.processing {
  background-color: #e0e7ff;
  color: #4338ca;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.action-buttons {
  display: flex;
  gap: var(--spacing-2);
}

.btn-icon {
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-sm);
}

.invoice-timeline {
  position: relative;
  padding-left: var(--spacing-6);
}

.invoice-timeline-item {
  position: relative;
  padding-bottom: var(--spacing-6);
  border-left: 2px solid var(--border);
}

.invoice-timeline-item:last-child {
  border-left: none;
  padding-bottom: 0;
}

.invoice-timeline-dot {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--surface);
  border: 2px solid var(--border);
}

.invoice-timeline-item.paid .invoice-timeline-dot {
  background-color: #10b981;
  border-color: #10b981;
}

.invoice-timeline-item.pending .invoice-timeline-dot {
  background-color: #f59e0b;
  border-color: #f59e0b;
}

.invoice-timeline-item.overdue .invoice-timeline-dot {
  background-color: #ef4444;
  border-color: #ef4444;
}

.invoice-timeline-content {
  padding-left: var(--spacing-4);
  padding-top: 0;
}

.invoice-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2);
}

.invoice-timeline-title {
  font-weight: 600;
  color: var(--text-primary);
}

.invoice-timeline-amount {
  font-weight: 700;
  color: var(--primary);
}

.invoice-timeline-meta {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.empty-invoices {
  text-align: center;
  padding: var(--spacing-8) var(--spacing-4);
  color: var(--text-secondary);
}

/* Table responsive */
@media (max-width: 768px) {
  .clients-table {
    display: block;
    overflow-x: auto;
  }

  .clients-table th,
  .clients-table td {
    padding: var(--spacing-2);
    font-size: var(--font-size-sm);
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* ===== BUYING POWER STYLES ===== */

/* Buying Power Header */
.buying-power-header {
  margin-bottom: var(--spacing-6);
}

.buying-power-header h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--spacing-2) 0;
}

/* Primary Metrics Grid */
.buying-power-primary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-6);
}

@media (max-width: 1024px) {
  .buying-power-primary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .buying-power-primary-grid {
    grid-template-columns: 1fr;
  }
}

/* Featured Stat Card */
.stat-card-featured {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(37, 99, 235, 0.05) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-featured:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Stat Icons */
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.customers-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.stat-icon.spend-icon {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
}

.stat-icon.leverage-icon {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

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

.stat-card-featured .stat-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: var(--spacing-1);
}

.stat-card-featured .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-2);
}

/* Stat Trend */
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-md);
}

.stat-trend.positive {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
}

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

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

.trend-arrow {
  font-weight: 700;
}

/* Leverage Bar */
.leverage-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-top: var(--spacing-2);
}

.leverage-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6 0%, #a78bfa 100%);
  border-radius: var(--radius-xl);
  transition: width 0.6s ease-out;
}

/* Platform Volume Grid */
.platform-volume-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--spacing-4);
  padding: var(--spacing-4);
}

@media (max-width: 1280px) {
  .platform-volume-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .platform-volume-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .platform-volume-grid {
    grid-template-columns: 1fr;
  }
}

/* Platform Card */
.platform-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-4);
  text-align: center;
  transition: all 0.2s ease;
}

.platform-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

/* Platform Logo */
.platform-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--spacing-3);
}

.platform-logo.facebook {
  background: #1877f2;
  color: white;
}

.platform-logo.instagram {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  color: white;
}

.platform-logo.twitter {
  background: #000000;
  color: white;
}

.platform-logo.linkedin {
  background: #0a66c2;
  color: white;
}

.platform-logo.google {
  background: white;
  border: 1px solid var(--border);
}

.platform-logo.google svg path:nth-child(1) { fill: #4285f4; }
.platform-logo.google svg path:nth-child(2) { fill: #34a853; }
.platform-logo.google svg path:nth-child(3) { fill: #fbbc05; }
.platform-logo.google svg path:nth-child(4) { fill: #ea4335; }

.platform-logo.tiktok {
  background: #000000;
  color: white;
}

.platform-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-2);
  font-size: var(--font-size-sm);
}

.platform-accounts {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-1);
}

.platform-spend {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-2);
}

.platform-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-md);
}

.platform-trend.positive {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.platform-trend.negative {
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

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

/* Buying Power Insights Grid */
.buying-power-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-6);
  margin-top: var(--spacing-6);
}

@media (max-width: 768px) {
  .buying-power-insights-grid {
    grid-template-columns: 1fr;
  }
}

/* Growth Metrics */
.growth-metrics .card-body {
  padding: var(--spacing-4);
}

.growth-metric-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-3) 0;
  border-bottom: 1px solid var(--border);
}

.growth-metric-item:last-child {
  border-bottom: none;
}

.growth-label {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.growth-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: var(--font-size-base);
}

/* Threshold List */
.deal-thresholds .card-body {
  padding: var(--spacing-4);
}

.threshold-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.threshold-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) 0;
  border-bottom: 1px solid var(--border);
}

.threshold-item:last-child {
  border-bottom: none;
}

.threshold-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.threshold-icon.pending {
  background-color: var(--border);
}

.threshold-icon.pending::after {
  content: '';
  width: 8px;
  height: 8px;
  background-color: var(--text-secondary);
  border-radius: 50%;
}

.threshold-icon.achieved {
  background-color: #10b981;
}

.threshold-icon.achieved::after {
  content: '';
  width: 12px;
  height: 12px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(1px, -2px);
}

.threshold-text {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.threshold-item.achieved .threshold-text {
  color: var(--text-primary);
  font-weight: 500;
}
