/* Baby Sleep Schedule & Wake Window Calculator */

/* ---- Input Form ---- */
.sleep-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}

.mode-btn {
  padding: 8px 20px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-btn.active {
  background: var(--color-primary);
  color: #fff;
}

.input-row {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.input-group input,
.input-group select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.sleep-form .btn {
  padding: 8px 18px;
  font-size: 0.85rem;
}

/* ---- Age Hero ---- */
.age-hero {
  text-align: center;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.age-hero-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.age-hero-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.age-hero-notice {
  font-size: 0.82rem;
  color: #b7791f;
  background: #fefcbf;
  border: 1px solid #ecc94b;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-top: 10px;
  display: inline-block;
}

.age-hero-range {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ---- Timeline ---- */
.timeline-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.timeline-section h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.timeline-wake-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.timeline-wake-row label {
  font-weight: 600;
  white-space: nowrap;
}

.timeline-wake-row input[type="time"] {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.timeline-bar {
  position: relative;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-bg-secondary);
  margin-bottom: 6px;
}

.timeline-block {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
  padding: 0 2px;
  box-sizing: border-box;
}

.timeline-block-awake {
  background: #ecc94b;
  color: #744210;
}

.timeline-block-nap {
  background: #4299e1;
}

.timeline-block-night {
  background: #2d3748;
}

.timeline-hours {
  position: relative;
  height: 20px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  overflow: hidden;
}

.timeline-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot-awake { background: #ecc94b; }
.legend-dot-nap { background: #4299e1; }
.legend-dot-night { background: #2d3748; }

/* ---- Schedule Table ---- */
.schedule-table-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.schedule-table-section h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.schedule-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 2px solid var(--color-border-light);
}

.schedule-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
}

.schedule-table .activity-nap {
  color: #2b6cb0;
  font-weight: 600;
}

.schedule-table .activity-night {
  color: #4a5568;
  font-weight: 600;
}

/* ---- Tips ---- */
.tips-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.tips-section h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.tip-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.5;
}

.tip-item:last-child {
  border-bottom: none;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-section {
    padding: 16px 14px;
  }
  .timeline-block {
    font-size: 0.6rem;
  }
  .timeline-legend {
    flex-wrap: wrap;
    gap: 10px;
  }
  .schedule-table-section {
    padding: 16px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .schedule-table {
    font-size: 0.82rem;
  }
  .schedule-table th,
  .schedule-table td {
    padding: 6px 6px;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-card {
    padding: 10px 8px;
  }
  .stat-label {
    font-size: 0.65rem;
  }
  .stat-value {
    font-size: 0.95rem;
  }
  .input-row {
    flex-direction: column;
  }
  .timeline-bar {
    height: 40px;
  }
  .timeline-block {
    font-size: 0;   /* hide labels in very narrow blocks */
  }
  .timeline-block-nap,
  .timeline-block-night {
    font-size: 0.55rem; /* keep labels on wider blocks only */
  }
  .timeline-hours {
    font-size: 0.6rem;
  }
  .sleep-form {
    padding: 16px 12px;
  }
  .tips-section {
    padding: 16px 12px;
  }
}

/* ---- Print ---- */
@media print {
  .sleep-form,
  .timeline-wake-row {
    display: none !important;
  }
  .schedule-table-section,
  .tips-section {
    break-inside: avoid;
  }
}
