/* mobile.css — Portrait mobile overrides on top of the shared wayfinder-* styles. */

html,
body.mobile-body {
    margin: 0;
    padding: 0;
    width: 100%;
    background: #05070f;
}

html {
    min-height: 100%;
}

body.mobile-body {
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #05070f;
    /* overflow-x: clip (not hidden) — hidden makes the element a scroll
       container and clamps position: sticky to the body's internal viewport
       instead of the real page viewport, which was breaking the sticky
       header on short screens. */
    overflow-x: clip;
}

#app-root {
    display: block;
    width: 100%;
}

/* Portrait-locked strip; min-height keeps every page a comfortable phone-ish
   height on desktop. Content taller than that extends the shell; shorter
   content leaves the black body background visible below.
   overflow: visible so the sticky header can stick to the viewport rather
   than scrolling away when the shell extends past the window height. */
.mobile-shell {
    max-width: 480px;
    min-height: 820px;
    margin: 0 auto;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: visible;
}

/* --- Header — gold gradient matching the kiosk site ---
   Sticky so the brand stays visible while the user scrolls the service list
   or a long detail page. */
.mobile-header {
    background: linear-gradient(to right, var(--header-grad-1) 0%, var(--header-grad-2) 25%, var(--gold) 60%, var(--header-grad-3) 100%);
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 0.9rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 88px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    flex: 1;
}

.mobile-header-logo {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.mobile-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mobile-header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    /* Allow multi-line wrap so long department titles don't get truncated. */
    white-space: normal;
    overflow-wrap: break-word;
}

.mobile-header-subtitle {
    font-size: 0.78rem;
    color: var(--gold-cream);
    line-height: 1.2;
    margin-top: 2px;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* --- Action bar (back / start over) sits below the header --- */
.mobile-action-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    background: var(--bg-deep);
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.15);
}

.mobile-action-bar:empty {
    display: none;
}

.mobile-action-bar-btn {
    flex: 1;
    min-width: 0 !important;
    font-size: 0.85rem !important;
    padding: 0.45rem 0.75rem !important;
    gap: 0.35rem !important;
}

.mobile-action-bar-btn .icon-sm {
    width: 1rem;
    height: 1rem;
}

/* Back button uses --accent-deep, the same navy as a selected service button,
   so it reads as an anchor action rather than a primary CTA. */
.mobile-action-bar-btn.btn-action-blue {
    background: var(--accent-deep);
    border-color: rgba(var(--accent-rgb), 0.4);
}

.mobile-action-bar-btn.btn-action-blue:hover {
    background: #06589a;
}

/* --- Main page area --- */
.mobile-main {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.mobile-page-language .mobile-main {
    padding: 0;
}

/* --- Language / hero landing --- */
.mobile-hero {
    display: flex;
    flex: 1;
    min-height: 720px;
}

.mobile-welcome-panel {
    width: 100%;
    min-height: 720px;
    border-radius: 0;
}

.mobile-welcome-content {
    padding: 2rem 1.25rem 2.5rem;
    justify-content: center;
    gap: 1.25rem;
}

.mobile-welcome-title {
    font-size: 2.25rem !important;
    line-height: 1.1;
    margin-bottom: 0.5rem !important;
    padding: 0 0.5rem;
}

.mobile-lang-intro {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.25rem;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.mobile-lang-list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: 85%;
    max-width: 320px;
}

.mobile-lang-button {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.75) 0%, rgba(15, 23, 41, 0.85) 100%);
    border: 2px solid rgba(var(--accent-rgb), 0.35);
    color: var(--text-heading);
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
    text-align: center;
}

.mobile-lang-button:active {
    transform: scale(0.97);
}

.mobile-lang-button:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.28) 0%, rgba(15, 23, 41, 0.88) 100%);
}

.mobile-lang-button.active {
    border-color: var(--gold-light);
    color: var(--gold-light);
    text-shadow: 0 0 10px rgba(var(--gold-light-rgb), 0.5);
}

/* --- Services card --- */
.mobile-services-card {
    background: var(--bg-card);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: 0.75rem;
    padding: 0.65rem 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
}

.mobile-section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 0.25rem 0.5rem;
    color: var(--text-heading);
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.15);
    text-align: center;
}

.mobile-section-title .icon-md {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--accent);
    flex-shrink: 0;
}

/* Breadcrumb shown on services tab view (in place of the removed tab bar) */
.mobile-tab-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 0.4rem 0.5rem;
    color: var(--gold-light);
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.15);
    text-shadow: 0 0 10px rgba(var(--gold-light-rgb), 0.3);
    text-align: center;
}

.mobile-tab-breadcrumb-icon {
    font-size: 1.15rem;
}

.mobile-home-menu {
    padding: 0;
}

.mobile-home-menu .home-menu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Big gold home-menu buttons — 30% shorter than before. Also override the
   kiosk CSS min-height baked into .home-menu-button-label. */
.mobile-home-menu .home-menu-button {
    min-height: 3.85rem;
    padding: 0.4rem 0.5rem;
    gap: 0.65rem;
}

.mobile-home-menu .home-menu-button-icon {
    font-size: 1.6rem;
}

.mobile-home-menu .home-menu-button-label {
    font-size: 0.95rem;
    line-height: 1.15;
    min-height: 0 !important;
}

/* Emergency / urgent-help button — shrink to fit on one line in the mobile strip */
.mobile-home-menu .home-menu-emergency-button {
    font-size: 0.95rem;
    padding: 0.8rem 0.75rem;
    line-height: 1.2;
    letter-spacing: 0;
}

/* "Most Visited Services" / "Emergency & Urgent" section dividers — tighter
   and quieter on mobile so the panel stays compact. */
.mobile-home-menu .home-menu-section-header {
    font-size: 1rem;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    gap: 0.6rem;
}

/* Beats the !important rule in wayfinder-home.css that forces 3 columns */
.mobile-home-menu .service-grid,
.mobile-service-grid.service-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
}

.mobile-service-grid .service-button {
    min-height: 4.75rem;
    padding: 0.65rem 0.55rem;
}

/* --- Service list content (within services page) --- */
.mobile-service-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.mobile-service-list .service-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.mobile-service-list .service-grid.selection-grid {
    grid-template-columns: 1fr 1fr;
}

.mobile-service-list .service-button {
    min-height: 4.75rem;
    padding: 0.65rem 0.55rem;
}

.mobile-services-card .service-name {
    font-size: 1rem;
    line-height: 1.2;
    padding-right: 2.5rem;
}

.mobile-service-list .nav-bar {
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mobile-service-list .secondary-tabs {
    flex-wrap: wrap;
}

.mobile-service-list .secondary-tab {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.mobile-service-list .search-device-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
}

/* Floor selector grid — three-up */
.mobile-service-list > div[style*="repeat(auto-fill, 120px)"] {
    grid-template-columns: repeat(3, 1fr) !important;
}

.mobile-service-list .selector-button {
    min-height: 4.5rem;
}

/* Service badge (floor number / phone icon + need icon on the right of each
   service button). Sized to (a) stay within the button's 4.75rem min-height
   even when the service name fits on one line, and (b) read as proportional
   to the 1rem name font rather than looking shrunk into the corner.
   Total badge height ≈ 3rem (48 px) vs button min-height 4.75rem (76 px). */
.mobile-services-card .service-button .service-badge {
    top: 0.3rem;
    right: 0.3rem;
    min-width: 2rem;
    width: 2rem;
}

.mobile-services-card .service-badge-floor {
    font-size: 1.05rem;
    padding: 0.45rem 2px;
}

.mobile-services-card .service-badge-phone {
    font-size: 1.05rem;
    padding: 0.42rem 2px;
}

.mobile-services-card .service-badge-icon {
    font-size: 1rem;
    padding: 0.45rem 2px;
}

/* RTL: flip the badge anchor and the service-name clearance padding so the
   text doesn't collide with the badge in Arabic / Farsi. Mirrors the kiosk
   rules in wayfinder-base.css at the tightened mobile offsets. */
html[dir="rtl"] .mobile-services-card .service-button .service-badge {
    right: auto;
    left: 0.3rem;
}

html[dir="rtl"] .mobile-services-card .service-name {
    padding-right: 0;
    padding-left: 2.5rem;
}


/* By Need / By Organization selector tiles use inline font-size: 1.25rem for
   the label — shrink to match the density of other mobile buttons. */
.mobile-service-list .service-button div[style*="font-size: 1.25rem"] {
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
}

.mobile-service-list .service-button div[style*="font-size: 0.875rem"] {
    font-size: 0.8rem !important;
}

/* --- Service detail page --- */
.mobile-detail {
    background: var(--bg-card);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Matches the blue section headers used on the main site's 3-panel
   wayfinding card, not tied to a floor color. */
.mobile-detail-banner {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 0.55rem 0.9rem;
    text-align: center;
}

.mobile-detail-body {
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mobile-detail-org {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.mobile-detail-name {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--gold-light);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(var(--gold-light-rgb), 0.3);
}

.mobile-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.mobile-detail-meta-dot {
    color: var(--text-dim);
}

.mobile-detail-description {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.mobile-detail-actions {
    padding: 0.5rem 0.9rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Detail action buttons — .btn-action + mobile-detail-btn keeps the same look
   as back/start-over / video walkthrough buttons elsewhere in the app. */
.mobile-detail-btn {
    min-width: 0 !important;
    width: 100%;
    justify-content: center;
    font-size: 1rem !important;
    padding: 0.75rem 0.9rem !important;
    gap: 0.5rem !important;
    text-decoration: none;
    /* Buttons don't inherit font by default — force the same family/weight
       as anchors so <a> and <button> detail actions look identical. */
    font-family: inherit;
    font-weight: 600 !important;
    line-height: 1.2;
    letter-spacing: 0;
    box-sizing: border-box;
}

.mobile-detail-btn span {
    font-weight: 600 !important;
    font-family: inherit;
}

.mobile-detail-btn .icon-sm {
    width: 1.1rem;
    height: 1.1rem;
}

/* Phone-only services show the raw tel: link in the button. Keep it tabular
   so digits don't look oddly spaced. */
.mobile-detail-btn[href^="tel:"] span {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

.mobile-detail-phone-note {
    color: var(--accent);
    font-weight: 600;
}

/* Gold-accent variant for the Directions actions so the three detail actions
   read as a consistent group with a clear hierarchy. */
.mobile-detail-btn-gold {
    background: linear-gradient(135deg, var(--gold-accent) 0%, var(--gold) 100%);
    color: #1a1205;
    border-color: rgba(0, 0, 0, 0.2);
    text-shadow: none;
}

.mobile-detail-btn-gold:hover {
    filter: brightness(1.05);
}

/* --- Inside stepper --- */
.mobile-inside {
    background: var(--bg-card);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.mobile-inside-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.2);
}

.mobile-inside-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.mobile-step-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.mobile-step-panel .panel-header {
    width: 100%;
    text-align: center;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
}

.mobile-step-subtitle {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    text-align: center;
}

.mobile-step-svg {
    width: 100%;
    background: white;
    border-radius: 0.5rem;
    padding: 0.25rem;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-step-svg svg {
    width: 100% !important;
    height: auto !important;
    max-height: 60vh;
    display: block;
}

/* 3D building view — shrink to fit mobile width */
.mobile-step-building {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
    overflow: hidden;
}

.mobile-step-building .section-panel.building-section {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 100%;
}

.mobile-step-building .section-header {
    display: none;
}

.mobile-step-building .building-container-wrapper {
    transform: scale(0.82);
    transform-origin: top center;
    margin-bottom: -60px;
}

.mobile-step-building .elevator-instructions {
    margin-top: 0.5rem !important;
}

/* Step nav — narrow gold circle buttons with arrow glyphs. */
.mobile-step-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(var(--accent-rgb), 0.15);
}

.mobile-step-circle {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-accent) 0%, var(--gold) 100%);
    border: 2px solid var(--gold-light);
    color: #1a1205;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: filter 0.15s ease, transform 0.1s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    padding: 0;
}

.mobile-step-circle:hover:not([disabled]) {
    filter: brightness(1.08);
}

.mobile-step-circle:active:not([disabled]) {
    transform: scale(0.94);
}

.mobile-step-circle[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.mobile-step-circle svg {
    width: 1.4rem;
    height: 1.4rem;
}

.mobile-step-progress {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold-light);
    white-space: nowrap;
    min-width: 3rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* --- Modals (gateway confirmation) ---
   The kiosk backdrop centers modals dead-center in the viewport, which on a
   tall desktop window lands well below the mobile strip's content. Anchor the
   modal near the top of the viewport so it appears over the app area. */
.mobile-body .modal-backdrop {
    align-items: flex-start !important;
    padding-top: 5rem !important;
    padding-bottom: 2rem !important;
    overflow-y: auto;
}

.mobile-body .modal-content {
    max-width: min(95vw, 440px) !important;
    margin: 0 auto !important;
}

.mobile-body .modal-body {
    padding: 1rem !important;
}

/* Very narrow phones */
@media (max-width: 360px) {
    .mobile-header-title { font-size: 1.15rem; }
    .mobile-header-subtitle { font-size: 0.72rem; }
    .mobile-welcome-title { font-size: 1.9rem !important; }
    .mobile-detail-name { font-size: 1.3rem; }
    .mobile-home-menu .home-menu-emergency-button { font-size: 0.85rem; }
}
