/* ══════════════════════════════════════════════
   OXYGN Catering — App-Ready Styles
   Import AFTER style.css on every page:
   <link rel="stylesheet" href="app.css"/>
   
   Contains:
   1. Bottom Navigation
   2. Splash Screen
   3. App-like mobile UX polish
   4. PWA / standalone overrides
   5. Safe area inset support (iPhone X+)
══════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
   1. BOTTOM NAVIGATION (mobile only)
   Hidden on desktop via media query.
   Injects via script.js initBottomNav()
────────────────────────────────────────────── */

.app-bottom-nav {
  display: none; /* Hidden by default — shown on mobile below */
}

@media (max-width: 1024px) {
  .app-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 970;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(6, 15, 11, 0.97);
    border-top: 1px solid rgba(201, 168, 76, 0.15);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
  }

  .app-bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted, rgba(255,255,255,0.45));
    padding: 6px 4px 4px;
    position: relative;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    cursor: pointer;
    min-width: 0;
  }

  .app-bn-item.active {
    color: var(--gold, #c9a84c);
  }

  /* Active indicator dot above icon */
  .app-bn-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2.5px;
    background: var(--gold, #c9a84c);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.6);
  }

  /* Primary action button (Quote) */
  .app-bn-item.app-bn-primary {
    color: var(--gold, #c9a84c);
    position: relative;
  }

  .app-bn-item.app-bn-primary .app-bn-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #9a6f22, #f0d478, #c9a84c);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #080f0a;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(201, 168, 76, 0.45);
    margin-top: -14px; /* Lifts button above bar */
    border: 2.5px solid rgba(6, 15, 11, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .app-bn-item.app-bn-primary:active .app-bn-icon {
    transform: scale(0.93);
    box-shadow: 0 2px 10px rgba(201, 168, 76, 0.3);
  }

  .app-bn-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-bn-label {
    font-family: 'Cinzel', serif;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    transition: color 0.2s;
  }

  /* Tap feedback */
  .app-bn-item.app-bn-tap .app-bn-icon {
    transform: scale(0.85);
  }

  .app-bn-item:active .app-bn-icon {
    transform: scale(0.88);
  }

  /* Space below page content for bottom nav */
  body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Adjust WhatsApp float above bottom nav */
  .whatsapp-float {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Hide old mobile CTA bar when bottom nav is active —
     it's redundant. Keep it only on pages with no hero (non-index). */
  .mobile-cta-bar {
    display: none !important;
  }
}

/* On pages without a hero the old CTA bar was always visible.
   Bottom nav replaces it entirely on mobile. */
@media (min-width: 1025px) {
  .app-bottom-nav { display: none !important; }
}

/* ──────────────────────────────────────────────
   2. SPLASH SCREEN
   Shown only in standalone/PWA mode via JS.
   Normal browser: removed immediately by script.
────────────────────────────────────────────── */

#appSplash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--green-deep, #060f0b);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#appSplash.splash-hide {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.splash-logo {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  border: 2px solid rgba(201, 168, 76, 0.4);
  box-shadow: 0 0 60px rgba(201, 168, 76, 0.2);
  animation: splashPulse 1.8s ease-in-out infinite;
  object-fit: contain;
  background: var(--green-dark, #0a1a13);
  padding: 8px;
}

@keyframes splashPulse {
  0%, 100% { box-shadow: 0 0 60px rgba(201,168,76,0.2); }
  50%       { box-shadow: 0 0 90px rgba(201,168,76,0.45); }
}

.splash-brand {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gold, #c9a84c);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.splash-sub {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: var(--text-muted, rgba(255,255,255,0.4));
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.splash-loader {
  width: 48px;
  height: 2px;
  background: rgba(201, 168, 76, 0.15);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

.splash-loader::after {
  content: '';
  position: absolute;
  left: -50%;
  top: 0;
  width: 50%;
  height: 100%;
  background: var(--gold, #c9a84c);
  border-radius: 2px;
  animation: splashLoad 1.2s ease-in-out infinite;
}

@keyframes splashLoad {
  0%   { left: -50%; }
  100% { left: 150%; }
}

/* ──────────────────────────────────────────────
   3. APP-LIKE MOBILE UX POLISH
────────────────────────────────────────────── */

/* Smooth page-level scroll behavior (app-like) */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Prevent text selection on UI elements (app feel) */
.app-bottom-nav,
.btn,
.nav-logo,
.dash-nav-item,
.badge,
.statusBadge {
  -webkit-user-select: none;
  user-select: none;
}

/* Better touch targets for interactive elements */
@media (max-width: 1024px) {
  .btn         { min-height: 44px; }
  .btn-sm      { min-height: 38px; }
  .form-control{ min-height: 46px; font-size: 16px; }

  /* App-like card tap states */
  .dash-quote-card,
  .service-card,
  .review-card,
  .cal-event-row {
    -webkit-tap-highlight-color: transparent;
  }

  .dash-quote-card:active,
  .cal-event-row:active {
    transform: scale(0.985);
    transition: transform 0.12s ease;
  }

  /* Tighter section padding for app feel */
  .section { padding-top: 52px !important; padding-bottom: 52px !important; }

  /* Remove top navbar on standalone/PWA mode since bottom nav handles navigation */
}

/* ──────────────────────────────────────────────
   4. PWA / STANDALONE OVERRIDES
   Applied when launched as installed app
────────────────────────────────────────────── */

@media (display-mode: standalone) {
  /* Safe area for notched devices */
  body {
    padding-top: env(safe-area-inset-top, 0px);
  }

  #navbar {
    top: env(safe-area-inset-top, 0px);
    padding-left: max(52px, env(safe-area-inset-left, 0px));
    padding-right: max(52px, env(safe-area-inset-right, 0px));
  }

  /* Slightly larger touch targets in app mode */
  .app-bottom-nav { height: calc(64px + env(safe-area-inset-bottom, 0px)); }

  /* Remove sticky quote CTA (redundant in app) */
  .sticky-quote-cta { display: none !important; }
}

/* ──────────────────────────────────────────────
   5. SAFE AREA INSETS (iPhone X+ notch/home bar)
────────────────────────────────────────────── */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(60px + env(safe-area-inset-bottom));
  }

  @media (max-width: 1024px) {
    body {
      padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
  }
}

/* ──────────────────────────────────────────────
   6. INSTALL PROMPT BANNER (optional)
   Shown if app is installable (beforeinstallprompt)
   Toggle via JS: document.getElementById('installBanner').style.display = 'flex'
────────────────────────────────────────────── */

#installBanner {
  display: none;
  position: fixed;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  z-index: 960;
  background: var(--green-dark, #0a1a13);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 14px;
  padding: 14px 16px;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: installSlideUp 0.35s ease;
}

@keyframes installSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#installBanner.show { display: flex; }

.install-banner-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.install-banner-text {
  flex: 1;
  min-width: 0;
}

.install-banner-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--white, #f5f0e8);
  margin-bottom: 2px;
}

.install-banner-sub {
  font-size: 11px;
  color: var(--text-muted, rgba(255,255,255,0.45));
  line-height: 1.4;
}

.install-banner-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.install-banner-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

@media (min-width: 1025px) {
  #installBanner  { display: none !important; }
  #appSplash      { display: none !important; }
}