:root {
  /* WafraX Brand Identity - Signature Violet (Ownable & Distinct) */
  --twc-primary: 91 33 182;          /* #5B21B6 - WafraX Violet (Primary) - Signature Brand Color */
  --twc-primary-hover: 109 40 217;   /* #6D28D9 - Deep Violet (Hover) - Stronger Emphasis */
  --twc-secondary: 147 51 234;       /* #9333EA - Bright Purple (Gradient) - AI Energy */

  /* Backgrounds */
  --twc-bg: 249 250 251;             /* #F9FAFB - Light Gray Background */
  --twc-bg-elevated: 250 250 251;    /* #FAFAFB - Slightly Tinted for Depth */
  --twc-surface: 255 255 255;        /* #FFFFFF - Card/Surface White */
  --twc-surface-subtle: 243 244 246; /* #F3F4F6 - Subtle Gray */

  /* Text */
  --twc-text: 17 24 39;              /* #111827 - Dark Text */
  --twc-text-subtle: 107 114 128;    /* #6B7280 - Muted Text */

  /* State Colors */
  --twc-success: 22 163 74;          /* #16A34A - Success/Revenue Green */
  --twc-warning: 250 204 21;         /* #FACC15 - Warning Yellow */
  --twc-error: 220 38 38;            /* #DC2626 - Error Red */
  --twc-info: 59 130 246;            /* #3B82F6 - Info Blue (Neutral Accent) */

  /* Borders */
  --twc-border: 229 231 235;         /* #E5E7EB - Neutral Border */
  --twc-border-subtle: 243 244 246;  /* #F3F4F6 - Subtle Border */
}

.dark {
  --twc-primary: 99 102 241;
  --twc-bg: 3 7 18;
  --twc-surface: 17 24 39;
  --twc-surface-subtle: 31 41 55;
  --twc-text: 243 244 246;
  --twc-text-subtle: 156 163 175;
  --twc-success: 34 197 94;
  --twc-warning: 245 158 11;
  --twc-error: 248 113 113;
  --twc-info: 56 189 248;
}

html { font-family: Inter, ui-sans-serif, system-ui; font-size: 14px; }
body { background: rgb(var(--twc-bg)); color: rgb(var(--twc-text)); }

/* Elevated Section for Depth Separation */
.section-elevated {
  background-color: rgb(var(--twc-bg-elevated));
  padding: 1.5rem;
  border-radius: 12px;
}

/* Navbar - ensure solid background */
nav.bg-surface {
  background-color: rgb(var(--twc-surface)) !important;
  opacity: 1 !important;
}

/* Modal & Popup - ensure solid backgrounds */
.fixed.inset-0 {
  background-color: rgba(0, 0, 0, 0.6) !important;
}

[class*="modal"],
[id*="modal"],
[id*="Modal"] {
  background-color: rgb(var(--twc-surface)) !important;
}

.bg-surface {
  background-color: rgb(var(--twc-surface)) !important;
}

.section { padding: 32px 24px; }
.container-1280 { max-width: 1280px; margin: 0 auto; }

/* Sidebar Link Styling */
.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(var(--twc-text-subtle));
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.sidebar-link svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.75rem;
}

.sidebar-link:hover {
  background-color: rgb(var(--twc-surface-subtle));
  color: rgb(var(--twc-text));
}

.sidebar-link.active {
  background-color: rgb(var(--twc-primary) / 0.1);
  color: rgb(var(--twc-primary));
  font-weight: 600;
}

/* Card Styling - Enhanced with Luxury SaaS Touch & Soft Elevation */
.card {
  background-color: rgb(var(--twc-surface));
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgb(var(--twc-border-subtle));
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: rgb(var(--twc-primary) / 0.3);
}

/* AI Campaign Card - Purple Accent */
.card.ai-campaign,
.ai-suggestions-container .card {
  border-left: 3px solid rgb(var(--twc-primary));
}

/* Active Campaign Card - Green Accent */
.card.campaign-active {
  border-left: 3px solid rgb(var(--twc-success));
}

/* Button Styling */
.btn, button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
  opacity: 1 !important;
}

.btn-primary,
button.bg-primary,
button[class*="bg-indigo"],
button[class*="bg-purple"] {
  background-color: rgb(var(--twc-primary)) !important;
  color: white !important;
  opacity: 1 !important;
  box-shadow: 0 2px 8px rgba(91, 33, 182, 0.25) !important;
  transition: all 0.2s ease;
}

.btn-primary:hover,
button.bg-primary:hover,
button[class*="bg-indigo"]:hover,
button[class*="bg-purple"]:hover {
  background-color: rgb(var(--twc-primary-hover)) !important;
  box-shadow: 0 4px 14px rgba(91, 33, 182, 0.35) !important;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: rgb(var(--twc-surface-subtle)) !important;
  color: rgb(var(--twc-text)) !important;
  border: 1px solid rgb(209 213 219) !important;
  opacity: 1 !important;
}

.btn-secondary:hover {
  background-color: rgb(229 231 235) !important;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* Gradient Buttons - WafraX Signature Shimmer */
button[class*="gradient"] {
  background: linear-gradient(45deg, rgb(var(--twc-primary)) 0%, rgb(var(--twc-secondary)) 100%) !important;
  color: white !important;
  opacity: 1 !important;
  box-shadow: 0 4px 12px rgba(91, 33, 182, 0.35) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  transition: all 0.3s ease;
}

button[class*="gradient"]:hover {
  background: linear-gradient(45deg, rgb(var(--twc-secondary)) 0%, rgb(var(--twc-primary-hover)) 100%) !important;
  box-shadow: 0 6px 20px rgba(91, 33, 182, 0.5) !important;
  transform: translateY(-2px) scale(1.02);
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, rgb(var(--twc-surface-subtle)) 25%, rgb(229 231 235) 50%, rgb(var(--twc-surface-subtle)) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.badge-info {
  background-color: rgb(var(--twc-primary) / 0.1);
  color: rgb(var(--twc-primary));
}

.badge-ai {
  background: linear-gradient(135deg, rgb(var(--twc-primary)) 0%, rgb(var(--twc-secondary)) 100%);
  color: white;
  padding: 0.25rem 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(91, 33, 182, 0.3);
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.badge-ai:hover {
  box-shadow: 0 4px 10px rgba(91, 33, 182, 0.45);
  transform: translateY(-1px);
}

/* Beta Badge Pill */
.badge-beta {
  background-color: rgb(var(--twc-primary) / 0.1);
  color: rgb(var(--twc-primary));
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background-color: rgb(var(--twc-success) / 0.1);
  color: rgb(var(--twc-success));
}

.badge-warning {
  background-color: rgb(var(--twc-warning) / 0.1);
  color: rgb(217 119 6);
}

/* Stats Card with Deep Violet Accent Bar */
.stat-card {
  position: relative;
  overflow: hidden;
  background-color: rgb(var(--twc-surface));
  border-radius: 12px;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgb(var(--twc-primary)) 0%, rgb(var(--twc-secondary)) 100%);
}

/* AI Pulse Animation */
@keyframes ai-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.15);
  }
}

.ai-pulse {
  animation: ai-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.ai-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(var(--twc-secondary)), #ffffff);
  box-shadow: 0 0 10px rgba(147, 51, 234, 0.8);
  animation: ai-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  margin-left: 6px;
}

/* AI Shimmer Effect (for generating state) */
@keyframes ai-shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.ai-generating {
  background: linear-gradient(
    90deg,
    rgb(var(--twc-primary)) 0%,
    rgb(var(--twc-secondary)) 50%,
    rgb(var(--twc-primary)) 100%
  );
  background-size: 200% auto;
  animation: ai-shimmer 2s linear infinite;
}

/* Progress Indicator for AI Generation */
.ai-progress-indicator {
  position: relative;
  padding-left: 2rem;
}

.ai-progress-indicator::before {
  content: '🤖';
  position: absolute;
  left: 0;
  animation: ai-pulse 1.5s ease-in-out infinite;
}

/* Trend Indicator */
.trend-up {
  color: rgb(var(--twc-success));
  font-weight: 600;
  font-size: 0.75rem;
}

.trend-down {
  color: rgb(var(--twc-error));
  font-weight: 600;
  font-size: 0.75rem;
}

/* Animated Trend Arrow */
.trend-arrow {
  display: inline-block;
  animation: trend-bounce 2s ease-in-out infinite;
}

@keyframes trend-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* Performance Badge */
.performance-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background-color: rgb(var(--twc-success) / 0.1);
  color: rgb(var(--twc-success));
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Table Styling */
.table-container {
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid rgb(229 231 235);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead {
  background-color: rgb(var(--twc-surface-subtle));
  border-bottom: 2px solid rgb(229 231 235);
}

th {
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: rgb(var(--twc-text));
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

td {
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  color: rgb(var(--twc-text));
  border-bottom: 1px solid rgb(243 244 246);
}

tbody tr {
  transition: all 0.15s ease;
}

tbody tr:hover {
  background-color: rgb(250 250 251); /* #FAFAFB - Soft highlight */
  box-shadow: 0 1px 3px rgba(91, 33, 182, 0.08);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Chart Container Enhancements */
.chart-container {
  position: relative;
  border-radius: 12px;
  padding: 1.25rem;
  background: rgb(var(--twc-surface));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.chart-container:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Chart Animation on Load */
@keyframes chart-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chart-animate {
  animation: chart-fade-in 0.6s ease-out;
}

/* Pagination */
#product-pagination {
  padding: 0.75rem;
  border-top: 1px solid rgb(229 231 235);
  background-color: rgb(var(--twc-surface-subtle) / 0.3);
}
