/* ========================================
   ADRIMA DEMO — ZERO DISTRACTION
   Premium, Calm, Focused.
   ======================================== */

:root {
  /* --- Surfaces --- */
  --bg-app:       #0a0e18;
  --bg-app-deep:  #070b15;
  --surface-1:    #101827;
  --surface-2:    #121c2f;
  --bg-panel:     rgba(255, 255, 255, 0.04);
  --bg-panel-hi:  rgba(123, 147, 232, 0.12);
  --bg-bubble-ai: rgba(255, 255, 255, 0.045);
  --bg-bubble-me: rgba(123, 147, 232, 0.14);
  
  /* --- Borders --- */
  --border:       rgba(200, 215, 255, 0.12);
  --border-softer: rgba(200, 215, 255, 0.08);
  --border-lit:   rgba(200, 215, 255, 0.22);
  
  /* --- Text --- */
  --text-main:    #eaeff8;
  --text-muted:   #9ba8c4;
  --text-faint:   #6b7a96;
  --accent:       #7b93e8;
  --accent-text:  #a8c2ff;
  --accent-glow:  rgba(123, 147, 232, 0.35);
  
  /* --- Restored Premium Metrics --- */
  --max-w:        1240px;
  --nav-h:        68px;
  --bar-h:        74px;
  --radius:       16px;
  --radius-sm:    12px;
  --font-sans:    'Inter', sans-serif;
  --font-mono:    'Space Grotesk', monospace;
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: linear-gradient(180deg, var(--bg-app) 0%, var(--bg-app-deep) 100%);
  color: var(--text-main);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, rgba(123, 147, 232, 0.08) 0%, rgba(123, 147, 232, 0) 32%),
    linear-gradient(280deg, rgba(92, 200, 196, 0.07) 0%, rgba(92, 200, 196, 0) 34%);
}

button {
  cursor: pointer; border: none; background: none; color: inherit; font: inherit;
  transition: all 0.2s ease;
}
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========================================
   NAVBAR (Minimal)
   ======================================== */
.demo-nav {
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(10, 14, 24, 0.92);
  backdrop-filter: blur(14px);
  z-index: 50;
  flex-shrink: 0;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

.nav-left, .nav-right { display: flex; align-items: center; flex: 1; }
.nav-right { justify-content: flex-end; gap: 24px; }
.nav-center { flex: 0 0 auto; }

.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--text-main);
  text-decoration: none;
}
.nav-logo-icon { width: 24px; height: 24px; color: var(--accent); }

.step-indicator {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-muted);
  font-feature-settings: "tnum";
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-radius: 100px;
  border: 1px solid var(--border-softer);
}

.nav-link-subtle {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}
.nav-link-subtle:hover { color: var(--text-main); }

.nav-btn-primary {
  background: linear-gradient(180deg, #829aef 0%, #728adf 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(173, 189, 255, 0.3);
  box-shadow: 0 8px 22px rgba(88, 124, 220, 0.28);
}
.nav-btn-primary:hover { background: linear-gradient(180deg, #8ea4f4 0%, #7b93e8 100%); transform: translateY(-1px); }


/* ========================================
   MAIN CONTENT
   ======================================== */
.demo-main {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(var(--bar-h) + 20px);
}

.demo-main::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: var(--nav-h);
  height: 180px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
}

.demo-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.demo-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  min-height: 0; /* Important for flex-child scroll/height */
}

/* Step Frame (Title + Context) */
.demo-step-frame {
  padding: 34px 0 18px; 
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}
.step-title {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 2.9vw, 2.2rem); 
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  line-height: 1.08;
}
.step-why {
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Container & Grid */
.demo-container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 30px;
  align-items: start;
  height: 100%;
}

/* ========================================
   CHAT UI
   ======================================== */
.demo-col-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-window {
  flex: 1;
  min-height: 0;
  height: min(620px, calc(100vh - var(--nav-h) - var(--bar-h) - 200px));
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 215, 255, 0.28) transparent;
}

.chat-window::-webkit-scrollbar {
  width: 7px;
}

.chat-window::-webkit-scrollbar-thumb {
  background: rgba(200, 215, 255, 0.28);
  border-radius: 999px;
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 14px; 
  padding-bottom: 10px;
}

.chat-group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.chat-group.user { flex-direction: row-reverse; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(123, 147, 232, 0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(7, 14, 28, 0.3);
}
.avatar.ai { background: linear-gradient(160deg, rgba(123, 147, 232, 0.28), rgba(123, 147, 232, 0.08)); color: var(--accent-text); }
.avatar.user { display: none; }

.msg-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 90%;
}
.chat-group.user .msg-stack { align-items: flex-end; }

.msg-bubble {
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.56;
  color: var(--text-main);
  position: relative;
  border: 1px solid var(--border-softer);
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 18px rgba(5, 10, 21, 0.18);
}
.ai .msg-bubble {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-top-left-radius: 6px;
}
.user .msg-bubble {
  background: linear-gradient(180deg, rgba(123, 147, 232, 0.2), rgba(123, 147, 232, 0.12));
  border-top-right-radius: 6px;
  color: var(--text-main);
}


/* ========================================
   ARTIFACT UI
   ======================================== */
.demo-col-artifact {
  position: sticky;
  top: 10px;
  align-self: start;
}

.artifact-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 38px rgba(4, 8, 17, 0.35);
  max-height: 100%;
}

.artifact-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.artifact-head { padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.artifact-head h3 {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  color: var(--text-main);
  margin-bottom: 6px;
  font-weight: 600;
}
.artifact-p { font-size: 0.88rem; color: var(--text-muted); }

.grid-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box {
  background: var(--bg-panel);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-softer);
}
.stat-label { font-size: 11px; color: var(--text-faint); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-val { font-size: 1.25rem; font-weight: 600; font-family: var(--font-mono); letter-spacing: -0.02em; }
.stat-val.bad { color: #EF4444; }
.stat-val.good { color: #10B981; }

.alloc-bar { height: 28px; border-radius: 8px; display: flex; overflow: hidden; margin-top: 8px; }
.seg { height: 100%; }


/* ========================================
   BOTTOM BAR (Sticky)
   ======================================== */
.demo-bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bar-h);
  background: rgba(10, 14, 24, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bottom-bar-inner {
  width: 100%;
  max-width: var(--max-w);
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.btn-back { justify-self: start; }
.btn-outline { justify-self: center; }
.btn-next { justify-self: end; }


.btn-control {
  height: 46px;
  min-width: 112px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.btn-back {
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.btn-back:disabled { opacity: 0.3; cursor: default; }
.btn-back:not(:disabled):hover { color: var(--text-main); border-color: var(--border-lit); }

.btn-outline {
  font-size: 0.84rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-weight: 600;
}
.btn-outline:hover { color: var(--text-main); }

.btn-next {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
  width: fit-content;
  border: 1px solid var(--border);
  box-shadow: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --auto-progress: 0%;
}
.btn-next:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-lit);
}

.btn-next::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--auto-progress);
  background: linear-gradient(90deg, rgba(123, 147, 232, 0.5), rgba(123, 147, 232, 0.32));
  z-index: 0;
}

.btn-next-label {
  position: relative;
  z-index: 1;
}


/* ========================================
   MODALS
   ======================================== */
.modal-dialog {
  padding: 0; border: none; background: transparent;
  width: 100vw; height: 100vh;
  max-width: 100vw; max-height: 100vh;
}
.modal-dialog::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); }

.modal-panel {
  position: absolute; 
  background: #101522;
  border: 1px solid var(--border-lit);
  border-radius: 18px;
  box-shadow: 0 36px 72px rgba(4, 7, 14, 0.56);
  overflow: hidden;
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn { 
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); } 
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); } 
}

/* Outline Modal */
.outline-panel {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  padding: 32px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-head h2 { font-size: 1.2rem; font-family: var(--font-mono); color: var(--text-main); }
.btn-close { font-size: 1.5rem; color: var(--text-muted); line-height: 1; padding: 4px; }

.outline-list button {
  width: 100%; text-align: left; padding: 14px 16px;
  border-radius: 12px; color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
}
.outline-list button:hover { background: var(--bg-panel); color: var(--text-main); }
.outline-list button.active { color: var(--accent-text); background: var(--bg-panel-hi); }

/* Waitlist Modal */
.waitlist-panel {
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100%; max-width: 440px;
  padding: 40px;
  text-align: center;
}
.waitlist-panel h2 { font-family: var(--font-mono); font-size: 1.32rem; margin-bottom: 12px; }
.waitlist-panel p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; font-size: 0.92rem; }

.waitlist-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: white;
  margin-bottom: 16px;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.waitlist-input:focus { outline: none; border-color: var(--accent); }

.waitlist-btn {
  width: 100%;
  background: linear-gradient(180deg, #829aef 0%, #728adf 100%);
  color: white;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(173, 189, 255, 0.3);
  font-weight: 600;
  font-size: 1rem;
}
.waitlist-btn:hover { background: linear-gradient(180deg, #8ea4f4 0%, #7b93e8 100%); }
.success-check {
  width: 64px; height: 64px; background: linear-gradient(180deg, #829aef 0%, #728adf 100%); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 24px;
}

/* ========================================
   MOBILE
   ======================================== */
@media (max-width: 768px) {
  :root {
    --nav-h: 62px;
    --bar-h: 70px;
  }

  body {
    height: auto;
    min-height: 100svh;
    overflow: auto;
  }

  .demo-main {
    overflow: visible;
    padding-bottom: calc(var(--bar-h) + 14px);
  }

  .demo-nav { padding: 0 14px; }
  .nav-center, .nav-link-subtle { display: none; } 
  .nav-btn-primary { padding: 9px 14px; font-size: 0.82rem; }
  .demo-nav {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--nav-h) + env(safe-area-inset-top));
  }
  
  .demo-grid { grid-template-columns: 1fr; gap: 20px; display: flex; flex-direction: column; padding: 0 14px; }
  
  /* Stack order: StepFrame -> Chat -> Artifact */
  .demo-step-frame { padding: 18px 14px 10px; }
  .step-title { font-size: 1.44rem; }
  .step-why { font-size: 0.9rem; }
  
  .demo-col-chat { border: none; background: transparent; padding-bottom: 0; }
  .chat-window {
    height: clamp(320px, 44vh, 520px);
    padding: 0;
  }
  
  .demo-col-artifact { position: relative; top: 0; padding: 0 0 6px; }
  .artifact-card { box-shadow: none; border: 1px solid var(--border-softer); }
  
  .demo-bottom-bar { 
    height: calc(var(--bar-h) + env(safe-area-inset-bottom)); 
    background: rgba(10, 14, 24, 0.96);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-bar-inner {
    padding: 0 12px;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .btn-control {
    min-width: 0;
    width: 100%;
    font-size: 0.86rem;
    height: 48px;
  }
  .btn-outline { display: none; }
  .btn-next,
  .btn-back {
    justify-self: stretch;
  }
  .waitlist-input {
    font-size: 16px;
  }
}
