/* ============================================================
   BemLab Premium — Styles
   ============================================================ */

/* --- Variables & Reset --- */
:root {
  --bg: #0F172A; --surface: #1E293B; --primary: #E91E63;
  --primary-rgb: 233,30,99;
  --secondary: #8B5CF6;
  --text: #F8FAFC; --text-muted: #94A3B8; --text-dim: #64748B; --border: #334155;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-glow: 0 0 25px var(--primary);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .5s ease, color .5s ease;
  overflow-x: hidden;
}

/* --- Typography --- */
.title-serif { font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.5px; }
.text-primary { color: var(--primary); }
.text-dark { color: var(--text); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.font-light { font-weight: 300; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: .05em; }
.tracking-widest { letter-spacing: .1em; }
.whitespace-nowrap { white-space: nowrap; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.text-xs { font-size: .75rem; } .text-sm { font-size: .875rem; } .text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; } .text-xl { font-size: 1.25rem; } .text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; } .text-4xl { font-size: 2.25rem; } .text-5xl { font-size: 3rem; }

/* --- Layout --- */
.page-container { max-width: 600px; margin: 0 auto; padding: 20px 20px 100px; min-height: 100vh; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-align { display: flex; align-items: center; }
.flex-col-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.flex-wrap { display: flex; flex-wrap: wrap; }
.items-center { align-items: center; }
.grid { display: grid; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.w-full { width: 100%; } .h-full { height: 100%; } .min-h-screen { min-height: 100vh; }
.mx-auto { margin-left: auto; margin-right: auto; }
.m-0 { margin: 0; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; } .mb-12 { margin-bottom: 3rem; } .mb-24 { margin-bottom: 6rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.p-0 { padding: 0; } .p-1 { padding: .25rem; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.px-2 { padding-left: .5rem; padding-right: .5rem; } .px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; } .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; } .py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; } .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pt-8 { padding-top: 2rem; } .pb-2 { padding-bottom: .5rem; } .pb-4 { padding-bottom: 1rem; }
.pb-10 { padding-bottom: 2.5rem; } .pb-12 { padding-bottom: 3rem; }
.pl-7 { padding-left: 1.75rem; } .pr-4 { padding-right: 1rem; } .pr-8 { padding-right: 2rem; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; } .gap-8 { gap: 2rem; }
.flex-1 { flex: 1 1 0%; } .shrink-0 { flex-shrink: 0; }

/* --- Borders & Shadows --- */
.rounded-sm { border-radius: .125rem; } .rounded-md { border-radius: .375rem; }
.rounded-lg { border-radius: .5rem; } .rounded-xl { border-radius: .75rem; }
.rounded-2xl { border-radius: 1rem; } .rounded-3xl { border-radius: 1.5rem; }
.rounded-full { border-radius: 9999px; }
.shadow-sm { box-shadow: var(--shadow-sm); } .shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1); }
.shadow-glow { box-shadow: 0 0 15px rgba(var(--primary-rgb),.4); }
.drop-shadow-md { filter: drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06)); }
.drop-shadow-glow { filter: drop-shadow(0 0 8px var(--primary)); }
.border { border: 1px solid var(--border); } .border-2 { border-width: 2px; } .border-4 { border-width: 4px; }
.border-t-4 { border-top: 4px solid var(--border); } .border-l-4 { border-left: 4px solid var(--border); }
.border-l-2 { border-left: 2px solid var(--border); } .border-b { border-bottom: 1px solid var(--border); }
.border-dashed { border-style: dashed; }

/* --- Position & Z-index --- */
.relative { position: relative; } .absolute { position: absolute; } .fixed { position: fixed; } .sticky { position: sticky; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; } .top-4 { top: 1rem; } .bottom-0 { bottom: 0; } .bottom-24 { bottom: 6rem; }
.left-0 { left: 0; } .left-4 { left: 1rem; } .right-0 { right: 0; } .right-4 { right: 1rem; }
.z-10 { z-index: 10; } .z-20 { z-index: 20; }

/* --- Overflow & Visibility --- */
.overflow-hidden { overflow: hidden; } .overflow-x-auto { overflow-x: auto; } .overflow-visible { overflow: visible; }
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.pointer-events-none { pointer-events: none; }

/* --- Opacity & Filters --- */
.opacity-5 { opacity: .05; } .opacity-10 { opacity: .1; } .opacity-20 { opacity: .2; }
.opacity-30 { opacity: .3; } .opacity-50 { opacity: .5; } .opacity-70 { opacity: .7; } .opacity-80 { opacity: .8; }
.grayscale { filter: grayscale(100%); } .filter-none { filter: none; }
.backdrop-blur-sm { backdrop-filter: blur(4px); } .backdrop-blur-md { backdrop-filter: blur(12px); }
.blur-xl { filter: blur(24px); }
.mix-blend-overlay { mix-blend-mode: overlay; }

/* --- Transitions & Transforms --- */
.transition-all { transition: all .3s cubic-bezier(.4,0,.2,1); }
.transition-colors { transition: color .3s, background-color .3s, border-color .3s; }
.transition-transform { transition: transform .3s cubic-bezier(.4,0,.2,1); }
.cursor-pointer { cursor: pointer; } .cursor-help { cursor: help; }
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.divide-y > * + * { border-top: 1px solid var(--border); }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Glass Panel --- */
.glass-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow-sm); padding: 1.25rem;
  transition: all .3s ease;
}
.glass-panel.hover-lift:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary);
}
.glass-panel.p-0 { padding: 0; }

/* --- Buttons --- */
.bem-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 9999px; border: none; font-weight: 700; cursor: pointer;
  transition: all .3s cubic-bezier(.4,0,.2,1); font-family: var(--font-sans);
  font-size: .875rem; padding: 12px 24px;
  min-height: 44px; touch-action: manipulation;
}
.bem-btn:disabled { opacity: .5; cursor: not-allowed; }
.bem-btn:active:not(:disabled) { transform: scale(.97); }
.bem-btn-primary { background: var(--primary); color: #fff; }
.bem-btn-primary:hover:not(:disabled) { filter: brightness(1.1); box-shadow: var(--shadow-glow); }
.bem-btn-ghost { background: transparent; }
.bem-btn-ghost:hover:not(:disabled) { background: var(--border); }
.bem-btn.w-full { width: 100%; }

.icon-btn-glass {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.2); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  color: inherit; cursor: pointer; transition: .2s;
  touch-action: manipulation;
}
.icon-btn-glass:hover { background: rgba(0,0,0,.4); transform: scale(1.05); }

.back-btn {
  background: none; border: none; display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-muted); font-weight: 700; cursor: pointer; padding: 4px 0;
  transition: color .2s; font-family: var(--font-sans);
  min-height: 44px; touch-action: manipulation;
}
.back-btn:hover { color: var(--primary); }

/* --- Inputs --- */
.bem-input {
  width: 100%; padding: 16px; border-radius: 16px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--text); font-family: var(--font-sans); outline: none;
  transition: border-color .3s; font-size: 1rem;
  -webkit-appearance: none;
}
.bem-input:focus { border-color: var(--primary); background: rgba(255,255,255,.12); }
.bem-input::placeholder { color: var(--text-dim); opacity: .55; }
textarea.bem-input { resize: vertical; }

.custom-range {
  -webkit-appearance: none; width: 100%; height: 6px;
  background: var(--border); border-radius: 999px; outline: none;
}
.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,.3); border: 2px solid white;
}
.custom-range::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); cursor: pointer; border: 2px solid white;
}

/* --- Progress Bar --- */
.progress-track { width: 100%; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.16,1,.3,1); }

/* --- Bottom Nav --- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 600px;
  background: var(--surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); display: flex; justify-content: space-around;
  padding: 12px 12px 24px; z-index: 50;
  border-radius: 30px 30px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-muted); background: none; border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 16px; transition: all .3s;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  font-family: var(--font-sans);
  min-width: 44px; min-height: 44px; touch-action: manipulation;
}
.nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: translateY(-4px); stroke-width: 2.5px; filter: drop-shadow(0 4px 6px rgba(var(--primary-rgb),.4)); }

/* --- Avatar --- */
.avatar-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-family: var(--font-serif); font-weight: bold;
  box-shadow: var(--shadow-md); border: 2px solid var(--surface);
}

/* --- Section Title --- */
.section-title {
  font-family: var(--font-sans); font-size: 1.1rem; font-weight: 700;
  color: var(--text); display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 1px;
}

/* --- Badge --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 20px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
}

/* --- Stars Background --- */
.bg-stars { background-image: radial-gradient(white 1px, transparent 1px); background-size: 50px 50px; }

/* --- Animations --- */
.fade-in { animation: fadeIn .6s cubic-bezier(.16,1,.3,1) forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* --- Toast --- */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-150px);
  background: var(--surface); border: 1px solid var(--border);
  padding: 16px 24px; border-radius: 20px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 16px;
  z-index: 9999; transition: transform .5s cubic-bezier(.34,1.56,.64,1);
  width: 90%; max-width: 400px;
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* --- Vertical Slider (Active Ritual Soundscape) --- */
.vertical-slider {
  -webkit-appearance: none; width: 4px; height: 60px;
  background: rgba(255,255,255,.2); border-radius: 4px;
  writing-mode: vertical-lr; direction: rtl;
}
.vertical-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: white; cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
}
.vertical-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: white; cursor: pointer; border: none;
}

/* --- Toggle Switch --- */
.toggle-switch {
  width: 48px; height: 24px; border-radius: 9999px; padding: 2px;
  cursor: pointer; transition: background-color .3s; border: none;
  display: flex; align-items: center;
}
.toggle-switch .toggle-dot {
  width: 20px; height: 20px; border-radius: 50%; background: white;
  transition: transform .3s;
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch.on .toggle-dot { transform: translateX(24px); }
.toggle-switch.off { background: var(--text-dim); }
.toggle-switch.off .toggle-dot { transform: translateX(0); }

/* --- Tab Buttons --- */
.tab-btn {
  flex: 1; padding: 8px; font-size: .875rem; font-weight: 700;
  border-radius: 9999px; transition: all .3s; border: none;
  cursor: pointer; font-family: var(--font-sans);
}
.tab-btn.active { background: var(--primary); color: white; box-shadow: var(--shadow-md); }
.tab-btn.inactive { background: transparent; color: var(--text-muted); }

/* --- Filter Pills --- */
.filter-pill {
  padding: 8px 16px; border-radius: 9999px; font-size: .75rem; font-weight: 700;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
  transition: all .3s; cursor: pointer; border: 1px solid var(--border);
  font-family: var(--font-sans);
}
.filter-pill.active { color: white; box-shadow: var(--shadow-md); }
.filter-pill.inactive { background: var(--surface); opacity: .8; }

/* --- Eval Tag --- */
.eval-tag {
  padding: 8px 16px; border-radius: 9999px; font-size: .75rem; font-weight: 700;
  transition: all .3s; cursor: pointer; font-family: var(--font-sans);
}
.eval-tag.selected { background: var(--primary); color: white; border: 1px solid var(--primary); box-shadow: var(--shadow-md); }
.eval-tag.unselected { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.eval-tag.unselected:hover { border-color: rgba(var(--primary-rgb),.5); }

/* --- Emoji Rating --- */
.emoji-option { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.emoji-option .emoji { font-size: 2.25rem; transition: all .3s; }
.emoji-option .emoji.active { transform: scale(1.25); filter: none; }
.emoji-option .emoji.inactive { filter: grayscale(100%); opacity: .3; }
.emoji-option .emoji-label { font-size: .625rem; margin-top: .5rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

/* --- Theme Card --- */
.theme-card {
  padding: .75rem; border-radius: .75rem; border: 2px solid var(--border);
  text-align: left; transition: all .3s; cursor: pointer; background: var(--surface);
  font-family: var(--font-sans);
}
.theme-card.active { border-color: var(--primary); box-shadow: var(--shadow-sm); background: rgba(var(--primary-rgb),.05); }

/* --- Onboarding Input --- */
.onboarding-input {
  width: 100%; background: rgba(255,255,255,.08); border: 1px solid #475569;
  border-radius: .75rem; padding: 16px; color: white; font-size: 1rem;
  outline: none; transition: all .3s; font-family: var(--font-sans);
  -webkit-appearance: none;
}
.onboarding-input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: rgba(255,255,255,.12); }
.onboarding-input::placeholder { color: #64748B; opacity: .55; }

/* --- Search Input --- */
.search-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9999px; padding: 12px 16px 12px 48px; color: var(--text);
  outline: none; transition: border-color .3s; font-family: var(--font-sans);
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-dim, #64748B); }

/* --- Heatmap --- */
.heatmap-grid { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 6px; width: max-content; }
.heatmap-cell { width: 12px; height: 12px; border-radius: 2px; transition: transform .2s; }
.heatmap-cell:hover { transform: scale(1.25); }
