/* Modern Minimalist Design System for Pregnancy Roadmap */
/* Less color count, zero/minimal gradients, high contrast, mobile optimized */

:root {
  --pico-font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --pico-font-size: 14px;
  --bg-main: #0b0f17;
  --bg-card: #111827;
  --bg-card-hover: #161f33;
  --bg-subtle: #1a2234;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.16);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #60a5fa;
  --accent-blue-subtle: rgba(59, 130, 246, 0.12);
  --accent-amber: #d97706;
  --accent-amber-subtle: rgba(217, 119, 6, 0.12);
  --accent-rose: #e11d48;
  --accent-rose-subtle: rgba(225, 29, 72, 0.12);
  --accent-emerald: #059669;
  --accent-emerald-subtle: rgba(5, 150, 105, 0.12);
  --accent-purple: #a855f7;
  --accent-purple-hover: #c084fc;
  --accent-purple-subtle: rgba(168, 85, 247, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-main) !important;
  color: var(--text-main) !important;
  font-family: var(--pico-font-family);
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  padding-bottom: 4rem;
}

/* ==========================================================================
   Header & Multi-Page Navigation Tabs
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(11, 15, 23, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 0;
  margin-bottom: 1.75rem;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 1.25rem;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 28px;
  height: 28px;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.brand-text .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 3 Navigation Tabs */
.nav-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none !important;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid var(--border-focus);
}

.nav-tab i {
  width: 15px;
  height: 15px;
}

/* Language Switcher */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-switcher {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
}

.lang-btn {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0;
  transition: all 0.15s ease;
}

.lang-btn.active {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid var(--border-focus);
}

/* ==========================================================================
   Layout Containers & Cards
   ========================================================================== */
.main-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.dashboard-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title h2 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

/* Metric Cards Grid - Clean, Flat, Minimalist */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.2s ease;
}

.metric-card:hover {
  border-color: var(--border-focus);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0.2rem 0;
}

.metric-value .dow-tag {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.metric-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Badges, Pills & Labels (Monochromatic Hierarchy)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.badge-blue {
  background: var(--accent-blue-subtle);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-amber {
  background: var(--accent-amber-subtle);
  color: #fcd34d;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-rose {
  background: var(--accent-rose-subtle);
  color: #fda4af;
  border: 1px solid rgba(225, 29, 72, 0.25);
}

.badge-emerald {
  background: var(--accent-emerald-subtle);
  color: #6ee7b7;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-purple {
  background: var(--accent-purple-subtle);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

@keyframes rowFlash {
  0% { background-color: rgba(59, 130, 246, 0.35); }
  100% { background-color: transparent; }
}

.highlight-flash {
  animation: rowFlash 2s ease-out;
}

.row-flight {
  background: rgba(59, 130, 246, 0.06) !important;
  border-left: 3px solid var(--accent-blue);
}

.row-arrival {
  background: rgba(16, 185, 129, 0.06) !important;
  border-left: 3px solid var(--accent-emerald);
}

.row-transition {
  background: rgba(245, 158, 11, 0.07) !important;
  border-left: 3px solid var(--accent-amber);
}

.row-workday {
  background: rgba(16, 185, 129, 0.10) !important;
  border-left: 3px solid #10b981;
}

/* Timeline Track & Nodes - Clean, Flat, Minimalist */
.timeline-track-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.timeline-track {
  position: relative;
  margin: 1.5rem 0 1rem;
  padding: 0.5rem 0;
  min-width: 800px;
}

.timeline-track-bar {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  transform: translateY(-50%);
  z-index: 1;
}

.timeline-progress-bar {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--accent-blue);
  border-radius: var(--radius-full);
  transform: translateY(-50%);
  z-index: 2;
}

.timeline-nodes {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 3;
}

.timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 110px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.timeline-node:hover {
  transform: translateY(-2px);
}

.node-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.45rem;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.node-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 0.15rem;
}

.node-date {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Chart Canvas Wrapper & Date Toolbar */
.chart-scroll-container {
  width: 100%;
  max-width: 100%;
  position: relative;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 540px;
  margin-top: 0.5rem;
}

.chart-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.76rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.chart-date-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}

.date-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.live-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-blue-hover);
  box-shadow: 0 0 6px var(--accent-blue);
  flex-shrink: 0;
}

.date-chips-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.76rem;
}

.chip-label {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.25rem;
}

.date-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.date-chip:hover {
  border-color: var(--accent-blue);
  color: #ffffff;
}

.chart-controls-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.toggle-control input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Callout Cards */
.callout {
  background: var(--bg-subtle);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-main);
}

.callout.warning {
  border-left-color: var(--accent-amber);
  background: rgba(217, 119, 6, 0.06);
}

.callout.danger {
  border-left-color: var(--accent-rose);
  background: rgba(225, 29, 72, 0.06);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* ==========================================================================
   Responsive Tables
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
  margin: 0;
}

thead th {
  background-color: var(--bg-subtle) !important;
  color: var(--text-muted) !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  white-space: nowrap;
}

tbody td {
  padding: 0.75rem 1rem !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  color: var(--text-main) !important;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none !important;
}

tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

/* ==========================================================================
   Interactive Toolbars, Filters & Search
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
}

.filter-chip.active {
  background: #1e293b;
  border-color: var(--accent-blue);
  color: #ffffff;
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  max-width: 260px;
  outline: none;
  transition: border-color 0.15s ease;
  margin: 0;
}

.search-input:focus {
  border-color: var(--accent-blue);
}

/* ==========================================================================
   Risk Cards & Grid
   ========================================================================== */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.risk-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.risk-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.risk-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.risk-card-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.risk-mitigation {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-main);
  border-left: 2px solid var(--accent-blue);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Chronotherapy / Timeline Grid
   ========================================================================== */
.chronotherapy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.chrono-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.chrono-time {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-blue-hover);
  margin-bottom: 0.35rem;
}

.chrono-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.chrono-items {
  font-size: 0.8rem;
  color: var(--text-main);
  line-height: 1.45;
  margin: 0;
  padding-left: 1.15rem;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
@media (max-width: 900px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .nav-tabs {
    overflow-x: auto;
    width: 100%;
    justify-content: flex-start;
    padding: 3px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .nav-tab {
    padding: 0.32rem 0.65rem;
    font-size: 0.74rem;
  }
  .header-controls {
    justify-content: flex-end;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input {
    max-width: 100%;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }
  .app-header, .filter-bar {
    display: none !important;
  }
  .dashboard-section, .metric-card, .risk-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .section-title h2, .metric-value, .risk-card-title {
    color: #0f172a !important;
  }
  thead th {
    background: #f1f5f9 !important;
    color: #334155 !important;
  }
  tbody td {
    color: #1e293b !important;
  }
}
