/* ═══════════════════════════════════════════════════════════════
   APP SHELL MODE
   Loaded on every page, inert until <html> carries .app-shell-active
   (set by assets/js/app-mode.js before first paint when the page is
   running inside the installed PWA / Android WebView APK).

   Zero new colors / fonts / radii — every value below is one of the
   custom properties already defined at the top of index.css.
   ═══════════════════════════════════════════════════════════════ */

/* #app-home is injected on every page via components/app-home.php
   but must never appear during normal desktop/mobile-web browsing */
#app-home { display: none; }

html.app-shell-active body {
    background: var(--bg-dark);
}

/* Hide the website chrome + marketing sections — the APK is a task
   surface, not a scrolling brochure */
html.app-shell-active #route-rail,
html.app-shell-active #site-nav,
html.app-shell-active .hero,
html.app-shell-active #why-us,
html.app-shell-active #estimator,
html.app-shell-active #destinations,
html.app-shell-active #deals,
html.app-shell-active #fleet,
html.app-shell-active #voices,
html.app-shell-active footer {
    display: none !important;
}

html.app-shell-active #app-home {
    display: block;
    max-width: 560px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(96px + env(safe-area-inset-bottom, 0px));
    animation: appFadeIn 0.5s var(--ease-out);
}

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

/* ── Top Bar / Greeting ── */
.app-topbar { padding-bottom: 4px; }

.app-topbar-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.app-greeting-eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-inverse-muted);
    margin-bottom: 6px;
}

.app-greeting-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-inverse);
    margin: 0;
}

.app-avatar-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    color: var(--text-inverse);
    transition: transform 0.2s var(--ease-spring), background 0.2s ease;
}
.app-avatar-btn:active { transform: scale(0.92); }
.app-avatar-btn i { width: 19px; height: 19px; }

.app-context-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.app-context-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-full);
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    color: var(--text-inverse-muted);
    font-size: 12px;
    font-weight: 600;
}
.app-context-chip i { width: 13px; height: 13px; color: var(--accent-light); }

.app-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.app-search-bar i { width: 18px; height: 18px; color: var(--text-inverse-muted); flex-shrink: 0; }
.app-search-bar input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--text-inverse);
}
.app-search-bar input::placeholder { color: var(--text-inverse-muted); }

/* ── Generic section rhythm ── */
.app-section { margin-top: 30px; }

.app-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.app-section-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 500;
    color: var(--text-inverse);
    margin: 0;
}

.app-section-link {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-light);
    text-decoration: none;
}

/* ── Main Action Cards ── */
.app-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.app-action-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 18px 16px;
    border-radius: var(--radius-lg);
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.18s var(--ease-spring), box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
.app-action-card:active { transform: scale(0.96); }

/* subtle gradient wash unique to each card, built only from existing tokens */
.app-action-card::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.5;
    background: radial-gradient(120px 90px at 85% -10%, var(--accent-glow), transparent 70%);
    pointer-events: none;
}
.app-action-card--hotels::before,
.app-action-card--trips::before   { background: radial-gradient(120px 90px at 85% -10%, rgba(212,168,83,0.30), transparent 70%); }
.app-action-card--saved::before,
.app-action-card--offers::before  { background: radial-gradient(120px 90px at 85% -10%, rgba(15,160,144,0.22), transparent 70%); }

.app-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--glass-bg-strong);
    color: var(--accent);
    z-index: 1;
}
.app-action-icon i { width: 20px; height: 20px; }

.app-action-title {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-inverse);
    z-index: 1;
}

.app-action-desc {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-inverse-muted);
    z-index: 1;
    margin-top: -6px;
}

/* ── Quick Booking ── */
.app-quick-booking {
    border-radius: var(--radius-lg);
    background: var(--glass-bg-strong);
    border: 1px solid var(--border-color);
    padding: 6px 16px;
}

.app-qb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
}
.app-qb-row i { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.app-qb-row input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-primary);
}
.app-qb-row input::placeholder { color: var(--text-tertiary); }

.app-qb-divider { height: 1px; background: var(--border-color); }

.app-qb-split { display: flex; gap: 16px; }
.app-qb-row--half { flex: 1; padding-left: 0; border-top: 1px solid var(--border-color); }

.app-qb-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 10px;
    padding: 15px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--text-inverse);
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
    transition: transform 0.18s var(--ease-spring);
}
.app-qb-submit i { width: 16px; height: 16px; }
.app-qb-submit:active { transform: scale(0.97); }

/* ── Upcoming Trip Card ── */
.app-upcoming-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
}
.app-upcoming-media { position: relative; height: 140px; }
.app-upcoming-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-upcoming-status {
    position: absolute;
    top: 12px; left: 12px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--text-inverse);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.app-upcoming-body { padding: 16px; }
.app-upcoming-name {
    display: block;
    font-family: var(--font-display);
    font-size: 17px;
    color: var(--text-inverse);
}
.app-upcoming-countdown {
    display: block;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-inverse-muted);
}
.app-upcoming-actions { display: flex; gap: 10px; margin-top: 14px; }
.app-upcoming-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px;
    border-radius: var(--radius-md);
    background: var(--glass-bg-strong);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.app-upcoming-btn--primary { background: var(--accent); color: var(--text-inverse); }
.app-upcoming-btn i { width: 14px; height: 14px; }

/* ── Horizontal Scrollers (Promotions / Destinations) ── */
.app-hscroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 2px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    scrollbar-width: none;
}
.app-hscroll::-webkit-scrollbar { display: none; }

.app-promo-card {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: 220px;
    padding: 18px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.app-promo-card--teal { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); }
.app-promo-card--gold { background: linear-gradient(135deg, #a9822f, var(--gold)); }
.app-promo-card--dark { background: var(--glass-dark); border: 1px solid var(--glass-border); }

.app-promo-badge {
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.22);
    color: var(--text-inverse);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    margin-bottom: 6px;
}
.app-promo-title { font-family: var(--font-display); font-size: 16.5px; color: var(--text-inverse); }
.app-promo-desc { font-family: var(--font-body); font-size: 12.5px; color: var(--text-inverse-muted); }

.app-dest-card {
    scroll-snap-align: start;
    position: relative;
    flex: 0 0 auto;
    width: 148px;
    height: 190px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
}
.app-dest-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-dest-card::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(6,10,8,0.85), rgba(6,10,8,0) 55%);
}
.app-dest-badge, .app-dest-name { position: absolute; z-index: 1; }
.app-dest-badge {
    top: 10px; left: 10px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: var(--gold);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
}
.app-dest-name {
    bottom: 12px; left: 12px; right: 12px;
    font-family: var(--font-display);
    font-size: 14.5px;
    color: var(--text-inverse);
}

/* ── Press feedback shared by all tappable app surfaces ── */
.app-action-card, .app-qb-submit, .app-avatar-btn, .app-dest-card, .app-promo-card {
    -webkit-user-select: none;
    user-select: none;
}

/* ── Respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    html.app-shell-active #app-home { animation: none; }
    .app-action-card, .app-qb-submit, .app-avatar-btn { transition: none; }
}

/* ── Small phones ── */
@media (max-width: 360px) {
    .app-greeting-title { font-size: 22px; }
    .app-actions-grid { gap: 10px; }
    .app-action-card { padding: 15px 13px; }
}
