/* SlothSnooze AI - Premium Midnight & Twilight Sanctuary Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-deep: #060913;
  --bg-surface: rgba(15, 23, 42, 0.85);
  --bg-card: rgba(30, 41, 59, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(52, 211, 153, 0.35);

  --accent-emerald: #10b981;
  --accent-emerald-glow: #34d399;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-amber-glow: #fbbf24;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Background Canvas Layer */
#canopy-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: auto;
}

/* App Wrapper */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 80px 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 24px;
}

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

.brand-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(99, 102, 241, 0.2));
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.2);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-glow);
  border: 1px solid rgba(52, 211, 153, 0.3);
  margin-left: 8px;
  vertical-align: middle;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Master Play Button */
.btn-master-play {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #ffffff;
  border: none;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
}

.btn-master-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5);
}

.btn-master-play.playing {
  background: linear-gradient(135deg, #e11d48, #be123c);
  box-shadow: 0 4px 18px rgba(225, 29, 72, 0.4);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 9px 15px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Sleep Timer Group */
.timer-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-sleep-timer {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-body);
  font-size: 0.86rem;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

.timer-badge {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.timer-badge.active {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

/* Navigation Tabs */
.nav-tab-bar {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow-x: auto;
}

.nav-tab {
  flex: 1;
  min-width: 140px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(99, 102, 241, 0.18));
  color: #ffffff;
  border: 1px solid var(--border-glow);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Header */
.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Soundscape Studio Layout */
.soundscape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

/* Preset Cards Grid */
.presets-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.preset-card {
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
}

.preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(30, 41, 59, 0.8);
}

.preset-card.active {
  border-color: var(--accent-emerald-glow);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(30, 41, 59, 0.8));
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.preset-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.preset-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Channels Mixing Board */
.mixer-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.mixer-channel {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mixer-channel:last-child {
  border-bottom: none;
}

.channel-info {
  width: 140px;
}

.channel-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.channel-type {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.channel-slider-wrapper {
  flex: 1;
}

/* Custom Range Input */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(51, 65, 85, 0.6);
  border-radius: 4px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-emerald-glow);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
  transition: transform 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.channel-toggle {
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.channel-toggle.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald-glow);
  border-color: rgba(52, 211, 153, 0.4);
}

/* Bedtime Story Weaver Layout */
.story-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

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

.journey-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.journey-card {
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.journey-card:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(99, 102, 241, 0.3);
}

.journey-card.active {
  border-color: #a5b4fc;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(15, 23, 42, 0.9));
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.25);
}

.journey-title {
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

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

/* Custom Prompt Box */
.custom-dream-box {
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 12px;
}

.custom-dream-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.84rem;
  outline: none;
  margin-top: 6px;
  margin-bottom: 8px;
}

.custom-dream-input:focus {
  border-color: var(--accent-emerald-glow);
}

/* Story Reader Screen */
.story-reader-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.story-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 18px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}

.story-display-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.story-display-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.story-actions {
  display: flex;
  gap: 10px;
}

.story-body {
  max-height: 480px;
  overflow-y: auto;
  padding-right: 12px;
}

.story-paragraph {
  font-size: 1.08rem;
  line-height: 1.9;
  color: #cbd5e1;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.story-paragraph.highlight-speaking {
  color: #ffffff;
  background: rgba(16, 185, 129, 0.12);
  border-left: 3px solid var(--accent-emerald-glow);
  padding-left: 12px;
  border-radius: 4px;
}

/* 4-7-8 Breathing Guide */
.breathing-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
}

.breath-circle-container {
  width: 280px;
  height: 280px;
  margin: 30px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.breath-ring {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 4px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 25px rgba(52, 211, 153, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, rgba(15, 23, 42, 0.6) 80%);
}

.breath-timer-count {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  color: #ffffff;
}

.breath-phase-label {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-emerald-glow);
  margin-top: 4px;
}

.breath-cue-text {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 24px;
  min-height: 48px;
}

.breath-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 600px;
  width: 100%;
  margin-top: 24px;
}

.breath-stat-box {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.breath-stat-val {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

.breath-stat-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Morning Sloth Digest */
.digest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.digest-input-card,
.digest-output-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.digest-presets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.digest-preset-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.digest-preset-card:hover {
  background: rgba(51, 65, 85, 0.8);
}

.digest-preset-card.active {
  border-color: var(--accent-amber-glow);
  background: rgba(245, 158, 11, 0.15);
  color: #ffffff;
}

.digest-textarea {
  width: 100%;
  height: 180px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-family: monospace;
  font-size: 0.84rem;
  padding: 12px;
  outline: none;
  resize: vertical;
}

.digest-briefing-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
}

.digest-line {
  margin-bottom: 14px;
}

.digest-line-label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-amber-glow);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.digest-line-text {
  font-size: 1.02rem;
  color: var(--text-main);
  line-height: 1.5;
}

.sloth-quote-box {
  margin-top: 20px;
  padding: 14px;
  border-left: 3px solid var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 4px;
  font-style: italic;
  font-size: 0.95rem;
  color: #a7f3d0;
}

/* The Lazy Payoff & Sleep Audit */
.audit-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.audit-slider-group {
  margin: 24px 0 32px 0;
  background: rgba(15, 23, 42, 0.6);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.audit-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.audit-stat-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.audit-stat-card.highlight {
  border-color: var(--border-glow);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(30, 41, 59, 0.8));
}

.audit-stat-num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.audit-stat-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.audit-stat-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Footer */
.app-footer {
  margin-top: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
}

.footer-link {
  color: var(--accent-emerald-glow);
  text-decoration: none;
}

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