/* Greenfield CSS Design System Variables (Synchronized with frontend/index.css) */
:root {
  --canvas-bg: #202124;         /* Google dark background grey */
  --surface-bg: #1f1f1f;        /* Google card/container background */
  --surface-nested-bg: #121212; /* Darker nested wells and inputs */
  --input-code-bg: #121212;
  --border-color: #3c4043;      /* Google Fonts dark divider lines */
  --glass-bg: #1f1f1f;
  --glass-border: #3c4043;
  --header-footer-bg: #1f1f1f;

  /* Typography */
  --text-primary: #ffffff;      /* High emphasis primary headers */
  --text-secondary: #e8eaed;    /* Medium emphasis secondary/body text */
  --text-muted: #bdc1c6;        /* Muted caption text */

  /* Accents */
  --burnt-copper: #b7410e;      /* Primary AIVisualize Brand Accent */
  --burnt-copper-hover: #d45d2a;
  --burnt-copper-active: #a03000;
  --burnt-copper-glow: rgba(183, 65, 14, 0.35);

  --sky-color: #38bdf8;
  --primary-accent: #38bdf8;

  --badge-pass: #10b981;
  --badge-pass-bg: rgba(16, 185, 129, 0.15);
  --badge-fail: #ef4444;
  --badge-fail-bg: rgba(239, 68, 68, 0.15);
  --badge-warn-bg: rgba(245, 158, 11, 0.15);
  --status-amber: #f59e0b;
  --accent-indigo: #6366f1;
}

html, body {
  min-height: 100vh;
  overflow-y: auto;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--canvas-bg);
  color: var(--text-secondary);
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
}

#visualize-app,
.cockpit-layout,
#app-viewport-wrapper,
.workspace-canvas,
#main-workspace-canvas {
  min-height: 100vh;
  overflow-y: auto;
}
.font-mono {
  font-family: 'JetBrains Mono', 'Space Mono', monospace;
}
.font-headline {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* 3D Elevated Slide-Out Drawer */
.drawer-3d-overlay {
  box-shadow: 25px 0 60px rgba(0, 0, 0, 0.95), 0 0 35px var(--burnt-copper-glow);
  border-right: 1px solid var(--border-color);
}

/* Stepper Accordion Pill Expansion */
.stepper-pill {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.stepper-pill .stepper-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-left 0.2s ease;
  margin-left: 0;
}
.stepper-pill:hover .stepper-label,
.stepper-pill.is-active .stepper-label,
.stepper-pill.is-scanning .stepper-label {
  max-width: 200px;
  opacity: 1;
  margin-left: 0.5rem;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--surface-nested-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #5f6368;
}

/* Native Executive Drawer Details */
details.executive-drawer summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.executive-drawer summary::-webkit-details-marker {
  display: none;
}

/* Glow Keyframes */
@keyframes copper-glow {
  0%, 100% { box-shadow: 0 0 15px rgba(183, 65, 14, 0.3), inset 0 0 8px rgba(183, 65, 14, 0.1); }
  50% { box-shadow: 0 0 25px rgba(212, 93, 42, 0.5), inset 0 0 14px rgba(212, 93, 42, 0.2); }
}
.animate-copper-glow {
  animation: copper-glow 2.5s infinite ease-in-out;
}

@keyframes indigo-glow {
  0%, 100% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.25); }
  50% { box-shadow: 0 0 25px rgba(129, 140, 248, 0.45); }
}
.animate-indigo-glow {
  animation: indigo-glow 2.5s infinite ease-in-out;
}

/* Stage 2 Adaptive Kanban Responsive Rules */
.kanban-grid-container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.kanban-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 640px) {
  .kanban-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .kanban-card-metrics {
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
  }
}
@media (min-width: 1024px) {
  body:not(.simulate-tablet) .kanban-grid-container {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
  }
  body:not(.simulate-tablet) .kanban-card {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: space-between !important;
  }
  body:not(.simulate-tablet) .kanban-card-metrics {
    border-left: none !important;
    padding-left: 0 !important;
    margin-top: 1.25rem !important;
    padding-top: 0.875rem !important;
    border-top: 1px solid var(--border-color) !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
}

/* Stage 4 Adaptive Entity Authority Responsive Rules */
.entity-grid-container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.entity-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
@media (min-width: 1024px) {
  body:not(.simulate-tablet) .entity-grid-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }
  body:not(.simulate-tablet) .entity-card {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* Stage 5 Adaptive Manifest Protocol Responsive Rules */
.manifest-grid-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}
.manifest-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start !important;
  gap: 0.875rem;
  width: 100%;
}
@media (min-width: 1024px) {
  body:not(.simulate-tablet) .manifest-grid-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
  }
  body:not(.simulate-tablet) .manifest-card {
    justify-content: flex-start !important;
  }
}

/* Full Simulator Mode Container Overrides */
body.simulate-tablet #canvas-body .grid.grid-cols-1.lg\:grid-cols-12 > div {
  grid-column: span 12 / span 12 !important;
}
body.simulate-tablet #canvas-body .lg\:grid-cols-5 {
  grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
}

/* Adaptive Recommended Shortcut Card Rules */
.shortcut-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}
.shortcut-card-body {
  width: 100%;
}
.shortcut-card-btn-container {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  padding-top: 0.25rem;
}
.shortcut-card-btn {
  width: 100%;
  text-align: center;
  justify-content: center;
}
@media (min-width: 640px) {
  .shortcut-card-btn {
    width: auto;
  }
}
@media (min-width: 1024px) {
  body:not(.simulate-tablet) .shortcut-card {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  body:not(.simulate-tablet) .shortcut-card-body {
    max-width: 48rem !important;
  }
  body:not(.simulate-tablet) .shortcut-card-btn-container {
    width: auto !important;
    padding-top: 0 !important;
    justify-content: flex-end !important;
  }
  body:not(.simulate-tablet) .shortcut-card-btn {
    width: auto !important;
  }
}
body.simulate-tablet .shortcut-card {
  flex-direction: column !important;
  align-items: flex-start !important;
}
body.simulate-tablet .shortcut-card-body {
  max-width: 100% !important;
  width: 100% !important;
}
body.simulate-tablet .shortcut-card-btn-container {
  width: 100% !important;
  padding-top: 0.5rem !important;
  justify-content: flex-start !important;
}
body.simulate-tablet .shortcut-card-btn {
  width: 100% !important;
  text-align: center !important;
  justify-content: center !important;
}

/* Universal Button Typography Enforcement */
button, a[role="button"], .shortcut-card-btn {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   Stage 4: Unified 5-Card Trust & E-E-A-T Design Tokens
   ========================================================================== */

.stage4-grid,
.stage4-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

@media (min-width: 1200px) {
  .stage4-grid,
  .stage4-cards-container {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Card Container Base */
.stage4-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface-card, #161b22);
  border: 1px solid var(--border-subtle, #30363d);
  border-radius: 12px;
  padding: 18px 16px;
  min-height: 380px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stage4-card:hover {
  border-color: var(--border-accent, #58a6ff);
}

/* Card Header & Compact Status Pills */
.stage4-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.stage4-card .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1;
  height: 20px;
  width: fit-content;
}

.stage4-card .status-pill.pill-confirmed,
.stage4-card .status-pill.pill-success {
  background: rgba(46, 160, 67, 0.15) !important;
  color: #3fb950 !important;
  border: 1px solid rgba(46, 160, 67, 0.35) !important;
}

.stage4-card .status-pill.pill-warning {
  background: rgba(210, 153, 34, 0.15) !important;
  color: #d29922 !important;
  border: 1px solid rgba(210, 153, 34, 0.35) !important;
}

.stage4-card .status-pill.pill-critical,
.stage4-card .status-pill.pill-danger {
  background: rgba(248, 81, 73, 0.15) !important;
  color: #f85149 !important;
  border: 1px solid rgba(248, 81, 73, 0.35) !important;
}

.security-icon,
.contact-icon,
.card-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Card Typography */
.stage4-card .card-title {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f0f6fc;
  margin: 6px 0 4px 0;
  line-height: 1.25;
}

/* Subtitle Highlight (Cyan tone matching Cards 1 & 2) */
.stage4-card .badge-highlight,
.stage4-card .card-subtitle {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #58a6ff;
  margin: 2px 0 10px 0;
  line-height: 1.3;
}

.stage4-card .badge-highlight.badge-warning {
  color: #d29922 !important;
}

.stage4-card .badge-highlight.badge-danger {
  color: #f85149 !important;
}

/* Subtle Chips Container */
.stage4-chip-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 10px 0;
}

/* Refined Entity Chips */
.stage4-card .chip-tag.entity-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.77rem;
  font-weight: 500;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #c9d1d9;
  word-break: break-word;
  transition: all 0.2s ease;
}

.stage4-card .chip-tag.entity-chip.chip-success {
  background: rgba(46, 160, 67, 0.08);
  border-color: rgba(46, 160, 67, 0.25);
  color: #3fb950;
}

.stage4-card .chip-tag.entity-chip.chip-warning {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
  color: #8b949e;
}

/* Action Links (matching Card 2 Author Guide Trigger) */
.stage4-card .action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: #58a6ff;
  text-decoration: none;
  margin-top: auto;
  padding-top: 8px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.stage4-card .action-link:hover {
  color: #79c0ff;
  text-decoration: underline;
}

/* Footer Compliance Copy */
.stage4-card .compliance-note,
.stage4-card .card-footer-note {
  font-family: inherit;
  font-size: 0.73rem;
  color: #8b949e;
  line-height: 1.35;
  margin-top: 8px;
}

/* ==========================================================================
   AI Optimize Pro Waitlist Modal Styling
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(10, 15, 29, 0.78);
  backdrop-filter: blur(8px);
  padding: 1.25rem;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 32rem;
  width: 100%;
  padding: 1.75rem;
  color: #f8fafc;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.badge-waitlist {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
}

.modal-pricing {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.modal-pricing .price-prefix {
  font-size: 0.95rem;
  font-weight: 500;
  color: #cbd5e1;
}

.modal-pricing .price-value {
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.modal-pricing .price-currency {
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
}

.modal-pricing .price-cadence {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
}

.modal-pricing .price-billing {
  font-size: 0.85rem;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 0.2rem;
}

.modal-subtitle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 1.25rem 0;
}

.modal-subtitle-lead {
  font-size: 0.885rem;
  line-height: 1.5;
  color: #e2e8f0;
  margin: 0;
}

.modal-subtitle-beta {
  font-size: 0.815rem;
  line-height: 1.45;
  color: #94a3b8;
  margin: 0;
}

.waitlist-banner {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.waitlist-banner.hidden {
  display: none !important;
}

.waitlist-banner.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.waitlist-banner.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.875rem;
}

.form-group label {
  font-size: 0.775rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  padding: 0.625rem 0.85rem;
  color: #ffffff;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: #38bdf8;
}

.stage5-cta-btn.btn-ai-optimize-pro,
.btn-waitlist-submit {
  width: 100%;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.025em;
  padding: 0.85rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.stage5-cta-btn.btn-ai-optimize-pro:hover:not(:disabled),
.btn-waitlist-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 50%, #4338ca 100%);
  box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.stage5-cta-btn.btn-ai-optimize-pro:active:not(:disabled),
.btn-waitlist-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px 0 rgba(37, 99, 235, 0.35);
}

.stage5-cta-btn.btn-ai-optimize-pro:disabled,
.btn-waitlist-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Cockpit Live Audit Error Banner (Gate 6 Compliance)
   ========================================================================== */
.audit-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.85rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.audit-error-banner.hidden {
  display: none !important;
}

.audit-error-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audit-error-icon {
  font-size: 1.15rem;
}

.btn-audit-retry {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #ffffff;
  padding: 0.4rem 0.85rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-audit-retry:hover {
  background: rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   Searchable Country Dropdown Component
   ========================================================================== */
.country-select-group {
  position: relative;
}

.country-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.country-input-wrapper input {
  width: 100%;
  padding-right: 2rem;
}

.country-dropdown-chevron {
  position: absolute;
  right: 0.85rem;
  font-size: 0.65rem;
  color: #94a3b8;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.country-dropdown-chevron.rotate-180 {
  transform: rotate(180deg);
}

.country-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10000;
  max-height: 14rem;
  overflow-y: auto;
  background: #0b1329;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  margin-top: 0.25rem;
}

.country-dropdown-menu.hidden {
  display: none !important;
}

.country-option {
  width: 100%;
  padding: 0.55rem 0.85rem;
  text-align: left;
  font-size: 0.825rem;
  color: #cbd5e1;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}

.country-option:hover,
.country-option:focus {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  outline: none;
}

.country-option.hidden {
  display: none !important;
}

.country-divider {
  padding: 0.25rem 0.85rem;
  font-size: 0.7rem;
  color: #475569;
  user-select: none;
  pointer-events: none;
}
