/**
 * InfiniteAuthority Design System
 * Premium, professional theme for seamless UX flow
 * Version: 2.0.0 - Muted Gold Accent
 */

:root {
  /* === Brand Colors - Premium Dark === */
  --brand-gold: #C9A962;
  --brand-gold-hover: #D4B978;
  --brand-gold-muted: rgba(201, 169, 98, 0.15);
  --brand-charcoal: #0F0F10;
  --brand-slate: #18181B;
  --brand-navy: #1C1C1F;
  
  /* === Legacy Brand (for compatibility) === */
  --brand-deep-blue: #C9A962;
  --brand-electric-blue: #C9A962;
  --brand-light-blue: #D4B978;
  
  /* === Accent Colors === */
  --accent-primary: #C9A962;
  --accent-primary-hover: #D4B978;
  --accent-success: #22C55E;
  --accent-success-light: #dcfce7;
  --accent-warning: #f59e0b;
  --accent-warning-light: #fef3c7;
  --accent-critical: #ef4444;
  --accent-critical-light: #fee2e2;
  --accent-info: #C9A962;
  --accent-info-light: rgba(201, 169, 98, 0.15);
  
  /* === Surface Colors (Dark Mode) === */
  --surface-primary: #0F0F10;
  --surface-secondary: #18181B;
  --surface-elevated: #1C1C1F;
  --surface-hover: #27272A;
  --surface-active: #3F3F46;
  
  /* === Border Colors === */
  --border-subtle: #27272A;
  --border-medium: #3F3F46;
  --border-strong: #52525B;
  --border-focus: #C9A962;
  
  /* === Text Colors === */
  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-tertiary: #71717A;
  --text-muted: #52525B;
  --text-inverse: #0F0F10;
  
  /* === Spacing === */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  
  /* === Border Radius === */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* === Shadows === */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
  
  /* === Typography === */
  --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'Monaco', 'Courier New', monospace;
  
  /* === Transitions === */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ==============================
   InfiniteAuthority Dashboard – Non-subscriber CRO polish
   Scoped to `.ia-shell` to avoid impacting other pages.
   ============================== */

.ia-shell .ia-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ia-shell .ia-btn-primary {
  border-radius: 999px;
  font-weight: 800;
}

.ia-shell .ia-btn-large {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  line-height: 1.2;
}

.ia-shell .ia-progress {
  margin: -0.75rem 0 1.25rem;
  padding: 0.9rem 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.ia-shell .ia-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  color: #111827;
  margin-bottom: 0.55rem;
  font-weight: 600;
}

.ia-shell .ia-progress-bar {
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  height: 8px;
}

.ia-shell .ia-progress-fill {
  background: #22c55e;
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.ia-shell .ia-section-explainer {
  margin: 0.5rem 0 0.9rem;
  font-size: 0.92rem;
  color: #4b5563;
  max-width: 72ch;
}

.ia-shell .ia-benefits {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem 1.25rem;
  margin: 0 0 1.25rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.ia-shell .ia-benefits h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 900;
  color: #111827;
}

.ia-shell .ia-section-intro {
  margin: 0 0 1rem;
  color: #374151;
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 80ch;
}

.ia-shell .ia-benefits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.ia-shell .ia-benefit {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.95rem 0.95rem;
}

.ia-shell .ia-benefit h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
}

.ia-shell .ia-benefit p {
  margin: 0;
  color: #4b5563;
  font-size: 0.92rem;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .ia-shell .ia-benefits-grid {
    grid-template-columns: 1fr;
  }
}

.ia-shell .ia-final-cta {
  border-color: #fde68a;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  background: radial-gradient(140% 120% at 10% 0%, rgba(250, 204, 21, 0.18) 0%, transparent 50%), #ffffff;
}

.ia-shell .ia-grid.ia-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
  margin: 0 0 1.25rem;
}

@media (max-width: 860px) {
  .ia-shell .ia-grid.ia-grid-2 {
    grid-template-columns: 1fr;
  }
}

.ia-shell .ia-final-cta-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.ia-shell .ia-final-note {
  max-width: 70ch;
}

.ia-shell .ia-floating-cta {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  padding: 10px 20px;
  border-radius: 999px;
  background: #fbbf24;
  color: #111827;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.4);
  border: none;
  cursor: pointer;
}

.ia-shell .ia-floating-cta:hover {
  background: #f59e0b;
}

@media (max-width: 420px) {
  .ia-shell .ia-floating-cta {
    display: none;
  }
}

.ia-shell .ia-locked-row,
.ia-shell .ia-locked-card {
  position: relative;
  opacity: 0.55;
}

.ia-shell .ia-locked-row::after,
.ia-shell .ia-locked-card::after {
  content: "Unlock with 30-Day Revive";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #111827;
  background: rgba(248, 250, 252, 0.85);
  border-radius: inherit;
}

/* Table row locking: ensure overlay aligns reasonably inside table cells */
.ia-shell tr.ia-locked-row {
  position: relative;
}

.ia-shell tr.ia-locked-row::after {
  left: 0;
  right: 0;
}

/* === Base Styles === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

/* === Cards === */
.card, .ds-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card:hover, .ds-card:hover {
  box-shadow: var(--shadow-md);
}

.card-elevated, .ds-card-elevated {
  box-shadow: var(--shadow-md);
}

/* === Buttons === */
.btn, .ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary, .ds-btn-primary {
  background: linear-gradient(135deg, var(--brand-electric-blue) 0%, var(--brand-deep-blue) 100%);
  color: var(--text-inverse);
}

.btn-primary:hover, .ds-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:disabled, .ds-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary, .ds-btn-secondary {
  background: var(--surface-primary);
  color: var(--brand-electric-blue);
  border: 2px solid var(--brand-electric-blue);
}

.btn-secondary:hover, .ds-btn-secondary:hover {
  background: var(--accent-info-light);
}

.btn-ghost, .ds-btn-ghost {
  background: transparent;
  color: var(--brand-electric-blue);
  border: none;
}

.btn-ghost:hover, .ds-btn-ghost:hover {
  background: var(--surface-hover);
}

/* === Badges === */
.badge, .ds-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}

.badge-critical, .ds-badge-critical {
  background: var(--accent-critical);
  color: var(--text-inverse);
}

.badge-high, .ds-badge-high {
  background: var(--accent-warning);
  color: var(--text-primary);
}

.badge-medium, .ds-badge-medium {
  background: var(--text-muted);
  color: var(--text-inverse);
}

.badge-success, .ds-badge-success {
  background: var(--accent-success);
  color: var(--text-inverse);
}

.badge-info, .ds-badge-info {
  background: var(--accent-info);
  color: var(--text-inverse);
}

/* === Form Elements === */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select,
.ds-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus,
.ds-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

label, .ds-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

/* === Header === */
.ds-header {
  background: var(--surface-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-xs);
}

.ds-header-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-slate);
  text-decoration: none;
}

.ds-header-nav {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.ds-header-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.ds-header-link:hover {
  color: var(--brand-electric-blue);
}

/* === Container === */
.ds-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.ds-container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* === Progress Steps === */
.ds-progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  padding: 0 var(--space-lg);
}

.ds-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.ds-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border-subtle);
  z-index: -1;
}

.ds-step.active:not(:last-child)::after {
  background: var(--brand-electric-blue);
}

.ds-step-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: 50%;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.ds-step.active .ds-step-number {
  background: var(--brand-electric-blue);
  border-color: var(--brand-electric-blue);
  color: var(--text-inverse);
}

.ds-step.completed .ds-step-number {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: var(--text-inverse);
}

.ds-step-label {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-align: center;
}

.ds-step.active .ds-step-label {
  color: var(--text-primary);
  font-weight: 600;
}

/* === Alerts === */
.ds-alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  margin-bottom: var(--space-md);
}

.ds-alert-success {
  background: var(--accent-success-light);
  border-color: var(--accent-success);
  color: #065f46;
}

.ds-alert-warning {
  background: var(--accent-warning-light);
  border-color: var(--accent-warning);
  color: #92400e;
}

.ds-alert-error {
  background: var(--accent-critical-light);
  border-color: var(--accent-critical);
  color: #991b1b;
}

.ds-alert-info {
  background: var(--accent-info-light);
  border-color: var(--accent-info);
  color: #1e40af;
}

/* === Tables === */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ds-table thead {
  background: var(--surface-elevated);
}

.ds-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ds-table td {
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.ds-table tbody tr:hover {
  background: var(--surface-hover);
}

/* === Loading States === */
.ds-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--brand-electric-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.ds-skeleton {
  background: linear-gradient(90deg, var(--surface-elevated) 25%, var(--surface-hover) 50%, var(--surface-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

/* === Utilities === */
.ds-text-primary { color: var(--text-primary); }
.ds-text-secondary { color: var(--text-secondary); }
.ds-text-tertiary { color: var(--text-tertiary); }
.ds-text-muted { color: var(--text-muted); }
.ds-text-inverse { color: var(--text-inverse); }

.ds-bg-primary { background: var(--surface-primary); }
.ds-bg-secondary { background: var(--surface-secondary); }
.ds-bg-elevated { background: var(--surface-elevated); }

.ds-border { border: 1px solid var(--border-subtle); }
.ds-border-top { border-top: 1px solid var(--border-subtle); }
.ds-border-bottom { border-bottom: 1px solid var(--border-subtle); }

.ds-rounded { border-radius: var(--radius-md); }
.ds-rounded-lg { border-radius: var(--radius-lg); }
.ds-rounded-full { border-radius: var(--radius-full); }

.ds-shadow { box-shadow: var(--shadow-sm); }
.ds-shadow-md { box-shadow: var(--shadow-md); }
.ds-shadow-lg { box-shadow: var(--shadow-lg); }

.ds-hidden { display: none; }
.ds-visible { display: block; }

/* === Responsive === */
@media (max-width: 768px) {
  .ds-container,
  .ds-container-narrow {
    padding: var(--space-lg) var(--space-md);
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }
  
  .btn, .ds-btn {
    padding: 0.675rem 1.25rem;
    font-size: 0.875rem;
  }
}

/* === Print Styles === */
@media print {
  .ds-header,
  .btn, .ds-btn,
  .ds-progress-steps {
    display: none;
  }
  
  body {
    background: white;
  }
  
  .card, .ds-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ======================================
   PATCH 2: Inline CTAs after major sections
   ====================================== */

.ia-shell .ia-inline-cta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ia-shell .ia-link-button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #b45309;
  cursor: pointer;
  text-decoration: underline;
  transition: color 150ms ease;
}

.ia-shell .ia-link-button:hover {
  color: #92400e;
}

/* ======================================
   PATCH 3: Expert tasks section emphasis
   ====================================== */

.ia-shell .ia-expert-tasks {
  border-left: 4px solid #f97316;
  padding-left: 1.25rem;
}

/* ======================================
   PATCH 5: Heading hierarchy & table improvements
   ====================================== */

.ia-shell h2 {
  font-weight: 700;
}

.ia-shell h3 {
  font-weight: 600;
}

.ia-shell h4 {
  font-weight: 600;
}

.ia-shell table thead th {
  background: #e5e7eb;
  color: #111827;
  font-weight: 600;
}

.ia-shell .ia-card,
.ia-shell .ia-section {
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .ia-shell .ia-inline-cta {
    font-size: 0.8rem;
  }
  
  .ia-shell .ia-expert-tasks {
    border-left-width: 3px;
    padding-left: 1rem;
  }
}

/* === Microcopy helpers (scoped to dashboard) === */
.ia-shell .ia-section-bullets {
  margin: 8px 0 16px;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: #4b5563;
}
.ia-shell .ia-section-bullets li + li {
  margin-top: 4px;
}
.ia-shell .ia-modal-subtitle {
  margin-top: 4px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #e5e7eb;
}
.ia-shell .ia-section-explainer {
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 8px;
}

/* Keyword chip blur for non-subscribers */
.ia-shell .ia-keyword-chip {
  transition: filter 180ms ease, opacity 180ms ease;
}
.ia-shell .ia-keyword-chip.ia-blurred {
  filter: blur(4px);
  opacity: 0.6;
  pointer-events: none;
}

/* Dev toggle button (visible only on dev hosts via JS) */
.ia-shell #ia-dev-sub-toggle {
  display: inline-block;
  background: #0f1724;
  color: #f8fafc;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

