/* ================================
   APP DESIGN TOKENS (BRAND LAYER)
   --------------------------------
   For a new client/app, you mostly
   tweak the variables in this block.
   ================================ */

:root {
  /* Fonts */
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-script: "Parisienne", cursive;

  /* Core colors (tune per brand) */
  --color-page-from: #effcff;   /* light sky */
  --color-page-mid:  #d9f5f3;   /* seafoam */
  --color-page-to:   #f8f5ef;   /* warm sand */

  --color-text-main:   #0a3d5f; /* deep blue */
  --color-text-muted:  #6c8595;

  --color-primary:      #3ccfcf; /* main accent */
  --color-primary-deep: #2aa8a8;
  --color-primary-dark: #0a3d5f;

  --color-border-soft:  #cfe9ea;
  --color-card-bg:      #ffffff;

  --color-success-bg:   #d9f5f3;
  --color-success-border:#b6e7e1;
  --color-success-text: #07423f;

  --color-error-bg:     #fee2e2;
  --color-error-border: #fecaca;
  --color-error-text:   #7f1d1d;

  /* Radii */
  --radius-card: 28px;
  --radius-pill: 999px;
  --radius-input: 14px;

  /* Shadows */
  --shadow-soft: 0 18px 60px rgba(4, 61, 85, 0.18);
  --shadow-button: 0 14px 36px rgba(4, 61, 85, 0.35);
}

/* ================================
   BASE
   ================================ */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--color-text-main);
}

body {
  background: linear-gradient(
    135deg,
    var(--color-page-from),
    var(--color-page-mid),
    var(--color-page-to)
  );
}

/* Utility */
.hidden {
  display: none !important;
}

/* ================================
   LAYOUT: CENTERED SPLIT (AUTH)
   ================================ */

.layout-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.layout-auth-inner {
  max-width: 980px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 40px;
  align-items: center;
}

@media (max-width: 768px) {
  .layout-auth-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ================================
   HERO / BRAND COPY
   ================================ */

.hero-block {
  padding-right: 8px;
}

.hero-kicker {
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary-deep);
  font-weight: 600;
  margin-bottom: 12px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.2;
  margin: 0 0 16px;
  color: var(--color-text-main);
}

.hero-title-accent {
  font-family: var(--font-script);
  font-size: 30px;
  color: var(--color-primary);
  display: block;
  margin-top: 4px;
}

.hero-body {
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text-muted);
  max-width: 440px;
}

.hero-note {
  margin-top: 18px;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ================================
   GENERIC CARD
   ================================ */

.card {
  background: linear-gradient(145deg, #ffffff, #f6fdff);
  border-radius: var(--radius-card);
  padding: 26px 26px 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(207, 233, 234, 0.9);
}

/* CARD HEADER / LOGO ROW */

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}

.card-logo-circle {
  height: 46px;
  width: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, var(--color-primary), var(--color-primary-dark));
  margin-right: 12px;
}

.card-logo-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--color-text-main);
}

.card-logo-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}

/* ================================
   FORM CONTROLS
   ================================ */

.field-label {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border-soft);
  font-size: 15px;
  outline: none;
  background: #ffffff;
  color: var(--color-text-main);
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(60, 207, 207, 0.2);
}

/* ================================
   BUTTONS
   ================================ */

.btn-primary {
  display: inline-block;
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-deep));
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn-primary:hover {
  opacity: 0.96;
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(4, 61, 85, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 10px 28px rgba(4, 61, 85, 0.3);
}

/* Optional secondary button */

.btn-secondary {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-soft);
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text-main);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* ================================
   STATUS MESSAGES
   ================================ */

.message {
  margin-top: 16px;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 12px;
}

.message-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.message-error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error-text);
}

/* ================================
   CHAT LAYOUT
   ================================ */

.chat-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    135deg,
    var(--color-page-from),
    var(--color-page-mid),
    var(--color-page-to)
  );
}

.chat-shell {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.chat-header-title {
  font-family: var(--font-display);
  font-size: 22px;
}

.chat-header-sub {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Scroll area */
.chat-main {
  flex: 1 1 auto;
  min-height: 320px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px 4px 12px 0;
}

/* ================================
   CHAT BUBBLES
   ================================ */

.chat-bubble {
  max-width: 640px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  margin-bottom: 10px;
}

.chat-bubble-user {
  margin-left: auto;
  border-radius: 18px 18px 4px 18px;
  background: var(--color-page-mid);
}

.chat-bubble-assistant {
  margin-right: auto;
  border-radius: 18px 18px 18px 4px;
  background: #ffffff;
  border: 1px solid var(--color-border-soft);
}

.chat-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ================================
   CHAT INPUT
   ================================ */

.chat-input-row {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1 1 auto;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border-soft);
  resize: vertical;
  font-size: 14px;
}

.chat-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(60, 207, 207, 0.2);
}

.chat-send-btn {
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-deep));
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ================================
   APP SHELL + HEADER
   ================================ */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 16px;
}

.app-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  height: 40px;
  width: 40px;
  border-radius: 999px;
  background: radial-gradient(
    circle at 30% 20%,
    var(--color-primary),
    var(--color-primary-dark)
  );
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--color-text-main);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-main {
  flex: 1 1 auto;
  display: flex;
}

.app-main-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ================================
   BUTTONS (generic + ghost)
   ================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--color-text-main);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(207, 233, 234, 0.9);
  color: var(--color-text-main);
}

.btn-ghost:hover {
  background: #f8fafc;
}

/* Reuse .btn-primary from earlier for main CTAs on dashboard
   (already defined; no extra CSS needed here) */

/* ================================
   BADGES & HELPER TEXT
   ================================ */

.badge-soft {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
}

.badge-soft-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.badge-soft-danger {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error-text);
}

.helper-text {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ================================
   RECENT SESSIONS LIST
   ================================ */

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.session-title {
  font-size: 15px;
  line-height: 1.45;
  color: var(--color-text-main);
  font-weight: 500;
}

.session-meta {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.session-actions {
  flex-shrink: 0;
}

.sessions-empty {
  margin-top: 0;
}

.sessions-error {
  margin-top: 8px;
  color: var(--color-error-text);
}

/* ================================
   PASS BANNER
   ================================ */

.pass-banner {
  margin-top: 14px;
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pass-banner .pass-text {
  white-space: normal;
}

/* ================================
   MOBILE TWEAKS
   ================================ */

@media (max-width: 640px) {
  .app-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .app-main-inner {
    padding: 18px 10px 32px;
  }

  .session-row {
    padding: 14px 0;
    flex-direction: column;
    gap: 6px;
  }

  .session-actions {
    width: 100%;
  }

  .session-actions .btn {
    width: 100%;
    justify-content: center;
    border-radius: 10px;
    border-color: var(--color-border-soft);
    background: #f8fafc;
  }

  .session-actions .btn:hover {
    background: #f1f5f9;
  }
}

/* ================================
   SESSION PAGE LAYOUT
   ================================ */

.session-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  font-size: 16px;
}

.session-header {
  margin-bottom: 22px;
}

.session-header h1 {
  font-size: 30px;
  margin-bottom: 8px;
  color: var(--color-text-main);
}

.session-header p {
  font-size: 16px;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

/* “How this works” box */

.session-how {
  margin-bottom: 28px;
  padding: 20px 22px;
  border-radius: var(--radius-xl);
  background: #f8fafc;
  border: 1px solid var(--color-border-soft);
  font-size: 16px;
  color: var(--color-text-main);
  line-height: 1.6;
}

.session-how h2 {
  font-size: 20px;
  margin: 0 0 10px;
  color: var(--color-text-main);
  font-weight: 700;
}

.session-how p {
  margin: 0 0 14px;
}

.session-how ul {
  margin: 0 0 6px 22px;
  padding: 0;
}

.session-how li {
  margin-bottom: 8px;
}

/* ================================
   SESSION CONVERSATION CARD
   ================================ */

.session-card {
  margin-top: 12px;
  border-radius: var(--radius-xl);
  background: #ffffff;
  border: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-card);
  overflow: visible;
  display: block;
}

.session-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 15px;
  background: linear-gradient(90deg, #f9fafb, #eff6ff);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
}

.session-card-header strong {
  font-weight: 600;
  color: var(--color-text-main);
}

/* ================================
   CHAT LOG
   ================================ */

.conversation-wrapper {
  display: flex;
  flex-direction: column;
}

.chat-log-container {
  padding: 16px 18px 10px;
  background: linear-gradient(#f9fafb, #eff6ff);
  overflow-y: auto;
  max-height: 60vh;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty {
  font-size: 15px;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px dashed #cbd5f5;
}

.chat-row {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-row-user {
  align-self: flex-end;
  text-align: right;
}

.chat-row-assistant {
  align-self: flex-start;
  text-align: left;
}

.chat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.chat-row-user .chat-label {
  align-self: flex-end;
}

.chat-row-assistant .chat-label {
  align-self: flex-start;
}

.chat-bubble {
  border-radius: 18px;
  padding: 12px 14px;
  font-size: 17px;
  line-height: 1.65;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-row-user .chat-bubble {
  background: var(--color-primary);
  color: #f9fafb;
  border-bottom-right-radius: 4px;
}

.chat-row-assistant .chat-bubble {
  background: #ffffff;
  color: #111827;
  border: 1px solid #dbeafe;
  border-bottom-left-radius: 4px;
}

/* ================================
   COMPOSER
   ================================ */

.composer {
  border-top: 1px solid var(--color-border-soft);
  background: #ffffff;
  padding: 16px 16px 14px;
}

.composer label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--color-text-main);
}

.composer textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  font-size: 18px;
  line-height: 1.6;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.composer textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.25);
}

.composer-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.tip-text {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.tip-text strong {
  font-weight: 600;
}

.error-text {
  font-size: 13px;
  color: var(--color-error-text);
  margin-top: 6px;
}

/* Spinner used inside primary button */

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
}

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

/* Disclaimer + footer tip */

.session-disclaimer {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 12px;
  line-height: 1.45;
}

.session-disclaimer strong {
  font-weight: 600;
}

.session-footer-tip {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ================================
   MOBILE TWEAKS
   ================================ */

@media (max-width: 640px) {
  .session-page {
    padding: 16px 10px 24px;
    font-size: 15px;
  }

  .session-header h1 {
    font-size: 24px;
  }

  .session-how {
    padding: 16px;
    font-size: 15px;
  }

  .chat-row {
    max-width: 100%;
  }

  .composer-footer {
    align-items: flex-start;
  }

  .composer-footer .btn-primary {
    align-self: flex-end;
  }
}
