/* =============================================
   HebrewKids.app — Global Design System
   Mobile-first, PWA-ready
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --gold: #C9A84C;
  --gold-light: #F5E6C0;
  --gold-pale: #FDF8EE;
  --navy: #1A2744;
  --navy-mid: #2C3E6B;
  --blue: #3B5BA5;
  --sky: #E8F0FF;
  --teal: #1D9E75;
  --teal-light: #E1F5EE;
  --purple: #7F77DD;
  --purple-light: #EEEDFE;
  --purple-dark: #3C3489;
  --coral: #D85A30;
  --coral-light: #FAECE7;
  --text: #1A1A2E;
  --muted: #5A6072;
  --border: #EBEBF0;
  --bg: #F7F7FB;
  --white: #ffffff;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-h: 64px;
  --bottom-nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

h1, h2, h3, h4 { font-family: 'DM Serif Display', Georgia, serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---- UTILITY ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 26px; border-radius: 40px; font-size: 15px; font-weight: 500; border: none; cursor: pointer; transition: all .2s; text-decoration: none; -webkit-user-select: none; user-select: none; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-mid); }
.btn-navy:active { transform: scale(0.97); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #b8943f; }
.btn-gold:active { transform: scale(0.97); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn-full { width: 100%; }

/* ---- CARDS ---- */
.card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.card-pad { padding: 20px; }

/* ---- BADGES ---- */
.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.badge-gold { background: var(--gold-light); color: #7A5C1A; }
.badge-purple { background: var(--purple-light); color: var(--purple-dark); }
.badge-teal { background: var(--teal-light); color: #085041; }
.badge-navy { background: var(--sky); color: var(--navy-mid); }

/* ---- FORM ELEMENTS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input { width: 100%; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-md); font-size: 15px; color: var(--text); background: var(--white); outline: none; transition: border-color .2s; -webkit-appearance: none; }
.form-input:focus { border-color: var(--purple); }
.form-select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235A6072' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }

/* ---- MOBILE NAV (bottom) ---- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--bottom-nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); background: var(--white); border-top: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-around; padding-top: 8px; z-index: 100; display: none; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; transition: all .2s; flex: 1; }
.bottom-nav-item .nav-icon { font-size: 22px; }
.bottom-nav-item .nav-label { font-size: 10px; color: var(--muted); font-weight: 500; }
.bottom-nav-item.active .nav-label { color: var(--purple); }
.bottom-nav-item.active .nav-icon { transform: translateY(-1px); }

/* ---- TOP BAR (mobile) ---- */
.mobile-topbar { position: sticky; top: 0; z-index: 90; background: var(--white); border-bottom: 1px solid var(--border); height: 56px; display: none; align-items: center; padding: 0 16px; justify-content: space-between; }
.mobile-topbar .logo { font-family: 'DM Serif Display', serif; font-size: 18px; color: var(--navy); }
.mobile-topbar .logo span { color: var(--gold); }

/* ---- DESKTOP SIDEBAR ---- */
.app-layout { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: 240px; background: var(--navy); min-height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; padding: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }

/* ---- RESPONSIVE BREAKPOINTS ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .mobile-topbar { display: flex; }
  .desktop-only { display: none !important; }
  .main-content { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px); }
}
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
  .mobile-topbar { display: none !important; }
}

/* ---- PROGRESS RING ---- */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: var(--border); }
.progress-ring-fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset .4s; }

/* ---- HEBREW TEXT ---- */
.hebrew { direction: rtl; font-weight: 700; color: var(--purple-dark); }
.hebrew-lg { font-size: 28px; line-height: 1.2; }
.hebrew-xl { font-size: 48px; line-height: 1.1; }
.hebrew-hero { font-size: 72px; line-height: 1; opacity: 0.12; }

/* ---- ANIMATIONS ---- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes bounce-dot { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-up { animation: fadeUp .4s ease both; }
.fade-up-2 { animation: fadeUp .4s .1s ease both; }
.fade-up-3 { animation: fadeUp .4s .2s ease both; }

/* ---- SKELETON LOADER ---- */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, #f5f5f5 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- PWA INSTALL BANNER ---- */
.pwa-banner { position: fixed; bottom: calc(var(--bottom-nav-h) + 12px + var(--safe-bottom)); left: 12px; right: 12px; background: var(--navy); color: #fff; border-radius: var(--radius-md); padding: 14px 16px; display: flex; align-items: center; gap: 12px; z-index: 200; box-shadow: 0 8px 32px rgba(0,0,0,0.2); transform: translateY(20px); opacity: 0; transition: all .3s; pointer-events: none; }
.pwa-banner.show { transform: translateY(0); opacity: 1; pointer-events: all; }
.pwa-banner-text { flex: 1; font-size: 13px; line-height: 1.4; }
.pwa-banner-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.pwa-banner-btn { background: var(--gold); color: var(--navy); border: none; padding: 8px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.pwa-banner-close { background: none; border: none; color: rgba(255,255,255,0.5); font-size: 20px; padding: 4px; cursor: pointer; flex-shrink: 0; }
