/* ═══════════════════════════════════════════════════════════════════════════
   app.css — Design System ITC Natal PWA
   Paleta: Navy #0D2137 + Gold #C9903A | Mobile-First
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --primary:       #0D2137;
  --primary-600:   #163352;
  --primary-400:   #1B4F8A;
  --primary-100:   #E8EEF5;
  --accent:        #C9903A;
  --accent-light:  #E8B558;
  --accent-pale:   #FDF3E3;

  --bg:            #F0F4F8;
  --surface:       #FFFFFF;
  --surface-2:     #F7F9FC;
  --border:        #E2E8F0;

  --text-100:      #1A2B3C;
  --text-200:      #4A5568;
  --text-300:      #8A9AB5;

  --success:       #10B981;
  --success-pale:  #D1FAE5;
  --warning:       #F59E0B;
  --warning-pale:  #FEF3C7;
  --danger:        #EF4444;
  --danger-pale:   #FEE2E2;
  --info:          #3B82F6;
  --info-pale:     #DBEAFE;

  --radius:        14px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --radius-pill:   999px;

  --shadow-sm:     0 2px 8px rgba(13,33,55,.06);
  --shadow:        0 4px 20px rgba(13,33,55,.1);
  --shadow-lg:     0 8px 40px rgba(13,33,55,.15);

  --nav-h:         64px;
  --topbar-h:      60px;
  --transition:    .2s ease;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-100);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }
a   { color: var(--accent); text-decoration: none; }

/* ─── PWA App Shell ──────────────────────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; min-height: 100dvh; }

/* Top Bar */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.topbar__logo {
  display: flex; align-items: center; gap: 10px;
}
.topbar__logo-text {
  font-size: 17px; font-weight: 800;
  color: var(--accent); letter-spacing: 1.5px;
}
.topbar__logo-sub { font-size: 9px; color: #8BA8C9; letter-spacing: 1px; }
.topbar__badge {
  position: relative;
  background: none; border: none; cursor: pointer; padding: 8px;
  color: #8BA8C9;
}
.topbar__badge .dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--primary);
}

/* Main Content */
.page-content {
  flex: 1;
  padding: 20px 16px calc(var(--nav-h) + 20px);
  max-width: 600px;
  width: 100%; margin: 0 auto;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  box-shadow: 0 -4px 20px rgba(13,33,55,.08);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--text-300);
  font-size: 10px; font-weight: 500;
  transition: color var(--transition);
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 3px;
  background: var(--accent); border-radius: 0 0 4px 4px;
}
.nav-badge {
  position: absolute; top: 8px; right: calc(50% - 18px);
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card--accent { border-left: 4px solid var(--accent); }
.card-body  { padding: 20px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-300); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.card-value { font-size: 26px; font-weight: 800; color: var(--primary); }

/* Dashboard Hero Card */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-400) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute; right: -20px; top: -20px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(201,144,58,.15);
}
.hero-card__greeting { font-size: 13px; color: #8BA8C9; margin-bottom: 4px; }
.hero-card__name     { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.hero-card__room     { font-size: 13px; color: var(--accent-light); }
.hero-card__date     { font-size: 12px; color: #8BA8C9; margin-top: 16px; }

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.feature-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.feature-card:active { transform: scale(.97); }
.feature-card::before {
  content: ''; position: absolute;
  bottom: 0; right: 0;
  width: 60px; height: 60px;
  border-radius: 50% 0 0 0;
  opacity: .05;
  background: var(--primary);
}
.feature-card__icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.feature-card__icon svg { width: 22px; height: 22px; }
.feature-card__label { font-size: 13px; font-weight: 600; color: var(--text-100); }
.feature-card__desc  { font-size: 11px; color: var(--text-300); margin-top: -6px; }
.feature-card__badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
}

/* Icon colors */
.icon--navy   { background: var(--primary-100); color: var(--primary); }
.icon--gold   { background: var(--accent-pale); color: var(--accent); }
.icon--green  { background: var(--success-pale); color: var(--success); }
.icon--blue   { background: var(--info-pale); color: var(--info); }
.icon--red    { background: var(--danger-pale); color: var(--danger); }
.icon--amber  { background: var(--warning-pale); color: var(--warning); }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-200); margin-bottom: 8px; }
.form-input {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
  color: var(--text-100);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,144,58,.15);
}
.form-hint { font-size: 12px; color: var(--text-300); margin-top: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn--primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 16px rgba(13,33,55,.25);
}
.btn--primary:active { background: var(--primary-600); transform: scale(.98); }
.btn--accent {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 16px rgba(201,144,58,.35);
}
.btn--accent:active { background: #B07E30; transform: scale(.98); }
.btn--outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn--ghost { background: transparent; color: var(--text-200); }
.btn--full { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* OTP Input */
.otp-group {
  display: flex; gap: 8px; justify-content: center;
  margin: 24px 0;
}
.otp-input {
  width: 48px; height: 56px;
  text-align: center; font-size: 24px; font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  caret-color: var(--accent);
}
.otp-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,144,58,.2);
}
.otp-input.filled { border-color: var(--primary); background: var(--primary-100); }

/* ─── Auth Pages ─────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.auth-header {
  background: var(--primary);
  padding: 60px 32px 40px;
  text-align: center;
  clip-path: ellipse(100% 100% at 50% 0%);
  padding-bottom: 56px;
}
.auth-logo { font-size: 32px; font-weight: 800; color: var(--accent); letter-spacing: 3px; }
.auth-logo-sub { font-size: 11px; color: #8BA8C9; letter-spacing: 2px; margin-top: 4px; }
.auth-body {
  flex: 1; padding: 32px 24px 40px;
  max-width: 440px; width: 100%; margin: -20px auto 0;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}
.auth-title { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-300); margin-bottom: 24px; }

/* ─── Alerts / Flash ─────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert--error   { background: var(--danger-pale);  color: #B91C1C; }
.alert--success { background: var(--success-pale); color: #065F46; }
.alert--info    { background: var(--info-pale);    color: #1D4ED8; }
.alert--warning { background: var(--warning-pale); color: #92400E; }

/* ─── Section Headers ────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--primary); }
.section-link  { font-size: 13px; color: var(--accent); font-weight: 500; }

/* ─── List Items ─────────────────────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.list-item__icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-size: 14px; font-weight: 600; color: var(--text-100); }
.list-item__sub   { font-size: 12px; color: var(--text-300); margin-top: 2px; }

/* ─── Status Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge--success { background: var(--success-pale); color: #065F46; }
.badge--warning { background: var(--warning-pale); color: #92400E; }
.badge--danger  { background: var(--danger-pale);  color: #B91C1C; }
.badge--info    { background: var(--info-pale);    color: #1D4ED8; }
.badge--neutral { background: var(--primary-100);  color: var(--primary); }

/* ─── PWA Install Banner ─────────────────────────────────────────────────── */
#install-banner {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 12px; right: 12px;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: slideUp .3s ease;
}
#install-banner img { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
#install-banner .text { flex: 1; }
#install-banner .text strong { font-size: 14px; color: #fff; display: block; }
#install-banner .text span   { font-size: 12px; color: #8BA8C9; }
#install-banner .actions { display: flex; gap: 8px; }
#install-banner .btn-install {
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
#install-banner .btn-dismiss {
  background: transparent; color: #8BA8C9;
  border: none; border-radius: 8px;
  padding: 8px; cursor: pointer; font-size: 20px; line-height: 1;
}

/* ─── Offline Indicator ──────────────────────────────────────────────────── */
#offline-bar {
  display: none; position: fixed;
  top: var(--topbar-h); left: 0; right: 0;
  background: var(--warning); color: #fff;
  font-size: 12px; font-weight: 600;
  text-align: center; padding: 6px;
  z-index: 99;
}
body.offline #offline-bar { display: block; }

/* ─── Loader ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.page-loader {
  position: fixed; inset: 0;
  background: var(--primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 999;
}
.page-loader .logo { font-size: 36px; font-weight: 800; color: var(--accent); letter-spacing: 3px; }
.page-loader .sub  { font-size: 11px; color: #8BA8C9; letter-spacing: 2px; margin-top: 6px; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse   { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

.fade-in    { animation: fadeIn .3s ease; }
.slide-up   { animation: slideUp .3s ease; }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.mt-4  { margin-top: 4px; }   .mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }  .mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-small  { font-size: 12px; }
.text-muted  { color: var(--text-300); }
.text-accent { color: var(--accent); }
.font-bold   { font-weight: 700; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .auth-body { margin-top: -28px; }
}
