/* ============================================================
   UTMESchools v2 — shared.css
   Design system. Linked by EVERY page.
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --navy:        #0B2545;
  --navy-light:  #163461;
  --orange:      #FF6B35;
  --orange-dark: #E2531F;
  --gold:        #FFD23F;
  --green:       #0FA968;
  --green-dark:  #0A8A55;
  --paper:       #F7F5F0;
  --paper-dim:   #EFEBE0;
  --ink:         #0B2545;
  --ink-soft:    #5C6B82;
  --line:        #E0DCD0;
  --white:       #FFFFFF;
  --red:         #C0392B;
  --amber:       #E67E22;

  --font-display: 'Sora', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-pill: 99px;

  --shadow-card: 0 1px 2px rgba(11,37,69,0.06), 0 4px 14px -8px rgba(11,37,69,0.16);
  --shadow-lift: 0 12px 30px -14px rgba(11,37,69,0.3);

  --appbar-h: 52px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  border: none;
  outline: none;
  background: none;
}
ul, ol { list-style: none; }

/* ---- App Bar ---- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--appbar-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.appbar-back,
.appbar-burger {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.appbar-back:hover,
.appbar-burger:hover { background: rgba(255,255,255,0.2); }
.appbar-back:active,
.appbar-burger:active { background: rgba(255,255,255,0.3); }
.appbar-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.appbar-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.appbar-logo-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.appbar-logo-text span { color: var(--gold); }

/* ---- Hamburger Menu ---- */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11,37,69,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.menu-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.menu-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 78%;
  max-width: 300px;
  background: var(--white);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.menu-overlay.open .menu-panel {
  transform: translateX(0);
}
.menu-header {
  background: var(--navy);
  padding: 20px 16px 16px;
  flex-shrink: 0;
}
.menu-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}
.menu-brand span { color: var(--gold); }
.menu-tagline {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}
.menu-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}
.menu-nav {
  flex: 1;
  padding: 12px 0;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.menu-item:hover { background: var(--paper); }
.menu-item.active {
  background: #EEF4FF;
  color: var(--navy);
  font-weight: 600;
}
.menu-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.menu-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 16px;
}
.menu-footer {
  padding: 16px;
  font-size: 12px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--orange);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-green {
  background: var(--green);
  color: #fff;
}
.btn-green:hover { background: var(--green-dark); }
.btn-navy {
  background: var(--navy);
  color: #fff;
}
.btn-navy:hover { background: var(--navy-light); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--navy);
}
.btn-ghost:hover { background: var(--paper-dim); }
.btn-ghost-white {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
}
.btn-ghost-white:hover { background: rgba(255,255,255,0.1); }
.btn-sm {
  font-size: 13px;
  padding: 7px 14px;
}
.btn-block { width: 100%; }
.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

/* ---- Form Elements ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.form-input {
  width: 100%;
  background: var(--paper-dim);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color 0.15s;
}
.form-input:focus {
  border-color: var(--navy);
  background: var(--white);
}
.form-group.has-error .form-input {
  border-color: var(--red);
}
.form-error {
  font-size: 12px;
  color: var(--red);
  display: none;
}
.form-group.has-error .form-error { display: block; }

/* ---- Select ---- */
.cr-select {
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  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='%235C6B82' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.cr-select:focus { border-color: var(--navy); }

/* ---- Toggle Switch ---- */
.switch {
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--line);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.switch.on {
  background: var(--green);
}
.switch.on::after {
  transform: translateX(18px);
}

/* ---- Bottom Sheets ---- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(11,37,69,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  display: flex;
  align-items: flex-end;
}
.sheet-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.sheet {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sheet-overlay.open .sheet {
  transform: translateY(0);
}
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 10px auto 0;
  flex-shrink: 0;
}
.sheet-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  padding: 12px 16px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--white);
}
.sheet-footer .btn { flex: 1; }

/* ---- Sheet Items (checkbox rows) ---- */
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item:hover { background: var(--paper); }
.sheet-item:active { background: var(--paper-dim); }
.sheet-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}
.sheet-checkbox.checked {
  background: var(--navy);
  border-color: var(--navy);
}
.sheet-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
}

/* ---- Search input ---- */
.sheet-search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sheet-search input {
  width: 100%;
  background: var(--paper-dim);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 14px;
  color: var(--ink);
}
.sheet-search input:focus { border-color: var(--navy); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Dialog Overlay ---- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(11,37,69,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.dialog-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.dialog {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-lift);
  transform: scale(0.95);
  transition: transform 0.2s;
}
.dialog-overlay.open .dialog {
  transform: scale(1);
}
.dialog-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.dialog-body {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 20px;
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  gap: 10px;
}
.dialog-actions .btn { flex: 1; }

/* ---- Calculator Overlay ---- */
.calc-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(11,37,69,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.calc-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.calc-panel {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 400px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.calc-overlay.open .calc-panel {
  transform: translateY(0);
}
.calc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.calc-top-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.calc-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ink);
}
.calc-display {
  padding: 16px 20px 10px;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  min-height: 60px;
  word-break: break-all;
  background: var(--paper);
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
.calc-btn {
  background: var(--white);
  padding: 16px 8px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
  user-select: none;
}
.calc-btn:active { background: var(--paper-dim); }
.calc-btn.op {
  color: var(--navy);
  font-size: 20px;
}
.calc-btn.fn {
  background: var(--paper-dim);
  color: var(--ink-soft);
  font-size: 15px;
}
.calc-btn.eq {
  background: var(--orange);
  color: #fff;
}
.calc-btn.eq:active { background: var(--orange-dark); }
.calc-btn.del {
  background: #FFF0EB;
  color: var(--orange-dark);
}
.calc-btn.clr {
  background: #FFF0EB;
  color: var(--red);
}

/* ---- Page wrapper ---- */
.page-body {
  padding: 16px;
  max-width: 680px;
  margin: 0 auto;
}

/* ---- Section headers ---- */
.section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.empty-state-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-state-body {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 260px;
  margin: 0 auto;
}

/* ---- Paid / Free badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-gold { background: var(--gold); color: var(--navy); }
.badge-green { background: #D4F6E8; color: #0A6B40; }
.badge-red { background: #FDECEA; color: var(--red); }
.badge-amber { background: #FFF3E0; color: #A05C00; }
.badge-navy { background: var(--navy); color: #fff; }
.badge-grey { background: var(--paper-dim); color: var(--ink-soft); }

/* ---- Progress bar ---- */
.progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--paper-dim);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--white);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: var(--appbar-h);
  z-index: 90;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tab.active {
  color: var(--navy);
  border-bottom-color: var(--orange);
}

/* ---- Mode toggle ---- */
.mode-toggle {
  display: flex;
  background: var(--paper-dim);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.mode-toggle button {
  flex: 1;
  padding: 7px 10px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mode-toggle button.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 6px rgba(11,37,69,0.18);
}

/* ---- Paywall card ---- */
.paywall-card {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  color: #fff;
  margin: 16px;
}
.paywall-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}
.paywall-card p {
  font-size: 13.5px;
  opacity: 0.85;
  margin-bottom: 16px;
  line-height: 1.5;
}
.paywall-price {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 16px;
}

/* Paid users: hide paywall elements */
body.user-paid .paywall-element { display: none !important; }

/* ---- Floating WhatsApp button ---- */
.wa-float {
  position: fixed;
  bottom: 20px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #25D366;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 400;
  font-size: 28px;
  text-decoration: none;
  transition: transform 0.15s;
}
.wa-float:active { transform: scale(0.93); }

/* ---- Utility ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-soft { color: var(--ink-soft); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.hidden { display: none !important; }

/* ---- Safe area for phones ---- */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .page-body { padding: 20px 24px; }
}
@media (min-width: 980px) {
  .page-body { padding: 28px 32px; }
  }
  
