/* ============================
   ZenSphere Design System
   Mobile-first, dark theme
   ============================ */

:root {
  --zen-bg: #0a0a12;
  --zen-surface: #12121e;
  --zen-card: #1a1a2e;
  --zen-accent: #7c6ef0;
  --zen-accent-soft: #5a4fd4;
  --zen-text: #e8e6f0;
  --zen-muted: #8886a0;
  --zen-glow: #9b8aff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

html { height: 100%; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--zen-bg);
  color: var(--zen-text);
  margin: 0;
  min-height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
.font-display { font-family: 'DM Serif Display', Georgia, serif; }
.text-muted { color: var(--zen-muted); }
.text-accent { color: var(--zen-accent); }

/* ---- Glassmorphism ---- */
.glass {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.06);
}
.glass-strong {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ---- Blob Animations ---- */
@keyframes blob1 { 0%,100%{transform:translate(0,0) scale(1)} 25%{transform:translate(30px,-20px) scale(1.1)} 50%{transform:translate(-10px,20px) scale(0.95)} 75%{transform:translate(20px,10px) scale(1.05)} }
@keyframes blob2 { 0%,100%{transform:translate(0,0) scale(1)} 25%{transform:translate(-20px,30px) scale(1.05)} 50%{transform:translate(25px,-15px) scale(1.1)} 75%{transform:translate(-15px,-20px) scale(0.95)} }
@keyframes blob3 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(20px,25px) scale(1.08)} 66%{transform:translate(-25px,-10px) scale(0.92)} }
@keyframes breathe { 0%,100%{transform:scale(1);opacity:0.6} 50%{transform:scale(1.15);opacity:0.9} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes pulse-ring { 0%{transform:scale(0.8);opacity:0.8} 100%{transform:scale(2.5);opacity:0} }
@keyframes spin-slow { 0%{transform:rotate(0deg)} 100%{transform:rotate(360deg)} }
@keyframes waveform { 0%,100%{height:4px} 50%{height:var(--h)} }
@keyframes fadeUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideIn { from{opacity:0;transform:translateX(-20px)} to{opacity:1;transform:translateX(0)} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.blob {
  filter: blur(80px);
  will-change: transform;
  border-radius: 50%;
  position: absolute;
  transition: background 2s ease;
}
.blob-1 { animation: blob1 12s ease-in-out infinite; }
.blob-2 { animation: blob2 15s ease-in-out infinite; }
.blob-3 { animation: blob3 18s ease-in-out infinite; }
.breathe { animation: breathe 6s ease-in-out infinite; }
.float { animation: float 4s ease-in-out infinite; }
.pulse-ring { animation: pulse-ring 3s ease-out infinite; }
.spin-slow { animation: spin-slow 30s linear infinite; }

.fade-up { animation: fadeUp 0.6s ease-out both; }
.fade-up-d1 { animation: fadeUp 0.6s ease-out 0.1s both; }
.fade-up-d2 { animation: fadeUp 0.6s ease-out 0.2s both; }
.fade-up-d3 { animation: fadeUp 0.6s ease-out 0.3s both; }
.fade-up-d4 { animation: fadeUp 0.6s ease-out 0.4s both; }
.fade-in { animation: fadeIn 0.4s ease-out both; }

/* ---- Scrollbar ---- */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Styled scrollbar — thin, dark, glass-consistent */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

/* ---- Range Sliders ---- */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
}
input[type=range]::-webkit-slider-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--zen-accent);
  margin-top: -7px;
  box-shadow: 0 0 10px rgba(124,110,240,0.5);
}
input[type=range]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  border: none;
}
input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--zen-accent);
  border: none;
  box-shadow: 0 0 10px rgba(124,110,240,0.5);
}

/* ---- Inputs ---- */
.zen-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--zen-text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}
.zen-input:focus {
  border-color: var(--zen-accent);
  box-shadow: 0 0 0 2px rgba(124,110,240,0.2);
}
.zen-input::placeholder { color: var(--zen-muted); }

/* ---- Buttons ---- */
.btn-accent {
  background: var(--zen-accent);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.btn-accent:hover { background: var(--zen-accent-soft); }
.btn-accent:active { transform: scale(0.97); }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-glass {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--zen-text);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-glass:active { transform: scale(0.97); }

/* ---- Category pills ---- */
.pill {
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.pill-inactive {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,0.06);
  color: var(--zen-muted);
}
.pill-inactive:hover { color: var(--zen-text); }
.pill-active {
  background: rgba(124,110,240,0.15);
  border-color: rgba(124,110,240,0.3);
  color: var(--zen-accent);
}

/* ---- Session Cards ---- */
.session-card {
  padding: 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.session-card:hover { background: rgba(255,255,255,0.06); }

.session-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: rgba(10,10,18,0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.nav-items {
  display: flex;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: color 0.2s;
  background: none;
  border: none;
  color: var(--zen-muted);
  font-size: 10px;
  font-weight: 500;
}
.nav-item.active { color: var(--zen-accent); }
.nav-item svg { width: 22px; height: 22px; }

/* ---- App container ---- */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.view {
  display: none;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); /* space for bottom nav + safe area */
}
.view.active { display: flex; flex-direction: column; }
.view-player.active { display: flex; }

/* ---- Player specific ---- */
.player-control {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--zen-accent);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
}
.player-control:active { transform: scale(0.9); }
.player-control-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--zen-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ---- Waveform ---- */
.waveform-bar {
  width: 3px;
  border-radius: 2px;
  background: var(--zen-accent);
  opacity: 0.5;
  animation: waveform 1.2s ease-in-out infinite;
}

/* ---- Streak ring ---- */
.streak-ring {
  transform: rotate(-90deg);
}

/* ---- Stat card ---- */
.stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

/* ---- Week dots ---- */
.week-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
}
.week-dot-active {
  background: rgba(124,110,240,0.15);
  color: var(--zen-accent);
}
.week-dot-inactive {
  background: rgba(255,255,255,0.04);
  color: var(--zen-muted);
}

/* ---- Responsive: tablet/desktop ---- */
@media (min-width: 768px) {
  #app {
    max-width: 480px;
  }
  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}

/* ---- Safe area ---- */
@supports (padding: max(0px)) {
  .safe-top { padding-top: max(20px, env(safe-area-inset-top)); }
  .safe-bottom { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
