/* Meds & Routine page styles — extends dashboard-sunrise.css. */

/* ── Header ── */
.sunrise-meds-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; flex-wrap: wrap; margin-bottom: 32px;
}
.sunrise-meds-title {
  font-family: 'Fraunces', 'Lora', serif;
  font-size: 44px; font-weight: 500;
  color: #3D2419; letter-spacing: -0.025em;
  margin: 10px 0 0; line-height: 1.1;
}
.sunrise-meds-sub {
  font-size: 15px; color: #5C3A2E; line-height: 1.55;
  margin-top: 12px; max-width: 620px;
}

.sunrise-cta-primary {
  font-family: inherit; font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, #E08D6F 0%, #F4A261 100%);
  color: white; border: none;
  padding: 12px 22px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(224,141,111,0.25);
  display: inline-flex; align-items: center; gap: 8px;
}
.sunrise-cta-plus { font-size: 18px; line-height: 0.8; }
.sunrise-cta-secondary {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px;
  border: 1px solid rgba(168,122,101,0.3);
  background: transparent; color: #5C3A2E; cursor: pointer;
}

.sunrise-meds-caveat {
  background: rgba(255, 245, 235, 0.6);
  border-radius: 16px;
  padding: 12px 18px;
  border: 1px solid rgba(224, 141, 111, 0.18);
  margin-bottom: 28px;
  font-size: 12px; color: #8C5E4D; line-height: 1.55;
}

/* ── Time-of-day blocks ── */
.sunrise-tod-block { margin-bottom: 24px; }
.sunrise-tod-divider {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.sunrise-tod-rule { flex: 1; height: 1px; background: rgba(92,58,46,0.08); }
.sunrise-tod-count { font-size: 11px; color: #8C5E4D; }

.sunrise-routine-list { display: flex; flex-direction: column; gap: 10px; }

/* ── Routine row ── */
.sunrise-routine-row {
  background: white; border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 14px rgba(92,58,46,0.06), 0 1px 3px rgba(92,58,46,0.04);
  border: 1px solid rgba(224,141,111,0.18);
  display: grid; grid-template-columns: 32px 40px 1fr auto auto;
  gap: 18px; align-items: center;
}
.sunrise-routine-glyph {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.sunrise-routine-body { min-width: 0; }
.sunrise-routine-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.sunrise-routine-name { font-size: 16px; font-weight: 600; color: #3D2419; }
.sunrise-routine-dose { font-size: 13px; color: #8C5E4D; }
.sunrise-routine-kind-pill {
  font-size: 9px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.sunrise-routine-meta { font-size: 12px; color: #8C5E4D; }
.sunrise-routine-notes { margin-left: 8px; font-style: italic; }

.sunrise-routine-streak { text-align: right; }
.sunrise-routine-streak-value {
  font-family: 'Fraunces', 'Lora', serif;
  font-size: 22px; font-weight: 500; color: #3D2419; line-height: 1;
}
.sunrise-routine-streak-value.is-strong { color: #3D6A4F; }
.sunrise-routine-streak-unit { font-size: 12px; color: #8C5E4D; font-family: 'Inter', sans-serif; }
.sunrise-routine-streak-label {
  font-size: 10px; color: #8C5E4D; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; margin-top: 2px;
}

.sunrise-routine-actions { display: flex; gap: 4px; }
.sunrise-routine-action {
  font-family: inherit; font-size: 12px; font-weight: 500;
  padding: 6px 10px; border-radius: 999px;
  border: none; background: transparent;
  color: #8C5E4D; cursor: pointer;
}
.sunrise-routine-action:hover { background: rgba(255,239,226,0.5); color: #3D2419; }

/* ── Add hint ── */
.sunrise-add-hint {
  text-align: center;
  padding: 24px;
  background: rgba(255,255,255,0.5);
  border: 1px dashed rgba(168,122,101,0.35);
  border-radius: 16px;
  margin-top: 24px;
  font-size: 13px; color: #8C5E4D; line-height: 1.55;
}
.sunrise-add-hint-link { color: #A56D58; font-weight: 600; cursor: pointer; margin-left: 4px; }

/* ── Add-item sheet ── */
.sunrise-sheet-scrim {
  position: fixed; inset: 0;
  background: rgba(61, 36, 25, 0.4);
  backdrop-filter: blur(4px);
  z-index: 50;
  animation: sunrise-fade-in 0.2s ease;
}
.sunrise-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 32px;
  z-index: 51;
  box-shadow: 0 -20px 50px rgba(61,36,25,0.2);
  animation: sunrise-slide-up 0.25s ease;
  max-height: 85vh;
  overflow-y: auto;
}
@keyframes sunrise-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sunrise-slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.sunrise-sheet-inner { max-width: 600px; margin: 0 auto; }
.sunrise-sheet-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.sunrise-sheet-title {
  font-family: 'Fraunces', 'Lora', serif;
  font-size: 28px; font-weight: 500;
  color: #3D2419; letter-spacing: -0.02em; margin: 0;
}
.sunrise-sheet-cancel { font-size: 13px; color: #8C5E4D; cursor: pointer; }
.sunrise-sheet-sub { font-size: 13px; color: #8C5E4D; margin-bottom: 24px; }

/* Kind grid */
.sunrise-kind-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 18px;
}
.sunrise-kind-tile {
  font-family: inherit;
  padding: 14px 12px; border-radius: 12px;
  border: 1px solid rgba(92,58,46,0.1);
  background: white; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all 0.15s ease;
}
.sunrise-kind-tile.is-active { border-width: 2px; padding: 13px 11px; }
.sunrise-kind-tile-glyph { font-size: 20px; font-weight: 700; }
.sunrise-kind-tile-label { font-size: 12px; font-weight: 600; color: #3D2419; }

/* Form fields */
.sunrise-form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sunrise-form-field { display: flex; flex-direction: column; min-width: 0; }
.sunrise-form-field label {
  font-size: 11px; font-weight: 600; color: #8C5E4D; margin-bottom: 6px;
}
.sunrise-form-field input {
  font-family: inherit; font-size: 14px; color: #3D2419;
  width: 100%; padding: 11px 14px;
  border: 1px solid rgba(92,58,46,0.12); border-radius: 10px;
  background: #FFFAF4; outline: none;
  box-sizing: border-box;
}
.sunrise-form-field input:focus { border-color: #E08D6F; background: white; }

.sunrise-when-pills { display: flex; gap: 6px; }
.sunrise-when-pill {
  font-family: inherit; flex: 1; font-size: 12px; font-weight: 600;
  padding: 10px 10px; border-radius: 999px;
  border: 1px solid rgba(92,58,46,0.1);
  background: white; color: #8C5E4D; cursor: pointer;
}
.sunrise-when-pill.is-active {
  background: #FFEFE2; color: #3D2419; border-color: #E9B384;
}

.sunrise-sheet-privacy {
  font-size: 12px; color: #8C5E4D; line-height: 1.55;
  padding: 10px 14px;
  background: #FFFAF4; border-radius: 10px;
  margin: 18px 0;
}
.sunrise-sheet-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Status Toggle Button ── */
.sunrise-routine-status-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #E0D6CE; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; transition: all 0.15s;
  flex-shrink: 0;
}
.sunrise-routine-status-btn:hover { transform: scale(1.1); }

.sunrise-routine-row.is-paused { opacity: 0.55; }

/* ── Form Select (dropdown) ── */
.sunrise-form-select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid #E0D6CE; border-radius: 10px;
  background: #FFFAF4; color: #3D2419;
  font-size: 14px; font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238C5E4D'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.sunrise-form-select:focus {
  outline: none; border-color: #E08D6F;
}

/* ── Back Link ── */
.sunrise-back-link {
  background: none; border: none; color: #8C5E4D;
  font-size: 14px; cursor: pointer; padding: 8px 0;
  font-family: inherit;
}
.sunrise-back-link:hover { color: #3D2419; }

/* ── History Stats Bar ── */
.sunrise-history-stats {
  display: flex; gap: 24px; margin: 20px 0;
  padding: 16px 20px; background: #FFFAF4;
  border-radius: 12px; border: 1px solid #F0E6DC;
}
.sunrise-history-stat { text-align: center; flex: 1; }
.sunrise-history-stat-value {
  font-size: 28px; font-weight: 700; color: #3D2419;
  font-family: 'Fraunces', 'Lora', serif;
}
.sunrise-history-stat-label {
  font-size: 12px; color: #8C5E4D; margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ── Heatmap Grid ── */
.sunrise-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
}
.sunrise-heatmap-cell {
  width: 100%; aspect-ratio: 1; border-radius: 3px;
}
.heatmap-taken { background: #86EFAC; }
.heatmap-missed { background: #FCA5A5; }
.heatmap-skipped { background: #FDE68A; }
.heatmap-empty { background: #F0E6DC; }

.sunrise-heatmap-legend {
  display: flex; gap: 16px; margin-top: 8px;
  font-size: 12px; color: #8C5E4D;
}
.sunrise-heatmap-legend .sunrise-heatmap-cell {
  width: 12px; height: 12px; vertical-align: middle;
  margin-right: 4px; border-radius: 2px;
}

/* ── History Entry List ── */
.sunrise-history-list {
  display: flex; flex-direction: column; gap: 2px;
}
.sunrise-history-entry {
  display: grid; grid-template-columns: 120px 70px 80px 1fr;
  align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  background: #FFFAF4; border: 1px solid #F0E6DC;
  font-size: 13px;
}
.sunrise-history-entry-date { color: #3D2419; font-weight: 500; }
.sunrise-history-entry-status { font-weight: 600; text-transform: capitalize; }
.sunrise-history-entry-time { color: #8C5E4D; }
.sunrise-history-entry-notes { color: #8C5E4D; font-style: italic; }

/* ── Pill Button (small utility) ── */
.sunrise-pill-btn {
  background: #F0E6DC; border: 1px solid #E0D6CE;
  border-radius: 6px; color: #5C3A2E; cursor: pointer;
  font-family: inherit;
}
.sunrise-pill-btn:hover { background: #E0D6CE; }

/* ── Catch-up Banner ── */
.sunrise-catchup-banner {
  background: #FFF8F0;
  border: 1px solid rgba(224, 141, 111, 0.3);
  border-radius: 16px;
  margin-bottom: 24px;
  overflow: hidden;
}
.sunrise-catchup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  gap: 12px;
}
.sunrise-catchup-summary {
  font-size: 14px;
  font-weight: 500;
  color: #5C3A2E;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sunrise-catchup-icon {
  font-size: 18px;
  color: #E08D6F;
  flex-shrink: 0;
}
.sunrise-catchup-actions-top {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.sunrise-catchup-expand,
.sunrise-catchup-dismiss {
  font-family: inherit;
  background: none;
  border: none;
  color: #8C5E4D;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.sunrise-catchup-expand:hover,
.sunrise-catchup-dismiss:hover {
  background: rgba(224, 141, 111, 0.12);
  color: #3D2419;
}
.sunrise-catchup-list {
  padding: 0 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sunrise-catchup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border: 1px solid #F0E6DC;
  border-radius: 10px;
  flex-wrap: wrap;
}
.sunrise-catchup-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.sunrise-catchup-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #3D2419;
}
.sunrise-catchup-item-dose {
  font-size: 12px;
  color: #8C5E4D;
}
.sunrise-catchup-item-date {
  font-size: 12px;
  color: #A87A65;
  font-weight: 500;
}
.sunrise-catchup-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.sunrise-catchup-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}
.sunrise-catchup-taken {
  background: #D4EDDA;
  color: #2D6A3F;
}
.sunrise-catchup-taken:hover {
  background: #C3E6CB;
}
.sunrise-catchup-skipped {
  background: #FFF3CD;
  color: #856404;
}
.sunrise-catchup-skipped:hover {
  background: #FFE8A1;
}

/* ── Log Entry Sheet error ── */
.sunrise-log-error {
  color: #721C24;
  background: #F8D7DA;
  border: 1px solid #F5C6CB;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-top: 8px;
}

/* Mobile — matches app-shell sidebar hide at 768px */
@media (max-width: 768px) {
  .sunrise-meds-title { font-size: 32px; }
  .sunrise-routine-row { grid-template-columns: 32px 36px 1fr; }
  .sunrise-routine-streak, .sunrise-routine-actions { grid-column: 1 / -1; }
  .sunrise-kind-grid { grid-template-columns: repeat(2, 1fr); }
  .sunrise-history-entry { grid-template-columns: 1fr 1fr; }
  .sunrise-history-stats { flex-wrap: wrap; gap: 12px; }
  .sunrise-heatmap-grid { grid-template-columns: repeat(10, 1fr); }
  .sunrise-catchup-item { flex-direction: column; align-items: flex-start; }
  .sunrise-catchup-item-actions { width: 100%; }
  .sunrise-catchup-btn { flex: 1; text-align: center; }
}

/* Small phones */
@media (max-width: 480px) {
  .sunrise-meds-title { font-size: 26px; }
  .sunrise-meds-sub { font-size: 13px; }
  .sunrise-meds-header { margin-bottom: 20px; gap: 16px; }
  .sunrise-routine-row { padding: 14px 14px; gap: 12px; }
  .sunrise-routine-name { font-size: 14px; }
  .sunrise-routine-dose { font-size: 12px; }
  .sunrise-routine-streak-value { font-size: 18px; }
  .sunrise-routine-actions { justify-content: flex-start; }
  .sunrise-sheet { padding: 24px 16px; }
  .sunrise-sheet-title { font-size: 24px; }
  .sunrise-history-entry { grid-template-columns: 1fr; gap: 4px; }
  .sunrise-history-stats { padding: 14px 16px; gap: 10px; }
  .sunrise-history-stat-value { font-size: 22px; }
  .sunrise-heatmap-grid { grid-template-columns: repeat(7, 1fr); }
  .sunrise-cta-primary { padding: 11px 18px; font-size: 13px; }
  .sunrise-cta-secondary { padding: 10px 18px; font-size: 12px; }
  .sunrise-catchup-summary { font-size: 13px; }
  .sunrise-catchup-header { padding: 12px 14px; }
  .sunrise-catchup-list { padding: 0 14px 12px; }
}
