/* ===================================
   BDS SaaS Portal - Design System
   Light Theme — Matching BDS Corp
   =================================== */

/* ===== CSS Variables ===== */
:root {
  /* Colors - BDS Corp Light Professional Palette */
  --color-primary: #0A115C;
  /* BDS Navy */
  --color-primary-light: #1a2980;
  --color-primary-dark: #060b3d;
  --color-secondary: #2563eb;
  /* Accent Blue */
  --color-accent: #0d9488;
  /* Dark Aqua */

  --color-bg: #ffffff;
  /* Clean White */
  --color-surface: #f8f9fb;
  /* Light Gray Card */
  --color-surface-hover: #f0f2f5;
  --color-border: #e2e8f0;
  /* Soft Gray — for form inputs, sidebar dividers, tables */
  --color-card-border: #0d9488;
  /* Dark Aqua — for cards, matching BDS Corp style */

  --color-text: #1a1a2e;
  /* Dark Navy Text */
  --color-text-secondary: #4a5568;
  /* Medium Gray */
  --color-text-muted: #718096;

  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #2563eb;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #0A115C, #2563eb);
  --gradient-vibrant: linear-gradient(135deg, #0A115C, #2563eb);
  --gradient-surface: linear-gradient(180deg, rgba(0, 0, 0, 0.01) 0%, rgba(0, 0, 0, 0) 100%);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.12);

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.gradient-text {
  color: var(--color-primary);
  -webkit-text-fill-color: var(--color-primary);
}

h1 {
  font-size: var(--text-4xl);
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

p {
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

/* ===== Layout Components ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 1440px;
}

.container-narrow {
  max-width: 800px;
}

/* ===== Navigation ===== */
.nav-primary {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  align-items: center;
}

.nav-link {
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link.active {
  color: var(--color-primary);
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: var(--space-lg);
  overflow-y: auto;
}

.sidebar-nav {
  list-style: none;
  margin-top: var(--space-xl);
}

.sidebar-item {
  margin-bottom: var(--space-xs);
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-primary);
}

.sidebar-link.active {
  background: var(--color-primary);
  color: white;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-base);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: var(--font-primary);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(10, 17, 92, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(10, 17, 92, 0.35);
  filter: brightness(1.15);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.03);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-lg);
}

/* ===== Cards ===== */
.card {
  background: #ffffff;
  border-radius: var(--radius-2xl);
  padding: var(--space-xl);
  border: 1.5px solid var(--color-card-border);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--color-primary);
  background-color: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.card-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-md);
  font-size: var(--text-base);
  font-family: var(--font-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(10, 17, 92, 0.1);
}

.form-select option {
  background-color: #ffffff;
  color: var(--color-text);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.empty-state-icon {
  font-size: var(--text-4xl);
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.empty-state-title {
  font-size: var(--text-2xl);
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: hsl(150, 65%, 92%);
  color: var(--color-success);
}

.badge-warning {
  background: hsl(40, 95%, 92%);
  color: var(--color-warning);
}

.badge-error {
  background: hsl(0, 75%, 95%);
  color: var(--color-error);
}

.badge-info {
  background: hsl(200, 80%, 92%);
  color: var(--color-info);
}

/* ===== Hero Section ===== */
.hero {
  padding: var(--space-3xl) 0;
  text-align: center;
  background: linear-gradient(135deg,
      rgba(10, 17, 92, 0.03),
      rgba(37, 99, 235, 0.03));
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-lg);
  color: var(--color-primary);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  max-width: 700px;
  margin: 0 auto var(--space-xl);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .nav-links {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* ===== Utility Classes ===== */
.mt-auto {
  margin-top: auto;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--color-text-muted);
}

.font-mono {
  font-family: var(--font-mono);
}

.fw-bold {
  font-weight: 600;
}

.fw-normal {
  font-weight: 400;
}

/* ===== Pricing Components ===== */
.pricing-toggle-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.pricing-toggle {
  background: rgba(0, 0, 0, 0.03);
  padding: var(--space-xs);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  display: inline-flex;
}

.toggle-btn {
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-full);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: var(--text-base);
}

.toggle-btn:hover {
  color: var(--color-text);
}

.toggle-btn.active {
  background: var(--color-primary);
  color: #ffffff;
}

.card.highlight {
  border: 2px solid var(--color-primary);
  box-shadow: 0 0 30px rgba(10, 17, 92, 0.12);
  /* Primary color glow */
  transform: translateY(-8px);
  position: relative;
}

.popular-badge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--gradient-primary);
  color: white;
  padding: 0.5rem;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 1px;
}

/* Accordions for Features */
details {
  margin-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

summary {
  padding: var(--space-md) 0;
  cursor: pointer;
  font-weight: 500;
  color: var(--color-text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color var(--transition-fast);
}

summary:hover {
  color: var(--color-primary);
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: var(--text-lg);
  color: var(--color-primary-light);
  font-weight: 700;
}

details[open] summary::after {
  content: '−';
  /* Minus sign */
  color: var(--color-primary);
}

details[open] summary {
  border-bottom: none;
}

.details-content {
  padding-bottom: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================
   Phase 7: Consolidated Styles
   =================================== */

/* ===== Dashboard Layout ===== */
.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  background: var(--color-bg);
}

.top-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-area {
  padding: var(--space-xl);
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
  }
}

/* ===== Pricing Page Specifics ===== */
/* Panoramic Scroll Layout */
.pricing-section {
  padding: 100px 0 100px;
  overflow: hidden;
}

.pricing-scroll-container {
  overflow-x: auto;
  padding: 40px var(--space-md);
  margin: 0 -15px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) rgba(0, 0, 0, 0.05);
  -webkit-overflow-scrolling: touch;
}

.pricing-scroll-container::-webkit-scrollbar {
  height: 6px;
}

.pricing-scroll-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-full);
}

.pricing-scroll-container::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

.pricing-scroller {
  display: flex;
  gap: var(--space-lg);
  padding-bottom: 20px;
  width: max-content;
  margin: 0 auto;
}

/* Enlarged Pricing Cards */
.compact-pricing-card {
  min-width: 350px;
  max-width: 350px;
  padding: var(--space-xl) !important;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: all var(--transition-base);
  position: relative;
  background: #ffffff;
  border: 1.5px solid var(--color-card-border);
  height: auto;
  min-height: 850px;
}

.compact-pricing-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
}

/* Bundle Highlight */
.card.highlight.compact-pricing-card {
  border: 3px solid var(--color-primary) !important;
  box-shadow: 0 0 30px rgba(10, 17, 92, 0.12);
  background: #ffffff;
}

.card-header-compact {
  margin-bottom: var(--space-md);
}

.tier-name {
  font-size: var(--text-xl) !important;
  margin-bottom: 6px !important;
  letter-spacing: -0.5px;
}

.tier-tagline {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}

/* ===== Agency Dashboard Client List ===== */
.client-list-header {
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.8fr 1fr 120px;
  gap: 1rem;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
}

.client-row {
  background: transparent;
  transition: background-color var(--transition-fast);
}

.client-row:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.client-row:last-child {
  border-bottom: none !important;
}

/* Hide old table if still present */
.client-table {
  display: none;
}

.btn-icon:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* Center Accordion Header */
summary {
  justify-content: center;
  /* Center horizontally */
  position: relative;
}

summary::after {
  position: absolute;
  right: 0;
  /* Keep icon to the right */
}

/* Ensure padding accounts for icon to keep text truly centered? 
   Actually, usually flex centering works best if icon is separate. 
   Let's keep text centered and icon right. Use grid.
*/
summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  /* Centered text trick */
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  grid-column: 3;
  justify-self: end;
}

/* But the text is inside summary directly. Wrapping it in span is better but I can't change HTML easily in CSS file alone. 
   Let's use flex with auto margins. 
*/
summary {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
}

summary::after {
  position: absolute;
  right: 0;
}

.price-section {
  margin: var(--space-md) 0 var(--space-lg);
}

.price-display {
  font-size: var(--text-4xl) !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.price-period {
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.price-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  font-weight: 500;
}

/* Enlarged Toggles */
.billing-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-full);
  width: fit-content;
}

.switcher-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.switcher-label.active {
  color: var(--color-primary);
}

/* Switch UI */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  cursor: pointer;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e0;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked+.slider {
  background-color: var(--color-primary);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Expanded Feature Transparency */
.feature-list-compact {
  list-style: none;
  margin-bottom: var(--space-md);
  padding: 0;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-md);
}

.feature-list-compact li {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.feature-list-compact li span {
  color: var(--color-success);
  font-weight: bold;
  font-size: 1.1rem;
}

/* Details Panel */
.details-panel {
  display: block !important;
  margin-bottom: var(--space-xl);
}

.glass-panel {
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--color-border);
  padding: var(--space-md);
  border-radius: var(--radius-md);
}

.details-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.details-list li {
  margin-bottom: 8px;
  position: relative;
  padding-left: 20px;
}

.details-list li::before {
  content: "•";
  color: var(--color-primary);
  position: absolute;
  left: 0;
  font-weight: bold;
  font-size: 1.2rem;
}

.popular-badge-small {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: #4ade80;
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 6px 20px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  box-shadow: 0 4px 20px rgba(74, 222, 128, 0.4);
  z-index: 10;
  letter-spacing: 1px;
}

/* ===== Admin Dashboard ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.client-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-md);
}

.client-table th,
.client-table td {
  text-align: left;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.client-table th {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--color-surface);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Sidebar Toggle ===== */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: var(--text-2xl);
  cursor: pointer;
  margin-right: var(--space-md);
  padding: var(--space-sm);
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: block;
  }
}