/* ==========================================================================
   VeloLog - Circadian Sleep Coaching Module Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Sleep Dashboard Header & Hero Anchor Card
   -------------------------------------------------------------------------- */
.sleep-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sleep-header-row .page-header {
  margin-bottom: 0;
}

.circadian-hero-card {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.7) 0%, rgba(21, 29, 48, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.circadian-hero-card::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-clock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.clock-metric-box {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.clock-metric-box.highlight-anchor {
  border-color: rgba(6, 182, 212, 0.4);
}

.clock-metric-box.highlight-bedtime {
  border-color: rgba(139, 92, 246, 0.4);
}

.clock-metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.clock-metric-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.clock-metric-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Streak Progress Bar */
.streak-tracker-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.streak-tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.streak-tracker-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.streak-count-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.streak-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin-bottom: 8px;
}

.streak-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.streak-status-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   2. Action Buttons Bar
   -------------------------------------------------------------------------- */
.sleep-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-sleep-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-sleep-action.btn-log {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-sleep-action.btn-night-guide {
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.btn-sleep-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-sleep-action:active {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   3. Clinical Warning Alert: Delayed Morning Light
   -------------------------------------------------------------------------- */
.circadian-warning-banner {
  background: rgba(225, 29, 72, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 22px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: pulseAlert 3s infinite ease-in-out;
}

@keyframes pulseAlert {
  0%, 100% { border-color: rgba(244, 63, 94, 0.4); }
  50% { border-color: rgba(244, 63, 94, 0.8); }
}

.warning-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--accent-rose);
  margin-top: 2px;
}

.warning-content {
  flex: 1;
}

.warning-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fda4af;
  margin-bottom: 4px;
}

.warning-text {
  font-size: 0.76rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.warning-highlight {
  color: #ffffff;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   4. Daily Circadian Cue Checklist
   -------------------------------------------------------------------------- */
.cues-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cues-completion-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.cues-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-bottom: 16px;
  overflow: hidden;
}

.cues-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-emerald);
  transition: width 0.3s ease;
}

.cues-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.cue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.cue-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.35);
}

.cue-card.cue-done {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}

.cue-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border);
}

.cue-card.cue-done .cue-icon-box {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
}

.cue-info {
  flex: 1;
}

.cue-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.cue-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cue-time-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.cue-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.cue-checkbox-wrapper {
  position: relative;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
}

.cue-checkbox-wrapper input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.2s ease;
  position: absolute;
  top: 0;
  left: 0;
}

.cue-checkbox-wrapper input[type="checkbox"]:checked {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

.cue-checkbox-wrapper input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 7px;
  width: 5px;
  height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* --------------------------------------------------------------------------
   5. Recent Sleep Logs List
   -------------------------------------------------------------------------- */
.sleep-logs-container {
  margin-bottom: 30px;
}

.sleep-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: transform 0.15s ease;
}

.sleep-history-card.consolidated {
  border-left: 4px solid var(--accent-emerald);
}

.sleep-history-card.unconsolidated {
  border-left: 4px solid var(--accent-amber);
}

.sleep-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sleep-card-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 6px;
}

.sleep-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-steady {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-shift {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  font-weight: 700;
}

.sleep-time-range {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sleep-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(11, 15, 25, 0.5);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.sleep-metric {
  display: flex;
  flex-direction: column;
}

.sleep-metric-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sleep-metric-val {
  font-size: 0.74rem;
  font-weight: 600;
}

.sleep-metric-val.val-good {
  color: var(--accent-emerald);
}

.sleep-metric-val.val-warn {
  color: var(--accent-amber);
}

.sleep-card-warning-pill {
  margin-top: 8px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.7rem;
  color: #fca5a5;
  line-height: 1.35;
}

.sleep-card-notes {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   6. The 20-Minute Rule Guide Modal (Non-Stimulating Soothing Dark UI)
   -------------------------------------------------------------------------- */
.night-guide-card {
  background: #090d16;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  max-width: 440px;
  width: 92%;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.night-guide-header {
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.night-guide-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e0e7ff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.night-guide-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.night-guide-intro {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.protocol-steps-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.protocol-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-num-bubble {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content h4 {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.step-content p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.time-cue-warning-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}

.time-cue-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.time-cue-text {
  font-size: 0.74rem;
  color: #e2e8f0;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   7. Form Specific Controls (Checkboxes, Previews)
   -------------------------------------------------------------------------- */
.toggle-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-switch-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-switch-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
}

.form-alert-preview {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: #fca5a5;
  line-height: 1.4;
}

/* Modal overlay display rule compatibility */
.modal-overlay.open,
.modal-overlay.active {
  display: flex !important;
}
