/* 
   Ziyad Tracker - Stylesheet
   Premium, Modern, Kid-Friendly, Glassmorphic, and Responsive.
   Supports Light & Dark (Night) modes and Arabic (RTL) / German (LTR) directions.
*/

:root {
  /* Pastel & Kid-Friendly Palette */
  --bg-primary: #f0f8ff; /* Alice Blue */
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --text-main: #334e68;
  --text-muted: #627d98;
  --border-color: rgba(179, 229, 252, 0.4);
  
  /* Primary Accent Colors */
  --color-blue: #b3e5fc; /* Pastel Blue - Baby Boy */
  --color-blue-dark: #0288d1;
  --color-pink: #ffcdd2; /* Soft Pink */
  --color-pink-dark: #d32f2f;
  --color-cream: #fff9c4; /* Cream / Yellow */
  --color-cream-dark: #fbc02d;
  --color-mint: #c8e6c9; /* Soft Mint Green */
  --color-mint-dark: #388e3c;
  --color-orange: #ffe0b2; /* Soft Orange */
  --color-orange-dark: #f57c00;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(179, 229, 252, 0.2), 0 4px 6px -2px rgba(179, 229, 252, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(179, 229, 252, 0.3), 0 10px 10px -5px rgba(179, 229, 252, 0.2);
  
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Fonts */
  --font-ar: 'Cairo', sans-serif;
  --font-de: 'Outfit', sans-serif;
}

/* NIGHT MODE OVERRIDES */
body.dark-mode {
  --bg-primary: #10172a; /* Deep Slate Blue */
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: rgba(51, 65, 85, 0.5);
  
  --color-blue: #1e3a8a;
  --color-blue-dark: #60a5fa;
  --color-pink: #881337;
  --color-pink-dark: #f87171;
  --color-cream: #78350f;
  --color-cream-dark: #fbbf24;
  --color-mint: #064e3b;
  --color-mint-dark: #34d399;
  --color-orange: #7c2d12;
  --color-orange-dark: #fb923c;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* RESET & BASE */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-main);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* Directional Fonts setting */
html[lang="ar"] {
  font-family: var(--font-ar);
}
html[lang="de"] {
  font-family: var(--font-de);
}

/* APP CONTAINER */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 80px; /* Spacer for bottom nav on mobile */
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* BACKGROUND DECORATIONS (Floating soft bubbles) */
body::before, body::after {
  content: '';
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.6;
  pointer-events: none;
  transition: background-color var(--transition-normal);
}
body::before {
  top: -50px;
  right: -50px;
  background-color: rgba(179, 229, 252, 0.4); /* Pastel Blue */
}
body::after {
  bottom: -50px;
  left: -50px;
  background-color: rgba(255, 205, 210, 0.3); /* Soft Pink */
}
body.dark-mode::before {
  background-color: rgba(2, 136, 209, 0.15);
}
body.dark-mode::after {
  background-color: rgba(211, 47, 47, 0.1);
}

/* HEADER */
.app-header {
  padding: 20px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 15px;
  text-align: center;
  position: relative;
}

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

/* LANG SWITCHER */
.lang-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 30px;
  padding: 3px;
}
body.dark-mode .lang-switcher {
  background: rgba(255, 255, 255, 0.1);
}
.lang-switcher button {
  background: none;
  border: none;
  outline: none;
  padding: 6px 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.lang-switcher button.active {
  background: var(--color-blue-dark);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ICON BUTTON */
.icon-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  outline: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: background var(--transition-fast);
}
body.dark-mode .icon-btn {
  background: rgba(255, 255, 255, 0.1);
}
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}
body.dark-mode .icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.hidden {
  display: none !important;
}

/* BABY IDENTITY */
.baby-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  margin-bottom: 8px;
  animation: bounce 3s infinite ease-in-out;
  object-fit: cover;
  display: inline-block;
  backdrop-filter: blur(5px);
}

.baby-identity h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

/* AGE TICKER */
.age-ticker {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 5px;
}
.age-segment {
  background: rgba(255, 255, 255, 0.4);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-width: 60px;
  align-items: center;
}
body.dark-mode .age-segment {
  background: rgba(255, 255, 255, 0.05);
}
.age-segment strong {
  font-size: 1.25rem;
  color: var(--color-blue-dark);
}
.age-segment span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.age-ticker-seconds {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 600;
}

/* SMART ALERTS */
.smart-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 15px 15px 15px;
}
.alert-card {
  background: var(--bg-card);
  border-inline-start: 5px solid var(--color-orange-dark);
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.3s ease;
}
.alert-card.warning {
  border-inline-start-color: var(--color-pink-dark);
}
.alert-card.urgent {
  animation: pulse-border 1.5s infinite alternate;
  border-inline-start-color: var(--color-pink-dark);
}

/* CONNECTION BADGE */
.connection-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 0 15px 15px 15px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}
.connection-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.connection-badge.mock-mode .badge-dot {
  background: var(--color-cream-dark);
}
.connection-badge.online-mode .badge-dot {
  background: var(--color-mint-dark);
}
.connection-badge.error-mode .badge-dot {
  background: var(--color-pink-dark);
}

/* BOTTOM NAVIGATION */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
  padding: 8px 10px 16px 10px; /* Safe padding for bottom notches */
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  transition: all var(--transition-fast);
  padding: 5px 2px;
  border-radius: var(--radius-sm);
}
.nav-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
  transition: transform var(--transition-fast);
}
.nav-label {
  font-size: 0.7rem;
  font-weight: 700;
}
.nav-item:hover .nav-icon {
  transform: translateY(-2px);
}
.nav-item.active {
  color: var(--color-blue-dark);
}
.nav-item.active .nav-icon {
  transform: scale(1.15) translateY(-2px);
}

/* MAIN CONTENT */
.app-main {
  padding: 0 15px 20px 15px;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}
.tab-content.active {
  display: block;
}

/* CARDS */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 20px;
  margin-bottom: 15px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background-color: var(--bg-card-hover);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 10px 5px 15px 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: -10px 5px 15px 5px;
  font-weight: 600;
}

/* QUICK STATUS PANEL */
.quick-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}
.status-card {
  background: var(--bg-card);
  backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.status-icon {
  font-size: 1.6rem;
}
.status-info {
  display: flex;
  flex-direction: column;
}
.status-title {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
}
.status-value {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

/* QUICK LOG ACTIONS */
.quick-log-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
@media (max-width: 600px) {
  .quick-log-grid {
    grid-template-columns: 1fr;
  }
}
.log-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.log-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background-color: var(--bg-card-hover);
}
.log-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.log-card-icon {
  font-size: 1.8rem;
}
.log-card h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}
.log-card.full-width {
  grid-column: span 2;
}

/* INPUTS */
.quick-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.quick-input-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}
.quick-input-group select, .quick-input-group input[type="text"], .quick-input-group input[type="number"], .input-group input, .input-group select, .input-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  transition: border var(--transition-fast);
}
body.dark-mode select, body.dark-mode input, body.dark-mode textarea {
  background: rgba(15, 23, 42, 0.8) !important;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--color-blue-dark);
}

/* ADJUSTABLE NUMBER FIELD */
.number-adjuster {
  display: flex;
  align-items: center;
  gap: 5px;
}
.number-adjuster input {
  text-align: center;
  flex: 1;
}
.adjust-btn {
  background: var(--color-blue);
  color: var(--color-blue-dark);
  font-weight: 800;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
body.dark-mode .adjust-btn {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}
.adjust-btn:hover {
  filter: brightness(0.95);
}

/* DIAPER OPTIONS */
.diaper-options {
  display: flex;
  gap: 8px;
  width: 100%;
}
.diaper-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 5px;
  background: rgba(0, 0, 0, 0.03);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-main);
}
body.dark-mode .diaper-btn {
  background: rgba(255, 255, 255, 0.02);
}
.diaper-btn span {
  font-size: 1.4rem;
  margin-bottom: 2px;
}
.diaper-btn small {
  font-size: 0.65rem;
  font-weight: 700;
}
.diaper-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.diaper-btn.active {
  background: var(--color-blue);
  border-color: var(--color-blue-dark);
  box-shadow: var(--shadow-sm);
}
body.dark-mode .diaper-btn.active {
  background: rgba(96, 165, 250, 0.2);
}

/* BUTTONS */
.btn-primary {
  background: linear-gradient(135deg, var(--color-blue-dark) 0%, #0277bd 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-blue-dark);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-pink-dark) 0%, #c62828 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-danger:hover {
  filter: brightness(1.05);
}

.btn-sleep-toggle {
  background: linear-gradient(135deg, var(--color-mint-dark) 0%, #2e7d32 100%);
}
.btn-sleep-toggle.sleeping {
  background: linear-gradient(135deg, var(--color-pink-dark) 0%, #c62828 100%);
}

.sleep-status-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
.sleep-state-badge {
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}
.sleep-state-badge.awake {
  background: var(--color-cream);
  color: var(--color-cream-dark);
}
.sleep-state-badge.sleeping {
  background: var(--color-blue);
  color: var(--color-blue-dark);
  animation: pulse-badge 2s infinite ease-in-out;
}
body.dark-mode .sleep-state-badge.awake {
  background: rgba(251, 192, 45, 0.15);
}
body.dark-mode .sleep-state-badge.sleeping {
  background: rgba(96, 165, 250, 0.15);
}

#sleep-duration-live {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
#live-sleep-timer {
  font-size: 1.4rem;
  color: var(--text-main);
  font-family: monospace;
  margin-top: 2px;
}

/* CAMERA STYLING */
.camera-wrapper {
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}
#camera-preview, #photo-canvas, #photo-output, #milestone-camera-preview, #milestone-photo-canvas, #milestone-photo-output {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
}
.camera-buttons {
  position: absolute;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  align-items: center;
  z-index: 10;
}
.file-upload-fallback {
  background: rgba(255,255,255,0.85);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #334e68;
}
body.dark-mode .file-upload-fallback {
  background: rgba(15, 23, 42, 0.9);
  color: #f1f5f9;
}
.file-upload-fallback input[type="file"] {
  width: auto;
  border: none;
  padding: 0;
  font-size: 0.7rem;
  background: none !important;
}

/* PUMPING FORM & STATS PAGE */
.stats-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
@media (max-width: 600px) {
  .stats-dashboard-grid {
    grid-template-columns: 1fr;
  }
}
.input-row {
  display: flex;
  gap: 10px;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  flex: 1;
}
.input-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.input-group.flex-end {
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* SIDE SELECTOR FOR PUMPING */
.side-selector {
  display: flex;
  gap: 5px;
}
.side-btn {
  flex: 1;
  position: relative;
  cursor: pointer;
}
.side-btn input {
  position: absolute;
  opacity: 0;
}
.side-btn span {
  display: block;
  text-align: center;
  padding: 10px 5px;
  border: 1.5px solid var(--border-color);
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  transition: all var(--transition-fast);
}
body.dark-mode .side-btn span {
  background: rgba(255, 255, 255, 0.05);
}
.side-btn input:checked + span {
  background: var(--color-blue);
  border-color: var(--color-blue-dark);
}
body.dark-mode .side-btn input:checked + span {
  background: rgba(96, 165, 250, 0.2);
}

.summary-stats-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}
.stat-box {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 5px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.stat-box small {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
}
.stat-box span {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-blue-dark);
  margin-top: 3px;
}

.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}
.chart-container-half {
  position: relative;
  height: 140px;
  width: 100%;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
@media (max-width: 600px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* CALENDAR STYLING */
.calendar-header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.nav-arrow-btn {
  background: var(--color-blue);
  color: var(--color-blue-dark);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
body.dark-mode .nav-arrow-btn {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}
.calendar-nav h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}
.calendar-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  background: rgba(0,0,0,0.02);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
body.dark-mode .calendar-day-cell {
  background: rgba(255, 255, 255, 0.02);
}
.calendar-day-cell:hover {
  background: var(--color-blue);
}
body.dark-mode .calendar-day-cell:hover {
  background: rgba(96, 165, 250, 0.15);
}
.calendar-day-cell.inactive-month {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}
.calendar-day-cell.today {
  border: 2px solid var(--color-blue-dark);
}
.calendar-day-cell.has-appointment::after {
  content: '👶';
  font-size: 0.6rem;
  position: absolute;
  bottom: 2px;
}
/* Calendar indicators customized */
.calendar-day-cell.has-appointment {
  background: var(--color-orange);
  color: var(--color-orange-dark);
}
body.dark-mode .calendar-day-cell.has-appointment {
  background: rgba(245, 124, 0, 0.15);
  color: #fb923c;
}

.appointments-list-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.appt-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.appt-item-card:hover {
  transform: translateX(-2px);
}
html[lang="de"] .appt-item-card:hover {
  transform: translateX(2px);
}
.appt-info-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.appt-item-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}
.appt-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}
.appt-action-btns {
  display: flex;
  gap: 8px;
}

/* MILESTONES SCRAPBOOK */
.stage-tabs-scroll {
  overflow-x: auto;
  margin-bottom: 15px;
}
.stage-tabs {
  display: flex;
  gap: 8px;
  width: max-content;
  padding: 2px;
}
.stage-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 18px;
  border-radius: 30px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}
.stage-tab.active {
  background: var(--color-blue-dark);
  color: white;
  border-color: var(--color-blue-dark);
}

.stage-progress-card {
  padding: 15px;
  margin-bottom: 20px;
}
.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
  overflow: hidden;
}
body.dark-mode .progress-bar-bg {
  background: rgba(255, 255, 255, 0.05);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b3e5fc 0%, var(--color-blue-dark) 100%);
  border-radius: 10px;
  transition: width 0.5s ease-in-out;
}

.milestones-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
@media (max-width: 600px) {
  .milestones-grid {
    grid-template-columns: 1fr;
  }
}
.milestone-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all var(--transition-normal);
}
.milestone-item-card.achieved {
  border-color: var(--color-mint-dark);
  background: rgba(200, 230, 201, 0.15);
}
body.dark-mode .milestone-item-card.achieved {
  background: rgba(6, 78, 59, 0.15);
}
.milestone-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.milestone-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  margin-top: 3px;
  accent-color: var(--color-mint-dark);
}
.milestone-details-txt {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.milestone-name-txt {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
}
.milestone-desc-txt {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}
.milestone-tag {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  margin-top: 5px;
}
/* Milestone Tags Styles */
.tag-motor { background: var(--color-blue); color: var(--color-blue-dark); }
.tag-lang { background: var(--color-pink); color: var(--color-pink-dark); }
.tag-cognitive { background: var(--color-cream); color: var(--color-cream-dark); }
.tag-social { background: var(--color-orange); color: var(--color-orange-dark); }

body.dark-mode .tag-motor { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
body.dark-mode .tag-lang { background: rgba(248, 113, 113, 0.15); color: #f87171; }
body.dark-mode .tag-cognitive { background: rgba(251, 192, 45, 0.15); color: #fbbf24; }
body.dark-mode .tag-social { background: rgba(245, 124, 0, 0.15); color: #fb923c; }

.milestone-date-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-mint-dark);
  margin-top: 5px;
}

/* Polaroid Photo Card inside Milestone */
.milestone-polaroid {
  background: white;
  padding: 8px 8px 24px 8px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transform: rotate(-2deg);
  margin-top: 10px;
  align-self: center;
  width: 90%;
  display: flex;
  flex-direction: column;
  position: relative;
}
body.dark-mode .milestone-polaroid {
  background: #1e293b;
  border-color: rgba(255,255,255,0.05);
}
.polaroid-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.polaroid-caption {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  color: #334e68;
  margin-top: 8px;
}
body.dark-mode .polaroid-caption {
  color: #94a3b8;
}

/* HISTORY TABLE & LOGS */
.history-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.filter-card {
  padding: 15px;
  margin-bottom: 15px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 600px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
}
.table-container {
  overflow-x: auto;
  padding: 0;
}
.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}
.logs-table th, .logs-table td {
  padding: 12px 15px;
  font-size: 0.85rem;
}
.logs-table th {
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-muted);
  font-weight: 800;
  border-bottom: 2px solid var(--border-color);
}
body.dark-mode .logs-table th {
  background: rgba(255, 255, 255, 0.02);
}
.logs-table td {
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-main);
  vertical-align: middle;
}
.logs-table tr:last-child td {
  border-bottom: none;
}
.no-data-msg {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Action button inside table */
.th-btn-share {
  background: #25d366; /* WhatsApp green */
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.th-btn-share:hover {
  background: #1ebd56;
  transform: scale(1.05);
}
.th-btn-delete {
  background: none;
  border: none;
  color: var(--color-pink-dark);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

/* SETTINGS & GUIDE */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 15px;
  font-size: 0.85rem;
  line-height: 1.6;
}
.guide-step-item {
  display: flex;
  gap: 12px;
}
.guide-step-num {
  background: var(--color-blue);
  color: var(--color-blue-dark);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
body.dark-mode .guide-step-num {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}
.guide-step-text {
  font-weight: 600;
}
.code-box {
  background: rgba(0, 0, 0, 0.05);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 5px;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
}
body.dark-mode .code-box {
  background: #0f172a;
}

/* MODAL STYLING */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}
.modal.open {
  display: flex;
}
.modal-content {
  background-color: var(--bg-primary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 25px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalScaleUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}
body.dark-mode .modal-content {
  background-color: #1e293b;
}
.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}
html[lang="ar"] .close-btn {
  right: auto;
  left: 20px;
}
.close-btn:hover {
  color: var(--text-main);
}
.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 20px;
}

.text-start {
  text-align: start;
}
.font-bold {
  font-weight: 800;
}
.w-100 { width: 100%; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 18px; }
.flex-end { align-self: flex-end; }

/* Appointment details styling */
.appt-detail-row {
  margin-bottom: 12px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}
.appt-detail-row strong {
  display: inline-block;
  min-width: 80px;
}
.appt-detail-row a {
  color: var(--color-blue-dark);
  text-decoration: none;
  font-weight: 700;
}
.detail-badge {
  background: var(--color-blue);
  color: var(--color-blue-dark);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 10px;
}
body.dark-mode .detail-badge {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

/* ANIMATIONS */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modalScaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes pulse-badge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(2, 136, 209, 0.4); }
  70% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(2, 136, 209, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(2, 136, 209, 0); }
}
@keyframes pulse-border {
  from { border-inline-start-color: var(--color-pink-dark); }
  to { border-inline-start-color: var(--color-orange-dark); }
}

/* PEDIATRICIAN PRINT STYLING - Default hidden on screen */
.print-container {
  display: none;
}

/* BABY PHOTOS GALLERY */
.baby-photos-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.gallery-polaroid {
  background: #ffffff;
  padding: 8px 8px 15px 8px;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform var(--transition-fast);
  cursor: pointer;
  page-break-inside: avoid;
}

.gallery-polaroid:hover {
  transform: rotate(2deg) scale(1.05);
}

.gallery-polaroid-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
}

.gallery-polaroid-caption {
  font-family: 'Cairo', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: #495057;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.gallery-polaroid-date {
  font-size: 0.55rem;
  color: var(--text-muted);
}

/* DOCTOR VISITS HISTORY LIST */
.doctor-history-list {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doctor-visit-card {
  padding: 15px;
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border-inline-start: 5px solid;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-fast);
}

.doctor-visit-card:hover {
  transform: translateY(-2px);
}

.doctor-visit-card.planned {
  border-inline-start-color: var(--color-blue-dark);
  background: linear-gradient(135deg, rgba(2, 136, 209, 0.03) 0%, var(--bg-card) 100%);
}

.doctor-visit-card.emergency {
  border-inline-start-color: var(--color-pink-dark);
  background: linear-gradient(135deg, rgba(233, 30, 99, 0.03) 0%, var(--bg-card) 100%);
}

.doctor-visit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.doctor-visit-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doctor-visit-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.doctor-visit-badge.planned {
  background: rgba(2, 136, 209, 0.1);
  color: var(--color-blue-dark);
}

.doctor-visit-badge.emergency {
  background: rgba(233, 30, 99, 0.1);
  color: var(--color-pink-dark);
}

.doctor-visit-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.doctor-visit-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
}

.doctor-visit-meta {
  display: flex;
  gap: 15px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.doctor-visit-notes {
  font-size: 0.85rem;
  color: #495057;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
  border-inline-start: 3px solid #dee2e6;
  margin-top: 5px;
}

.th-btn-delete-visit {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.th-btn-delete-visit:hover {
  background: rgba(233, 30, 99, 0.1);
}

/* DOCTOR VISITS CHRONOLOGICAL GROUPING */
.doctor-history-group {
  margin-bottom: 25px;
}

.doctor-history-group-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-color);
  margin-top: 0;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.doctor-history-group-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-footer {
  text-align: center;
  padding: 20px 10px 40px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: 30px;
}
.app-footer p {
  margin: 0;
  opacity: 0.8;
}
