/* ============================================================
   FLOWIE ROI CALCULATOR — Design System v3
   Aligned with flowie-website/src/app/globals.css (May 2026)
   Brand Blue + Gold + Beige · Geist Sans
   ============================================================ */

:root {
  /* ─── Brand colors ─── */
  --brand-blue: #222878;
  --brand-blue-dark: #1a1f5e;
  --brand-blue-light: #4a52a8;
  --gold: #F2D599;
  --gold-dark: #b8922e;

  /* ─── Beige scale ─── */
  --beige-light: #F4F1EE;
  --beige-medium: #EAE6E1;
  --beige-dark: #DDD6CD;
  --muted: #5F6672;

  /* ─── Dark gradient (footer / CTA) ─── */
  --gradient-start: #0d1033;
  --gradient-mid: #141a4f;
  --gradient-end: #0f1340;

  /* ─── Semantic ─── */
  --success: #008236;
  --success-light: #F0FDF4;
  --error: #DC2626;
  --white: #FFFFFF;

  /* ─── Aliases (preserve app.js class names) ─── */
  --primary: var(--brand-blue);
  --primary-dark: var(--brand-blue-dark);
  --primary-light: var(--brand-blue-light);
  --secondary: var(--success);
  --secondary-dark: #006626;
  --accent: var(--gold);
  --dark: var(--brand-blue);
  --gray-700: var(--brand-blue);
  --gray-600: var(--muted);
  --gray-500: var(--muted);
  --gray-400: var(--beige-dark);
  --gray-300: var(--beige-medium);
  --gray-200: var(--beige-medium);
  --gray-100: var(--beige-light);
  --gray-50: var(--beige-light);

  /* ─── Shadows (Flowie aesthetic) ─── */
  --shadow-xs: 0 1px 2px 0 rgb(34 40 120 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(34 40 120 / 0.06), 0 1px 2px -1px rgb(34 40 120 / 0.04);
  --shadow:    0 4px 12px -2px rgb(34 40 120 / 0.08), 0 2px 4px -2px rgb(34 40 120 / 0.04);
  --shadow-md: 0 8px 20px -4px rgb(34 40 120 / 0.10), 0 4px 8px -4px rgb(34 40 120 / 0.06);
  --shadow-lg: 0 16px 32px -8px rgb(34 40 120 / 0.12), 0 8px 16px -6px rgb(34 40 120 / 0.08);

  /* ─── Radius ─── */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* ─── Container (Ramp-style, max-w-page) ─── */
  --container-max: 1536px;

  /* ─── Animation ─── */
  --duration-fast: 150ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

/* ============================================================
   RESET + BASE
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Geist', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--white);
  color: var(--brand-blue);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

::selection {
  background: var(--gold);
  color: var(--brand-blue);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================================
   CONTAINER
   ============================================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .container { padding: 0 24px; }
}

@media (min-width: 1024px) {
  .container { padding: 0 64px; }
}

/* ============================================================
   NAVBAR (matches flowie-website Navbar visual)
   ============================================================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--beige-dark);
}

.navbar-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 16px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

@media (min-width: 640px) { .navbar-inner { padding: 0 24px; } }
@media (min-width: 1024px) { .navbar-inner { padding: 0 64px; } }

.navbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity var(--duration-base) var(--ease-out);
}

.navbar-logo:hover { opacity: 0.7; }

.navbar-logo img { height: 28px; width: auto; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--brand-blue);
  padding: 8px 12px;
  border-radius: 8px;
  transition: background var(--duration-base) var(--ease-out);
}

.navbar-link:hover {
  background: var(--beige-light);
}

@media (max-width: 768px) {
  .navbar-link { display: none; }
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  background: var(--beige-light);
  border-radius: 8px;
  padding: 3px;
}

.lang-toggle button {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 6px;
  transition: all var(--duration-fast) var(--ease-out);
}

.lang-toggle button.active {
  background: var(--brand-blue);
  color: var(--white);
}

/* ============================================================
   BUTTONS (matches flowie-website Button.tsx variants)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 10px;
  min-height: 36px;
}

.btn:not(.btn-sm):not(.btn-lg) {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 12px;
  min-height: 44px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  border-radius: 12px;
  min-height: 52px;
}

.btn-primary {
  background: var(--gold);
  color: var(--brand-blue);
}
.btn-primary:hover {
  background: #efc97e;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--brand-blue);
  color: var(--white);
}
.btn-secondary:hover {
  background: var(--brand-blue-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--brand-blue);
}
.btn-ghost:hover {
  background: var(--brand-blue);
  color: var(--white);
}

.btn-outline-dark {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.25);
}
.btn-outline-dark:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-block { width: 100%; }

.btn .badge {
  background: rgba(34, 40, 120, 0.12);
  color: var(--brand-blue);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}
.btn-secondary .badge {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

/* ============================================================
   PAGE HEADER (kicker + h1 + subtitle, like flowie-website)
   ============================================================ */

.page-header {
  background: var(--beige-light);
  padding: 64px 0 56px;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px;
  opacity: 0.025;
  pointer-events: none;
}

@media (min-width: 768px) {
  .page-header { padding: 96px 0 80px; }
}

.kicker {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 20px;
}

.kicker-sm {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.kicker-light {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--brand-blue);
  max-width: 24ch;
  margin-bottom: 20px;
}

.page-header h1 .text-muted {
  color: var(--muted);
  font-weight: 500;
}

.subtitle {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
  max-width: 56ch;
  font-weight: 400;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  padding: 56px 16px;
}

@media (min-width: 640px) { .main-content { padding: 56px 24px; } }
@media (min-width: 1024px) { .main-content { padding: 64px 64px; } }

.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .main-layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 32px;
    align-items: start;
  }
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.right-panel {
  position: sticky;
  top: 88px;
}

@media (max-width: 1023px) {
  .right-panel { position: relative; top: 0; }
}

/* ============================================================
   CARDS (matches flowie-website Card.tsx)
   ============================================================ */

.card {
  background: var(--white);
  border: 1px solid rgba(221, 214, 205, 0.5); /* beige-dark / 50 */
  border-radius: 16px;
  overflow: hidden;
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}

.card:hover {
  border-color: rgba(242, 213, 153, 0.5); /* gold / 50 */
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 24px 24px 0;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 0 24px 24px;
  border-top: 1px solid rgba(221, 214, 205, 0.3);
  padding-top: 16px;
  margin-top: 8px;
}

@media (min-width: 768px) {
  .card-header { padding: 32px 32px 0; }
  .card-body { padding: 32px; }
  .card-footer { padding: 16px 32px 32px; }
}

/* ============================================================
   ROI SUMMARY (the big sticky-ish card on the left)
   ============================================================ */

.roi-summary-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-blue);
  line-height: 1.2;
}

.roi-total {
  text-align: center;
  padding: 16px 0 24px;
}

.roi-total-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.roi-total-value {
  font-family: 'Geist', sans-serif;
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--brand-blue);
  line-height: 1.05;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}

.roi-total-sublabel {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.roi-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
  padding-top: 24px;
  border-top: 1px solid var(--beige-medium);
}

.roi-breakdown-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.roi-breakdown-icon {
  font-size: 18px;
}

.roi-breakdown-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roi-breakdown-name {
  font-weight: 500;
  color: var(--brand-blue);
  font-size: 13px;
}

.roi-breakdown-bar {
  background: var(--beige-medium);
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
}

.roi-breakdown-bar-fill {
  height: 100%;
  background: var(--brand-blue);
  border-radius: 999px;
  transition: width 400ms var(--ease-out);
}

.roi-breakdown-value {
  font-weight: 700;
  color: var(--success);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.roi-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.roi-metric {
  background: var(--beige-light);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

.roi-metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.roi-metric-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

/* ============================================================
   MODULE CARDS (each module = expandable card)
   ============================================================ */

.modules-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-card {
  background: var(--white);
  border: 1px solid rgba(221, 214, 205, 0.5);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}

.module-card:hover {
  border-color: rgba(242, 213, 153, 0.5);
  box-shadow: var(--shadow-md);
}

.module-card.expanded {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-md);
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer;
  transition: background var(--duration-base);
  gap: 12px;
}

.module-header:hover {
  background: var(--beige-light);
}

.module-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.module-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--beige-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--brand-blue);
  letter-spacing: -0.005em;
}

.module-description {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.module-savings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.module-savings-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.module-toggle {
  color: var(--muted);
  transition: transform var(--duration-base);
  font-size: 12px;
  width: 24px;
  text-align: center;
}

.module-card.expanded .module-toggle {
  transform: rotate(180deg);
}

.module-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--beige-medium);
}

.module-card.expanded .module-body {
  display: block;
}

/* ============================================================
   FORM FIELDS (matches flowie-website Input.tsx)
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-blue);
}

.form-input,
.form-select {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--brand-blue);
  background: var(--white);
  border: 1px solid var(--beige-dark);
  border-radius: 10px;
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}

.form-input::placeholder { color: var(--muted); }

.form-input:hover,
.form-select:hover {
  border-color: var(--brand-blue-light);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(34, 40, 120, 0.12);
}

/* ============================================================
   AGENT PANEL (right-side AI chat)
   ============================================================ */

.agent-panel {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  min-height: 480px;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--beige-medium);
  background: var(--beige-light);
}

.agent-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-blue);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-title-line {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-blue);
  line-height: 1.2;
}

.agent-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.agent-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agent-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.agent-message.user {
  align-self: flex-end;
  background: var(--brand-blue);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.agent-message.assistant {
  align-self: flex-start;
  background: var(--beige-light);
  color: var(--brand-blue);
  border-bottom-left-radius: 4px;
}

.agent-input-area {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--beige-medium);
  background: var(--white);
}

.agent-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--brand-blue);
  background: var(--beige-light);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all var(--duration-base);
}

.agent-input::placeholder { color: var(--muted); }

.agent-input:focus {
  outline: none;
  background: var(--white);
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(34, 40, 120, 0.12);
}

.agent-send {
  padding: 10px 14px;
  min-height: 0;
  border-radius: 10px;
}

/* ============================================================
   CTA BANNER (above footer, gold-on-dark)
   ============================================================ */

.cta-banner {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
  color: var(--white);
  padding: 64px 0;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
}

@media (min-width: 768px) {
  .cta-banner { padding: 96px 0; }
}

.cta-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
}

@media (min-width: 768px) {
  .cta-inner {
    grid-template-columns: 1fr auto;
    gap: 48px;
  }
}

.cta-banner h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.cta-banner p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  max-width: 56ch;
}

.cta-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================================
   FOOTER (matches flowie-website Footer.tsx visual)
   ============================================================ */

.footer {
  background: #0d1033;
  color: var(--white);
  padding: 64px 0 32px;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 26, 79, 0.3) 0%, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
  pointer-events: none;
}

.footer .container {
  position: relative;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 32px;
  }
}

.footer-brand img { margin-bottom: 16px; }

.footer-tagline {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.6;
  max-width: 32ch;
}

.footer-col {
  display: flex;
  flex-direction: column;
}

.footer-col-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 16px;
}

.footer-col a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 0;
  transition: color var(--duration-base);
}

.footer-col a:hover {
  color: var(--gold);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 32px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   ACCESSIBILITY + RESPONSIVE
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  border-radius: 4px;
}
