:root {
  --bg-color: #0d0d16;
  --panel-bg: rgba(25, 25, 42, 0.6);
  --panel-border: rgba(255, 255, 255, 0.07);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  
  /* Color Coding for Activities */
  --color-sleep: #8b5cf6;
  --color-sleep-glow: rgba(139, 92, 246, 0.4);
  --color-meal: #10b981;
  --color-meal-glow: rgba(16, 185, 129, 0.4);
  --color-hygiene: #ec4899;
  --color-hygiene-glow: rgba(236, 72, 153, 0.4);
  --color-health: #3b82f6;
  --color-health-glow: rgba(59, 130, 246, 0.4);
  --color-outing: #f59e0b;
  --color-outing-glow: rgba(245, 158, 11, 0.4);
  --color-note: #6b7280;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* Mobile Container */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1c1c3a 0%, #0d0d16 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Header */
header {
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.baby-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.baby-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-sleep), var(--color-health));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.baby-info {
  display: flex;
  flex-direction: column;
}

.baby-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.baby-age {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Date Selector Navigation */
.date-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  border-radius: 12px;
}

.date-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}

.date-display {
  font-weight: 600;
  font-size: 1rem;
}

/* Tab Switcher */
.view-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  margin-bottom: 15px;
}

.tab-btn {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  padding: 10px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

/* Main Content Area */
main {
  flex: 1;
  padding: 0 20px 100px; /* space for logging bar */
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Dial View */
.dial-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 10px 0;
}

.dial-center-text {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.dial-center-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dial-center-val {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Timeline View */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 14px;
  border-radius: 16px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.timeline-item.sleep::before { background-color: var(--color-sleep); }
.timeline-item.meal::before { background-color: var(--color-meal); }
.timeline-item.hygiene::before { background-color: var(--color-hygiene); }
.timeline-item.health::before { background-color: var(--color-health); }
.timeline-item.outing::before { background-color: var(--color-outing); }
.timeline-item.note::before { background-color: var(--color-note); }

.item-icon {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.item-content {
  flex: 1;
}

.item-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 2px;
}

.item-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.item-time {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.item-delete {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 4px;
}

.item-delete:hover {
  opacity: 1;
}

/* Floating Action / Log Grid Trigger */
.log-trigger-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  display: flex;
  justify-content: center;
  padding: 0 20px;
  z-index: 100;
}

.add-btn {
  background: linear-gradient(135deg, var(--color-sleep), var(--color-health));
  color: white;
  border: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  cursor: pointer;
  transition: transform 0.2s;
}

.add-btn:active {
  transform: scale(0.9);
}

/* Sliding Overlay Panel for logging */
.overlay-panel {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #111122;
  border-top: 1px solid var(--panel-border);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  transition: bottom 0.3s ease-out;
  z-index: 200;
}

.overlay-panel.active {
  bottom: 0;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.overlay-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Logging Quick Grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.grid-item {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.grid-item:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.05);
}

.grid-item.active {
  border-color: var(--color-sleep);
  background: rgba(139, 92, 246, 0.1);
}

.grid-icon {
  font-size: 1.8rem;
}

.grid-label {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Dynamic details form inside overlay */
.log-details-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

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

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

.form-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.form-row {
  display: flex;
  gap: 10px;
}

.submit-btn {
  background: var(--color-meal);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

/* Dial Styling */
.dial-ring-bg {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 12;
  fill: none;
}

.dial-ring-active {
  stroke: var(--color-sleep);
  stroke-width: 12;
  stroke-linecap: round;
  fill: none;
}

.dial-ring-ongoing {
  stroke: var(--color-sleep);
  stroke-width: 8;
  stroke-linecap: butt;
  fill: none;
  stroke-dasharray: 6 6;
  opacity: 0.9;
}

.dial-point {
  filter: drop-shadow(0 0 4px var(--glow-color));
}

@keyframes blink {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}
