/* ===== RESET & CUSTOM PROPERTIES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FDFCFA;
  --accent: #7C6ADB;
  --accent-light: #9B8AE8;
  --accent-glow: rgba(124,106,219,0.15);
  --warm: #E8A87C;
  --warm-light: #F2C9A8;
  --success: #6EC89B;
  --success-light: #B8E8D0;
  --danger: #E87C7C;
  --text: #2D2A3E;
  --text-secondary: #8E8A9D;
  --text-muted: #B5B1C4;
  --border: #EDE9E3;
  --border-focus: var(--accent);
  --shadow-sm: 0 2px 8px rgba(45,42,62,0.06);
  --shadow-md: 0 4px 20px rgba(124,106,219,0.1);
  --shadow-lg: 0 12px 40px rgba(124,106,219,0.15);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin-bottom: 0.5rem; }
a { color: var(--accent); text-decoration: none; }

/* ===== HEADER ===== */
#app-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #2D2A3E 0%, #3D3656 60%, #4A3F6B 100%);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 60px;
}
.logo { display: flex; align-items: center; gap: 0.5rem; color: white; font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; }
.logo-icon { font-size: 1.4rem; }
#main-nav { display: flex; gap: 0.25rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.85rem; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65); font-size: 0.85rem; font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-link.active { color: white; background: rgba(255,255,255,0.15); }
.nav-icon { font-size: 1rem; }

/* ===== MAIN ===== */
#main {
  max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem 4rem;
  animation: fadeIn 0.35s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: white; border: none;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white; box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: transparent; color: var(--accent);
  border: 2px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-glow); }
.btn-warm {
  background: linear-gradient(135deg, var(--warm), var(--warm-light));
  color: white;
}
.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-light));
  color: white;
}
.btn-lg { padding: 1rem 2.5rem; font-size: 1.05rem; border-radius: var(--radius-xl); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.8rem; }
.btn-block { display: flex; width: 100%; }

/* ===== PULSE ANIMATION ===== */
.pulse { animation: pulse 2.5s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 4px 16px var(--accent-glow); }
  50% { box-shadow: 0 4px 32px rgba(124,106,219,0.35); }
}

/* ===== DASHBOARD ===== */
.greeting { margin-bottom: 2rem; }
.greeting h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.greeting .subtitle { color: var(--text-secondary); font-size: 0.95rem; }
.greeting .phase-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.5rem; padding: 0.3rem 0.8rem; border-radius: 99px;
  background: var(--accent-glow); color: var(--accent);
  font-size: 0.8rem; font-weight: 600;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card { text-align: center; padding: 1.25rem 1rem; }
.stat-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.stat-value { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.15rem; }
.cta-section { text-align: center; margin: 2.5rem 0; }
.cta-section .btn { font-size: 1.1rem; padding: 1rem 3rem; }

/* Mini Calendar */
.mini-calendar { margin-top: 1.5rem; }
.mini-calendar h3 { margin-bottom: 0.75rem; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.35rem;
}
.cal-header { font-size: 0.7rem; color: var(--text-muted); text-align: center; font-weight: 600; }
.cal-day {
  aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--text-secondary); transition: var(--transition);
}
.cal-day.today { font-weight: 700; color: var(--accent); border: 2px solid var(--accent); }
.cal-day.done { background: var(--success); color: white; font-weight: 600; }
.cal-day.rest { background: var(--warm-light); color: var(--warm); }
.cal-day.empty { visibility: hidden; }

/* ===== SESSION PAGE ===== */
.steps-indicator {
  display: flex; gap: 0.5rem; margin-bottom: 2rem;
  padding: 0.75rem 1rem; background: var(--bg-card);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.step-dot {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.7rem; border-radius: 99px;
  font-size: 0.8rem; color: var(--text-muted); font-weight: 500;
  transition: var(--transition);
}
.step-dot.active { background: var(--accent); color: white; }
.step-dot.completed { background: var(--success-light); color: var(--success); }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  background: var(--border); color: var(--text-muted);
}
.step-dot.active .step-num { background: white; color: var(--accent); }
.step-dot.completed .step-num { background: var(--success); color: white; }

.prompt-box {
  background: #1E1B2E; color: #E8E6F0; border-radius: var(--radius);
  padding: 1.5rem; font-family: 'Courier New', monospace; font-size: 0.85rem;
  line-height: 1.7; white-space: pre-wrap; max-height: 400px; overflow-y: auto;
  margin: 1rem 0; border: 1px solid #3D3656;
}

.paste-area {
  width: 100%; min-height: 200px; padding: 1rem;
  border: 2px dashed var(--border); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 0.9rem; color: var(--text);
  background: var(--bg-card); resize: vertical; transition: var(--transition);
}
.paste-area:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-glow); }

/* Session content */
.session-content { animation: fadeIn 0.4s ease; }
.session-content h2 { color: var(--accent); margin: 1.5rem 0 0.75rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--border); }
.session-content h2:first-child { margin-top: 0; }
.session-content ul, .session-content ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.session-content li { margin-bottom: 0.35rem; }
.session-content p { margin-bottom: 0.6rem; }
.session-content strong { color: var(--accent); }

.correction-toggle {
  margin: 1.5rem 0; padding: 1rem 1.5rem;
  border: 2px solid var(--warm); border-radius: var(--radius);
  background: rgba(232,168,124,0.05); cursor: pointer; transition: var(--transition);
}
.correction-toggle summary {
  font-weight: 600; color: var(--warm); cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 0.5rem;
}
.correction-toggle summary::before { content: '👁️'; }
.correction-toggle[open] { border-color: var(--success); background: rgba(110,200,155,0.05); }
.correction-toggle[open] summary { color: var(--success); }

/* ===== TRACKING FORM ===== */
.tracking-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.slider-group { display: flex; flex-direction: column; gap: 0.3rem; }
.slider-value { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 700; color: var(--accent); text-align: center; }

input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 8px;
  border-radius: 4px; background: var(--border); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border: none;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}

.confidence-btns { display: flex; gap: 0.75rem; }
.conf-btn {
  flex: 1; padding: 0.75rem; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--bg-card);
  cursor: pointer; text-align: center; font-size: 1.25rem;
  transition: var(--transition);
}
.conf-btn:hover { border-color: var(--accent-light); transform: translateY(-2px); }
.conf-btn.selected { border-color: var(--accent); background: var(--accent-glow); }
.conf-btn span { display: block; font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.2rem; }

input[type="text"], input[type="number"], textarea {
  width: 100%; padding: 0.65rem 0.85rem; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font-body);
  font-size: 0.9rem; color: var(--text); background: var(--bg-card);
  transition: var(--transition);
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-glow); }
textarea { resize: vertical; min-height: 80px; }

/* ===== PROGRESS PAGE ===== */
.chart-container { position: relative; height: 280px; margin: 1.5rem 0; }
.history-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }
.history-item {
  display: grid; grid-template-columns: 100px 1fr auto; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); transition: var(--transition); cursor: pointer;
}
.history-item:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }
.history-date { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); }
.history-scores { display: flex; gap: 1.25rem; }
.history-score { font-weight: 600; font-size: 0.9rem; }
.history-score .label { font-size: 0.7rem; color: var(--text-muted); }
.history-confidence { font-size: 1.2rem; }

/* ===== ROADMAP ===== */
.timeline { position: relative; padding-left: 2.5rem; }
.timeline::before {
  content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--warm), var(--success));
  border-radius: 3px;
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-dot {
  position: absolute; left: -2.5rem; top: 0.75rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--border); border: 3px solid var(--bg);
  z-index: 1;
}
.timeline-item.active .timeline-dot { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-glow); }
.timeline-item.done .timeline-dot { background: var(--success); }
.timeline-item .card { padding: 1.25rem; }
.timeline-item.active .card { border-color: var(--accent); box-shadow: var(--shadow-md); }
.timeline-item .card h3 { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.timeline-item .card p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }
.phase-label {
  font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 99px;
  background: var(--accent-glow); color: var(--accent); font-weight: 600;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.5rem; border-radius: var(--radius);
  background: var(--text); color: white; font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 999; transition: 0.4s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.hidden { display: none; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-secondary); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }

/* ===== UTILITIES ===== */
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== GUIDE PAGE ===== */
.guide-block {
  display: flex; gap: 1.25rem; align-items: flex-start;
  padding: 1.25rem; background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 1rem;
}
.guide-icon { font-size: 1.75rem; flex-shrink: 0; line-height: 1; }
.guide-block h3 { margin-bottom: 0.3rem; }
.guide-block p { margin: 0; font-size: 0.9rem; color: var(--text-secondary); }
.guide-steps { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.guide-step { display: flex; gap: 1.25rem; align-items: flex-start; }
.guide-step-num {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem;
}
.guide-step-body h3 { margin-bottom: 0.2rem; font-size: 0.95rem; }
.guide-step-body p { margin: 0; font-size: 0.875rem; color: var(--text-secondary); }
.guide-step-body a { color: var(--accent); }

/* ===== RAW WARNING ===== */
.raw-warning {
  font-size: 0.82rem; color: var(--warm); background: rgba(232,168,124,0.08);
  border: 1px solid var(--warm-light); border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem; margin-bottom: 0.75rem;
}

/* ===== PRINT ===== */
@media print {
  #app-header, .steps-indicator, .no-print, button, .btn { display: none !important; }
  #main { max-width: 100%; padding: 0.5rem; }
  .card { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
  .card-accent { background: #f5f5f5 !important; color: #333 !important; }
  .correction-toggle { border: 1px solid #ddd; }
  .correction-toggle summary::before { display: none; }
  details.correction-toggle { open: true; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .header-inner { padding: 0 1rem; }
  .nav-label { display: none; }
  .nav-link { padding: 0.4rem 0.6rem; }
  #main { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.4rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .steps-indicator { flex-wrap: wrap; }
  .step-label { display: none; }
  .history-item { grid-template-columns: 80px 1fr; }
  .history-confidence { display: none; }
}
