/* =========================================
   CALCIUM NOTES — ELEVATED READ MODE STYLES
   Distraction-Free Social Focus Station
========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Roboto+Mono:wght@400;600;700;800&display=swap');

:root {
  --bg-deep: #070913;
  --bg-card: rgba(15, 23, 42, 0.7);
  --bg-card-hover: rgba(15, 23, 42, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.35);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
  width: 100%;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.06) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  overflow-x: auto;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y pinch-zoom;
}

/* Custom modern scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* 3-Column Modern Grid Layout */
.read-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1480px;
  margin: 0 auto;
}

/* Glassmorphic Panels */
.rm-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s, box-shadow 0.25s;
}

.rm-panel:hover {
  border-color: var(--border-glow);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.08);
  transform: translateY(-2px);
}

.rm-panel-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rm-panel-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.3), transparent);
}

/* ══════════════════════════════════════════
   1. LIVE STUDY CLOCK PANEL
══════════════════════════════════════════ */
.panel-clock {
  text-align: center;
}

.clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px 0;
}

.clock-hm {
  font-family: 'Roboto Mono', monospace;
  font-size: 3.4rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: -1px;
  line-height: 1;
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.45);
}

.clock-sec {
  font-family: 'Roboto Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: #7dd3fc;
  opacity: 0.8;
  margin-top: -6px;
}

.clock-date-str {
  font-size: 0.92rem;
  color: #cbd5e1;
  font-weight: 600;
  margin-top: 10px;
}

.clock-greeting {
  font-size: 0.75rem;
  color: #34d399;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 12px;
  border-radius: 9999px;
  display: inline-block;
  margin-top: 10px;
}

/* ══════════════════════════════════════════
   2. FOCUS TIMER & STOPWATCH
══════════════════════════════════════════ */
.panel-timer {
  text-align: center;
}

.t-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.t-tab {
  flex: 1;
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.t-tab.on {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.t-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 3rem;
  font-weight: 800;
  color: #4ade80;
  text-shadow: 0 0 25px rgba(74, 222, 128, 0.4);
  margin: 10px 0;
  line-height: 1;
}

.t-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

.t-num {
  width: 52px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px;
  color: var(--text-main);
  font-family: 'Roboto Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all 0.2s;
}

.t-num:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.t-sep {
  font-family: 'Roboto Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dim);
}

.t-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.t-btn {
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.t-btn.go {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.t-btn.stop {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.t-btn.rst {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: #cbd5e1;
}

.t-btn:hover {
  transform: translateY(-2px);
}

.sw-laps {
  max-height: 90px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: 'Roboto Mono', monospace;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ══════════════════════════════════════════
   3. STUDY ALARMS PANEL
══════════════════════════════════════════ */
.al-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.al-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
}

.al-input[type="time"] {
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
}

.al-input[type="text"] {
  flex: 1;
}

.al-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.al-add {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.al-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.al-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.al-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.al-time {
  font-family: 'Roboto Mono', monospace;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* ══════════════════════════════════════════
   4. VARIANCE TRACKER PANEL (SPANS 2 COLS)
══════════════════════════════════════════ */
.panel-variance {
  grid-column: span 2;
}

.vr-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.vr-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vr-level-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.vr-plan-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
}

.vr-plan-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
  color: white;
}

.vr-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.vr-stat-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}

.vr-stat-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.vr-stat-value {
  font-family: 'Roboto Mono', monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.vr-purity-meter {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.vr-purity-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  width: 0%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.vr-table-scroll {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.vr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.vr-table th {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.vr-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.vr-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.vr-time-badge {
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.vr-sub-pill {
  font-weight: 700;
  color: var(--text-main);
}

.vr-est-text {
  font-family: 'Roboto Mono', monospace;
  color: var(--text-muted);
}

.vr-actual-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vr-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  transition: all 0.2s;
}

.vr-action-btn.play {
  background: #10b981;
  color: white;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.vr-action-btn.play:hover {
  transform: scale(1.1);
}

.vr-action-btn.pause {
  background: #ef4444;
  color: white;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.vr-actual-readout {
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.vr-actual-readout.live {
  color: #4ade80;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.vr-variance-val {
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
}

/* ══════════════════════════════════════════
   5. REVISION TASKS PANEL
══════════════════════════════════════════ */
.panel-tasks {
  display: flex;
  flex-direction: column;
}

.tk-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tk-stats b {
  color: var(--text-main);
}

.tk-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tk-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
}

.tk-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
}

.tk-pri {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.tk-add {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.tk-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.tk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.tk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.tk-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tk-item.done span {
  text-decoration: line-through;
  opacity: 0.5;
}

/* ══════════════════════════════════════════
   6. QUICK NOTES PANEL
══════════════════════════════════════════ */
.panel-notes {
  display: flex;
  flex-direction: column;
}

.note-area {
  flex: 1;
  min-height: 140px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  color: #e2e8f0;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.note-area:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ══════════════════════════════════════════
   7. AMBIENT LO-FI PANEL
══════════════════════════════════════════ */
/* ═══════════════════════════════════════
   SPOTIFY FOCUS ENGINE & CONNECT BOX
═══════════════════════════════════════ */
.panel-music {
  display: flex;
  flex-direction: column;
}

.music-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.spotify-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  letter-spacing: 0.3px;
}

.spotify-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.spotify-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sp-preset-btn {
  padding: 5px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sp-preset-btn:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
  transform: translateY(-1px);
}

.sp-preset-btn.active {
  background: rgba(34, 197, 94, 0.22);
  border-color: #22c55e;
  color: #fff;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.spotify-iframe-wrap {
  margin-bottom: 10px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.spotify-iframe-wrap iframe {
  display: block;
}

.spotify-connect-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spotify-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.spotify-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 0.75rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.spotify-input:focus {
  border-color: #22c55e;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
}

.spotify-apply-btn {
  background: #1db954;
  color: #050a10;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 7px 13px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.spotify-apply-btn:hover {
  background: #1ed760;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 185, 84, 0.4);
}

.spotify-clear-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.spotify-clear-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.spotify-tip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.69rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.spotify-web-link {
  color: #1db954;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.spotify-web-link:hover {
  text-decoration: underline;
  color: #1ed760;
}

/* ══════════════════════════════════════════
   IN-PAGE ALARM TOAST
══════════════════════════════════════════ */
.alarm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  z-index: 99999;
  transform: translateY(120px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.alarm-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 24px;
}

.toast-body h4 {
  font-size: 0.9rem;
  color: #f8fafc;
  margin-bottom: 2px;
}

.toast-body p {
  font-size: 0.78rem;
  color: #94a3b8;
}

.toast-dismiss {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: white;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  body {
    padding: 16px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y pinch-zoom;
  }
  .read-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .panel-variance {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  .read-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .panel-variance {
    grid-column: span 1;
  }
  .vr-summary-grid {
    grid-template-columns: 1fr;
  }
}