/* ============================================
   Mon Suivi Grossesse — Pastel Design System
   ============================================ */

:root {
  --grs-primary: #E8A0BF;
  --grs-primary-dark: #D47FA8;
  --grs-primary-light: #F3C8DC;
  --grs-secondary: #BA90C6;
  --grs-secondary-light: #D4BAE0;
  --grs-accent: #C0DBEA;
  --grs-accent-dark: #93C5D8;
  --grs-success: #7EC8A0;
  --grs-success-dark: #5BB585;
  --grs-warm: #FFF3E4;
  --grs-danger: #E57373;
  --grs-danger-light: #FFCDD2;
  --grs-warning: #FFB74D;
  --grs-warning-light: #FFE0B2;
  --grs-text: #2D2D2D;
  --grs-text-light: #6B6B6B;
  --grs-text-muted: #9E9E9E;
  --grs-bg: #FFF9F5;
  --grs-card: #FFFFFF;
  --grs-border: #F0E6E0;
  --grs-radius: 16px;
  --grs-radius-sm: 10px;
  --grs-radius-full: 50px;
  --grs-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --grs-shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --grs-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --grs-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --grs-nav-height: 64px;
  --grs-header-height: 56px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--grs-font);
  background: var(--grs-bg);
  color: var(--grs-text);
  line-height: 1.6;
  min-height: 100dvh;
  padding-bottom: calc(var(--grs-nav-height) + 16px);
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; color: var(--grs-text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; }
p { margin-bottom: 0.5rem; }
a { color: var(--grs-primary-dark); text-decoration: none; }

/* ---- App Header ---- */
.grs-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--grs-card);
  border-bottom: 1px solid var(--grs-border);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  height: var(--grs-header-height);
}
.grs-header-back {
  width: 36px; height: 36px; border: none; background: none;
  font-size: 1.3rem; cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--grs-transition);
}
.grs-header-back:hover { background: var(--grs-warm); }
.grs-header-title { font-size: 1.1rem; font-weight: 600; flex: 1; }
.grs-header-logo {
  font-size: 1.4rem; display: flex; align-items: center; gap: 8px;
}

/* ---- Bottom Navigation ---- */
.grs-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--grs-card);
  border-top: 1px solid var(--grs-border);
  display: flex; justify-content: space-around; align-items: center;
  height: var(--grs-nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.grs-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border: none; background: none; cursor: pointer;
  color: var(--grs-text-muted); font-size: 0.65rem; font-weight: 500;
  transition: color var(--grs-transition);
  min-width: 56px; position: relative;
  font-family: var(--grs-font);
}
.grs-nav-item .nav-icon { font-size: 1.4rem; line-height: 1; }
.grs-nav-item.active { color: var(--grs-primary-dark); }
.grs-nav-item.active .nav-icon { transform: scale(1.1); }
.grs-nav-item .nav-badge {
  position: absolute; top: 2px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grs-secondary);
}

/* ---- Screens ---- */
.grs-screen {
  display: none; padding: 16px; max-width: 600px; margin: 0 auto;
  animation: screenFadeIn 0.3s ease;
}
.grs-screen.active { display: block; }

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Cards ---- */
.grs-card {
  background: var(--grs-card);
  border-radius: var(--grs-radius);
  padding: 16px;
  box-shadow: var(--grs-shadow);
  margin-bottom: 12px;
  border: 1px solid var(--grs-border);
}
.grs-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.grs-card-icon { font-size: 1.5rem; }
.grs-card-title { font-size: 1rem; font-weight: 600; }

/* ---- Progress Bar ---- */
.grs-progress {
  width: 100%; height: 10px;
  background: var(--grs-border);
  border-radius: var(--grs-radius-full);
  overflow: hidden; margin: 8px 0;
}
.grs-progress-fill {
  height: 100%; border-radius: var(--grs-radius-full);
  background: linear-gradient(90deg, var(--grs-primary-light), var(--grs-primary));
  transition: width 0.5s ease;
}

/* ---- Buttons ---- */
.grs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: var(--grs-radius-full);
  font-family: var(--grs-font); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all var(--grs-transition);
  text-decoration: none;
}
.grs-btn-primary {
  background: var(--grs-primary);
  color: #fff;
}
.grs-btn-primary:hover { background: var(--grs-primary-dark); transform: translateY(-1px); }
.grs-btn-secondary {
  background: var(--grs-warm);
  color: var(--grs-text);
}
.grs-btn-secondary:hover { background: var(--grs-primary-light); }
.grs-btn-outline {
  background: transparent;
  border: 2px solid var(--grs-primary);
  color: var(--grs-primary-dark);
}
.grs-btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.grs-btn-block { width: 100%; }
.grs-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Forms ---- */
.grs-input-group { margin-bottom: 16px; }
.grs-label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--grs-text-light); margin-bottom: 6px;
}
.grs-input, .grs-select {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--grs-border);
  border-radius: var(--grs-radius-sm);
  font-family: var(--grs-font); font-size: 1rem;
  background: var(--grs-card); color: var(--grs-text);
  transition: border-color var(--grs-transition);
}
.grs-input:focus, .grs-select:focus {
  outline: none;
  border-color: var(--grs-primary);
  box-shadow: 0 0 0 3px rgba(232, 160, 191, 0.2);
}

/* ---- Badges ---- */
.grs-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--grs-radius-full);
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.02em;
}
.grs-badge-ok { background: #E8F5E9; color: #2E7D32; }
.grs-badge-attention { background: var(--grs-warning-light); color: #E65100; }
.grs-badge-interdit { background: var(--grs-danger-light); color: #C62828; }
.grs-badge-trimestre { background: var(--grs-accent); color: #1565C0; }
.grs-badge-premium {
  background: linear-gradient(135deg, var(--grs-secondary), var(--grs-primary));
  color: #fff;
}
.grs-badge-free { background: var(--grs-success); color: #fff; }

/* ---- Search ---- */
.grs-search-wrap {
  position: relative; margin-bottom: 12px;
}
.grs-search-input {
  width: 100%; padding: 14px 16px 14px 44px;
  border: 2px solid var(--grs-border);
  border-radius: var(--grs-radius-full);
  font-family: var(--grs-font); font-size: 1rem;
  background: var(--grs-card);
  transition: border-color var(--grs-transition);
}
.grs-search-input:focus {
  outline: none;
  border-color: var(--grs-primary);
}
.grs-search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; color: var(--grs-text-muted); pointer-events: none;
}

/* ---- Chips / Filter Tags ---- */
.grs-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.grs-chips::-webkit-scrollbar { display: none; }
.grs-chip {
  flex-shrink: 0; padding: 6px 14px;
  border-radius: var(--grs-radius-full);
  border: 1.5px solid var(--grs-border);
  background: var(--grs-card);
  font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all var(--grs-transition);
  font-family: var(--grs-font);
}
.grs-chip.active {
  background: var(--grs-primary);
  color: #fff; border-color: var(--grs-primary);
}

/* ---- Food Item ---- */
.grs-food-item {
  background: var(--grs-card);
  border-radius: var(--grs-radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--grs-border);
  display: flex; align-items: flex-start; gap: 12px;
}
.grs-food-status {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.grs-food-status.ok { background: #E8F5E9; }
.grs-food-status.attention { background: var(--grs-warning-light); }
.grs-food-status.interdit { background: var(--grs-danger-light); }
.grs-food-name { font-weight: 600; font-size: 0.95rem; }
.grs-food-reason { font-size: 0.8rem; color: var(--grs-text-light); margin-top: 2px; }
.grs-food-alt {
  font-size: 0.8rem; color: var(--grs-success-dark); margin-top: 4px;
  font-style: italic;
}

/* ---- Timeline (Calendar) ---- */
.grs-timeline { position: relative; padding-left: 28px; }
.grs-timeline::before {
  content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: var(--grs-border);
}
.grs-timeline-item {
  position: relative; margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--grs-card);
  border-radius: var(--grs-radius-sm);
  border: 1px solid var(--grs-border);
}
.grs-timeline-item::before {
  content: ''; position: absolute; left: -22px; top: 16px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--grs-primary-light);
  border: 2px solid var(--grs-primary);
}
.grs-timeline-item.done::before { background: var(--grs-success); border-color: var(--grs-success-dark); }
.grs-timeline-item.past::before { background: var(--grs-text-muted); border-color: var(--grs-text-muted); }
.grs-timeline-date {
  font-size: 0.75rem; color: var(--grs-text-muted);
  font-weight: 600; text-transform: uppercase;
}
.grs-timeline-title { font-weight: 600; margin-top: 2px; }
.grs-timeline-desc { font-size: 0.85rem; color: var(--grs-text-light); margin-top: 2px; }
.grs-timeline-check {
  position: absolute; right: 12px; top: 12px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--grs-border);
  background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: transparent;
  transition: all var(--grs-transition);
}
.grs-timeline-check.checked {
  background: var(--grs-success); border-color: var(--grs-success);
  color: #fff;
}

/* ---- Week Card ---- */
.grs-week-card {
  background: var(--grs-card);
  border-radius: var(--grs-radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--grs-border);
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: all var(--grs-transition);
}
.grs-week-card:hover { border-color: var(--grs-primary-light); }
.grs-week-card.current {
  border-color: var(--grs-primary);
  background: linear-gradient(135deg, #FFF9F5, #FFF0F5);
  box-shadow: var(--grs-shadow);
}
.grs-week-emoji { font-size: 2rem; }
.grs-week-info { flex: 1; }
.grs-week-number { font-size: 0.75rem; font-weight: 700; color: var(--grs-primary-dark); text-transform: uppercase; }
.grs-week-size { font-size: 0.85rem; color: var(--grs-text-light); }

/* ---- Onboarding Modal ---- */
.grs-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.3s ease;
}
.grs-modal-overlay.hidden { display: none; }
.grs-modal {
  background: var(--grs-card);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 400px; width: 100%;
  box-shadow: var(--grs-shadow-lg);
  animation: modalSlideUp 0.35s ease;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.grs-modal h2 { text-align: center; margin-bottom: 8px; }
.grs-modal p { text-align: center; color: var(--grs-text-light); margin-bottom: 20px; font-size: 0.9rem; }

/* ---- Onboarding Mode Selector ---- */
.grs-mode-selector {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.grs-mode-btn {
  flex: 1; padding: 10px 8px;
  border: 2px solid var(--grs-border);
  border-radius: var(--grs-radius-sm);
  background: var(--grs-card);
  font-family: var(--grs-font); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; text-align: center;
  transition: all var(--grs-transition);
}
.grs-mode-btn.active {
  border-color: var(--grs-primary);
  background: #FFF0F5;
  color: var(--grs-primary-dark);
}

/* ---- Premium Overlay ---- */
.grs-premium-wall {
  text-align: center; padding: 40px 20px;
}
.grs-premium-wall .lock-icon { font-size: 3rem; margin-bottom: 12px; }
.grs-premium-wall h3 { margin-bottom: 8px; }
.grs-premium-wall p { color: var(--grs-text-light); font-size: 0.9rem; margin-bottom: 20px; }
.grs-premium-benefits {
  text-align: left; margin: 16px 0 24px;
  list-style: none;
}
.grs-premium-benefits li {
  padding: 6px 0; font-size: 0.9rem;
  display: flex; align-items: center; gap: 8px;
}
.grs-premium-benefits li::before { content: '✓'; color: var(--grs-success); font-weight: 700; }
.grs-premium-pricing {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.grs-premium-option {
  flex: 1; padding: 14px 10px;
  border: 2px solid var(--grs-border);
  border-radius: var(--grs-radius);
  text-align: center; cursor: pointer;
  transition: all var(--grs-transition);
  text-decoration: none; color: var(--grs-text);
}
.grs-premium-option:hover { border-color: var(--grs-primary); }
.grs-premium-option.recommended {
  border-color: var(--grs-primary);
  background: #FFF0F5;
}
.grs-premium-option .price { font-size: 1.3rem; font-weight: 700; color: var(--grs-primary-dark); }
.grs-premium-option .period { font-size: 0.75rem; color: var(--grs-text-light); }
.grs-premium-option .save {
  display: inline-block; margin-top: 4px;
  font-size: 0.7rem; font-weight: 600;
  color: var(--grs-success-dark);
  background: #E8F5E9; padding: 2px 8px;
  border-radius: var(--grs-radius-full);
}

.grs-license-form {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--grs-border);
}
.grs-license-form p { font-size: 0.8rem; color: var(--grs-text-muted); margin-bottom: 8px; }
.grs-license-row {
  display: flex; gap: 8px;
}
.grs-license-row input {
  flex: 1; padding: 10px 12px;
  border: 2px solid var(--grs-border);
  border-radius: var(--grs-radius-sm);
  font-family: var(--grs-font); font-size: 0.9rem;
}
.grs-license-row button {
  padding: 10px 16px;
  background: var(--grs-secondary);
  color: #fff; border: none;
  border-radius: var(--grs-radius-sm);
  font-family: var(--grs-font); font-weight: 600;
  cursor: pointer;
}
.grs-license-msg { font-size: 0.8rem; margin-top: 6px; }
.grs-license-msg.success { color: var(--grs-success-dark); }
.grs-license-msg.error { color: var(--grs-danger); }

/* ---- Quick Actions Grid ---- */
.grs-actions {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin: 16px 0;
}
.grs-action {
  background: var(--grs-card);
  border: 1px solid var(--grs-border);
  border-radius: var(--grs-radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--grs-transition);
  text-decoration: none; color: var(--grs-text);
}
.grs-action:hover { border-color: var(--grs-primary-light); transform: translateY(-2px); box-shadow: var(--grs-shadow); }
.grs-action-icon { font-size: 1.8rem; margin-bottom: 6px; }
.grs-action-label { font-size: 0.8rem; font-weight: 600; }

/* ---- Drawer (More menu) ---- */
.grs-drawer-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.3);
  display: none;
  animation: modalFadeIn 0.2s ease;
}
.grs-drawer-overlay.active { display: block; }
.grs-drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 301;
  background: var(--grs-card);
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.grs-drawer.active { transform: translateY(0); }
.grs-drawer-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--grs-border); margin: 0 auto 16px;
}
.grs-drawer-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 8px; border-radius: var(--grs-radius-sm);
  cursor: pointer; transition: background var(--grs-transition);
  border: none; background: none; width: 100%;
  font-family: var(--grs-font); font-size: 0.95rem;
  color: var(--grs-text); text-decoration: none;
}
.grs-drawer-item:hover { background: var(--grs-warm); }
.grs-drawer-item .drawer-icon { font-size: 1.3rem; width: 28px; text-align: center; }

/* ---- Empty State ---- */
.grs-empty {
  text-align: center; padding: 40px 20px;
  color: var(--grs-text-muted);
}
.grs-empty-icon { font-size: 3rem; margin-bottom: 8px; }
.grs-empty p { font-size: 0.9rem; }

/* ---- Info Box ---- */
.grs-info {
  background: var(--grs-accent);
  border-radius: var(--grs-radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  color: #1A5276;
}
.grs-warning-box {
  background: var(--grs-warning-light);
  border-radius: var(--grs-radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  color: #E65100;
}

/* ---- Install Banner ---- */
.grs-install-banner {
  background: linear-gradient(135deg, var(--grs-primary-light), var(--grs-accent));
  border-radius: var(--grs-radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.grs-install-banner .install-text { flex: 1; font-size: 0.85rem; font-weight: 500; }
.grs-install-banner .install-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.6);
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}

/* ---- YMYL Disclaimer ---- */
.grs-disclaimer {
  background: var(--grs-warm);
  border-radius: var(--grs-radius-sm);
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--grs-text-light);
  margin-top: 16px;
  line-height: 1.5;
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-muted { color: var(--grs-text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 8px; }
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .grs-actions { grid-template-columns: repeat(3, 1fr); }
  body { padding-bottom: 80px; }
}

/* ---- PWA Standalone Tweaks ---- */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top, 0); }
  .grs-header { padding-top: env(safe-area-inset-top, 0); }
}
