/* =====================================================
   deOCDfai – App Shell (FINAL STABLE)
   Mobile-safe, no redesign
===================================================== */

/* ---------- Root Theme ---------- */
:root {
  --bg-main: #f9fafb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #2563eb;
}
/* ---------- Dark Theme ---------- */
html[data-theme="dark"] {
  --bg-main: #0f172a;        /* slate-900 */
  --bg-card: #020617;       /* slate-950 */
  --border: #1e293b;        /* slate-800 */
  --text-main: #e5e7eb;     /* slate-200 */
  --text-muted: #94a3b8;    /* slate-400 */
  --accent: #60a5fa;        /* blue-400 */
}
/* ---------- Global Reset ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden; /* allow iOS resize */
}

html {
  font-size: 17px;   /* ⬅️ sets global scale */
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 16px;   /* ⬅️ was implicit & smaller */
  line-height: 1.6; /* ⬅️ improves readability everywhere */
}

/* ---------- App Shell ---------- */
.app-shell {
  min-height: 100svh; /* iOS-safe viewport */
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.account-wrapper {
  position: relative;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Logo */
.app-logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-main {
  font-weight: 700;
  font-size: 15px;
}

.logo-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* Header buttons */
.icon-btn {
  background: none;
  border: none;
  font-size: 24px;     /* ⬅️ was 20px */
  cursor: pointer;
  color: var(--text-main);
  padding: 6px;        /* ⬅️ better tap target */
}

/* ---------- Side Menus ---------- */
.side-menu {
  position: fixed;
  top: 60px;
  left: 0;
  width: 240px;
  height: calc(100svh - 60px);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 900;
}

.side-menu.right {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border);
  transform: translateX(100%);
}

.side-menu.open {
  transform: translateX(0);
}

.menu-list {
  list-style: none;
  padding: 16px;
  margin: 0;
}

.menu-list li {
  margin-bottom: 12px;
}

.menu-list a {
  text-decoration: none;
  color: var(--text-main);
  font-size: 16px;
}

.menu-list a:hover {
  color: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

/* ---------- Main Tool Area ---------- */
.tool-area {
  max-width: 640px;
  margin: 0 auto;
  padding: 96px 20px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* chat mode default */
}

/* ---------- Intro ---------- */
.context-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}

.context-emphasis {
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Prompt ---------- */
.tool-title {
  font-size: 26px;
  font-weight: 700;
}

/* ---------- Inputs ---------- */
textarea {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  resize: none;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-primary {
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

/* =====================================================
   CHAT UI
===================================================== */

#chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Only messages scroll */
.chat-area {
  flex: 1;
  margin-top: 4px;
  margin-bottom: 6px;
  overflow-y: auto;
  padding: 8px 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

/* Chat bubbles */
.chat-bubble {
  max-width: 82%;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 17px;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-user {
  align-self: flex-end;
  background: #e5e7eb;
}

.chat-ai {
  align-self: flex-start;
  background: #eff6ff;
}

/* Label */
.chat-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ---------- Input Bar (iOS SAFE) ---------- */
.chat-input-bar {
  padding-top: 8px;
  margin-top: -6px;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}

/* =====================================================
   AI Typing Indicator (SAFE)
===================================================== */

.chat-bubble.typing {
  background: #eff6ff;
}

.chat-content.typing {
  display: flex;
  gap: 6px;
}

.chat-content.typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: dotBlink 1.4s infinite both;
}

.chat-content.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-content.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBlink {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .tool-title {
    font-size: 22px;
  }

  .chat-bubble {
    max-width: 95%;
  }
}

/* =====================================================
   AUTH FORMS (Login / Register / Forgot)
===================================================== */

.form-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-card label {
  font-size: 14px;
  font-weight: 500;
}

.form-card input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.form-card input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-card .btn-primary {
  width: fit-content;
  padding: 12px 18px;
  border-radius: 12px;
}

.form-error {
  max-width: 420px;
  margin: 0 auto 16px;
  background: #fef2f2;
  color: #991b1b;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.form-hint {
  font-size: 15px;
  color: var(--text-muted);
}

.form-hint a {
  color: var(--accent);
  text-decoration: none;
}

.form-hint a:hover {
  text-decoration: underline;
}

/* =====================================================
   CONTENT PAGES (Dashboard, Blog, Legal)
===================================================== */

body.content-page {
  overflow: auto;
}

body.content-page .app-shell {
  height: auto;
  min-height: 100vh;
}

body.content-page .tool-area {
  overflow: visible;
  padding-bottom: 40px;
}
/* ==========================================
   LANDING PAGE SPACING FIX
   (Textarea + Start button)
========================================== */

.tool-area textarea + .btn-primary {
  margin-top: 12px;
}
/* =====================================================
   DASHBOARD UI (Cards, Stats, Lists)
===================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-top: 18px;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16px;
}

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

/* ---------- Stats Grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.stat-card strong {
  font-size: 20px;
  display: block;
}

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

/* ---------- Sessions List ---------- */
.session-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.session-item:last-child {
  border-bottom: none;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.link:hover {
  text-decoration: underline;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
/* =====================================================
   SESSION VIEW (Episode Replay)
===================================================== */

.session-view {
  max-width: 640px;
  margin: 0 auto;
  padding: 96px 20px 40px;
}

/* Back link */
.link-back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.link-back:hover {
  text-decoration: underline;
}

/* Title + intro */
.session-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

/* ---------- Chat Replay ---------- */
.chat-replay {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Chat bubbles */
.chat-bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  border: 1px solid var(--border);
}

.chat-bubble.user {
  align-self: flex-end;
  background: #e5e7eb;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: #eff6ff;
}

/* Label */
.bubble-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

/* Message text */
.bubble-text p {
  margin: 0 0 6px;
}

.bubble-text ul {
  padding-left: 18px;
  margin: 6px 0;
}

/* Timestamp */
.bubble-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

/* ---------- Actions ---------- */
.session-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}

.btn.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .chat-bubble {
    font-size: 18px;   /* extra comfort on phones */
    max-width: 95%;
  }

  .session-actions {
    flex-direction: column;
  }
}
/* =====================================================
   BLOG PAGE
===================================================== */

/* Intro block */
.tool-context {
  margin-bottom: 24px;
}

.context-emphasis {
  font-weight: 600;
  margin-top: 6px;
}

/* Generic content spacing */
.content-block {
  margin-top: 28px;
}

/* ---------- Blog Grid ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

/* Blog card */
.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Optional tag */
.blog-tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 8px;
}

/* Title */
.blog-title {
  font-size: 17px;
  margin: 0 0 6px;
  line-height: 1.35;
}

.blog-title a {
  color: var(--text-main);
  text-decoration: none;
}

.blog-title a:hover {
  text-decoration: underline;
}

/* Date */
.blog-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Excerpt */
.blog-excerpt {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
  flex: 1;
}

/* Read link */
.blog-read {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.blog-read:hover {
  text-decoration: underline;
}

/* ---------- CTA Block ---------- */
.cta-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
}

.content-text {
  font-size: 16px;
  margin-bottom: 12px;
}

html[data-theme="dark"] .chat-user {
  background: #1e293b; /* slate-800 */
}

html[data-theme="dark"] .chat-ai {
  background: #0b1220; /* calm deep blue */
}
html[data-theme="dark"] .menu-list a:hover {
  color: var(--accent);
}
html[data-theme="dark"] .chat-meta,
html[data-theme="dark"] .bubble-label {
  opacity: 0.9;
}
html[data-theme="dark"] .blog-tag {
  background: rgba(96,165,250,0.15);
}
.tool-tile {
  background: rgba(255,255,255,0.06);
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}
/* =====================================================
   HOW IT WORKS – STEP FLOW
===================================================== */

.how-intro {
  margin-bottom: 36px;
}

.how-lead {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.how-lead.emphasis {
  font-weight: 600;
}

/* Steps container */
.how-steps {
  display: flex;
  flex-direction: column;
  gap: 36px;
  margin-top: 32px;
}

/* Individual step */
.how-step {
  padding-left: 12px;
  border-left: 3px solid var(--border);
}

.step-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-title {
  font-size: 20px;
  margin: 6px 0 8px;
}

.step-text {
  font-size: 15px;
  line-height: 1.6;
  max-width: 560px;
}

/* Boundaries */
.how-boundaries {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.how-boundaries p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Mobile */
@media (max-width: 600px) {
  .step-title {
    font-size: 18px;
  }

  .how-lead {
    font-size: 16px;
  }
}
/* CTA spacing */
.cta-block .content-text {
  margin-bottom: 16px;
}
.icon-btn,
.icon-btn:hover,
.icon-btn:focus,
.icon-btn:active {
  text-decoration: none;
}
/* =====================================================
   AUTH FORMS (Reset / Login / Register)
===================================================== */

.form-block {
  max-width: 420px;
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Inputs */
.input-field {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
}

/* Messages */
.error-text {
  max-width: 420px;
  margin: 12px auto;
  background: #fef2f2;
  color: #991b1b;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.success-text {
  max-width: 420px;
  margin: 12px auto;
  background: #ecfeff;
  color: #0369a1;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

/* Mobile tweaks */
@media (max-width: 400px) {
  .form-block {
    margin-top: 18px;
  }
}
.btn-tertiary {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-tertiary:hover {
  color: var(--text-main);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
}

.app-header .app-logo {
  display: flex;
  flex-direction: row;   /* LEFT → RIGHT */
  align-items: center;
}

.logo-left {
  flex: 0 0 auto;
}

.logo-img {
  width: 40px;
  height: 40px;
  display: block;
}

.logo-right {
  display: flex;
  flex-direction: column;
  margin-left: 10px;
  line-height: 1.1;
}

.logo-main {
  font-weight: 700;
  font-size: 15px;
}

.logo-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
/* ================================
   MODAL CORE (REQUIRED)
================================ */
.modal-content {
  all: unset;
  box-sizing: border-box;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 16px;              /* was 18px */
  padding: 22px;                    /* was 20px */
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  font-family: inherit;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 16, 32, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.modal.open {
  display: flex;
}

.modal-content.soft {
  background: var(--bg-card);         /* solid, not transparent */
  border-radius: 16px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-text {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.modal-link {
  display: block;
  text-align: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}

.modal-link.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.modal-small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ================================
   TOOLS GRID (MOBILE FIRST)
================================ */

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 480px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.tool-tile {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-soft);
  border-radius: 999px; /* pill style */
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tool-tile:hover {
  background: rgba(255,255,255,0.1);
}

.tool-tile.soft {
  background: rgba(125, 211, 252, 0.12);
  border-color: rgba(125, 211, 252, 0.3);
}

.tool-emoji {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.tool-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.tool-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.context-highlight {
  margin-top: 18px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);           /* near-black */
  text-align: left;
  line-height: 1.6;
  letter-spacing: 0.02em;  /* THIS makes it pop */
}
.context-note {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted);
  text-align: left;
  line-height: 1.4;
  font-style: italic;      /* unmistakable */
  opacity: 0.75;
}
html[data-theme="dark"] .chat-bubble.user {
  background: #1e293b;
}

html[data-theme="dark"] .chat-bubble.ai {
  background: #0b1220;
}
.action-row {
  margin-top: 28px;          /* pushes buttons down from the card */
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Optional: on mobile, stack nicely */
@media (max-width: 480px) {
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.account-menu {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-width: 160px;
  z-index: 2000;

  /* 👇 ADD THESE */
  flex-direction: column;
}

.account-menu.open {
  display: block;
}

@media (max-width: 768px) {
  .account-menu {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  }
}
.account-menu a {
  display: block;
  padding: 12px 16px;
  font-size: 15px;
  text-decoration: none;
  color: #111827;
}

.account-menu a + a {
  border-top: 1px solid #e5e7eb;
}

html[data-theme="dark"] .context-note a {
  color: #9ca3af; /* slate-400 */
  border-bottom: 1px dotted #93c5fd;
  text-decoration: none;
}

html[data-theme="dark"] .context-note a:hover {
  color: #e5e7eb;
  border-bottom-color: #bfdbfe;
}
/* Dark mode – tool context links (Support tools, etc.) */
html[data-theme="dark"] .tool-context a {
  color: #93c5fd; /* soft blue-300 */
  text-decoration: none;
  border-bottom: 1px dotted rgba(147, 197, 253, 0.6);
  transition: color 0.2s ease, border-color 0.2s ease;
}

html[data-theme="dark"] .tool-context a:hover {
  color: #e5e7eb; /* slate-200 */
  border-bottom-color: #bfdbfe;
}

.tool-title {
  margin-top: 62px;
}

@media (max-width: 600px) {
  .tool-title {
    margin-top: 120px;
  }
}

/* ==========================================
   Subtle page settle-in animation (optional)
========================================== */

.tool-area {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0.9;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tool-area {
    animation: none;
  }
}