/* wf.css - mobile-first, responsive. Widerøe branding (#00602C). */

/* Box model + base reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    /* Prevent iOS text auto-resize on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    /* Use dynamic viewport height on supporting browsers (avoids mobile URL-bar jump) */
    min-height: 100dvh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Full-screen branded background, centered content */
.main {
    background-color: #00602C;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    /* Respect notches / rounded corners on modern phones */
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Fluid container: full width on phones, capped on larger screens */
.content {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 16px;
    text-align: center;
    font-family: sans-serif;
    color: #ffffff;
    /* Comfortable base reading size; prevents iOS input zoom (>=16px) */
    font-size: 16px;
    line-height: 1.5;
    /* Crisper light-on-dark text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollable airport list; fill available height minus sticky header area */
.airport-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100dvh - 160px);
}

/* Sticky title + search bar stay in view while the airport list scrolls.
   Scoped to the airports page: on the barcode page there is no scroll
   container, and a sticky green <h1> detaches when zoomed/panned, overlapping
   the white card's top corners and showing as a shadow-like edge. */
.airports-page h1,
.searchfield {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #00602C;
}

/* Primary heading (flight number / page title): large, bold, well spaced */
h1 {
    padding: 10px;
    margin: 0 auto 8px;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    word-break: break-word;
    /* Subtle shadow lifts white text off the saturated green */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Secondary info lines (airport, value). Slightly tinted white, still high contrast */
h3,
h4 {
    margin: 6px auto;
    line-height: 1.35;
    word-break: break-word;
    color: #eaf3ec;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

h4 {
    font-size: 1rem;
    font-weight: 500;
}

/* White card to anchor high-value content (QR + barcode) and aid scanning.
   Wrap QR/barcode in <div class="card"> in the template to use it. */
.card {
    background-color: #ffffff;
    color: #003415;
    border-radius: 12px;
    padding: 16px;
    margin: 12px auto;
    display: inline-block;
}

.card h3,
.card h4 {
    color: #003415;
    text-shadow: none;
}

/* Barcode text: monospace + spacing makes the code easy to read/verify */
.barcode-text {
    font-family: "Courier New", monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    word-break: break-all;
}

/* Search field: full width, large touch/typing target */
.searchfield {
    display: block;
    width: 100%;
    color: #ffffff;
    padding: 12px;
    border: 4px solid #ffffff;
    border-radius: 8px;
    margin: 0 auto 12px;
    background-color: #00602C;
    /* >=16px avoids automatic zoom-on-focus on iOS */
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    outline: none;
}

.searchfield::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.searchfield:focus {
    border-color: #eaf3ec;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* Airport links: full-width, tall enough for comfortable tapping (>=44px).
   Crisp white text on green with subtle lift for readability. */
.links {
    color: #ffffff;
    padding: 14px 12px;
    border: 4px solid #ffffff;
    border-radius: 8px;
    margin: 0 auto 10px;
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* Change-airport button: solid, high-contrast, prominent tap target.
   White fill + dark-green text reads better than white-on-green outline. */
.changeairportbutton {
    color: #00602C;
    background-color: #ffffff;
    padding: 14px 16px;
    border: 4px solid #ffffff;
    border-radius: 8px;
    margin: 16px auto 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    /* Reset inherited h1 shadow */
    text-shadow: none;
}

.changeairportbutton:active {
    background-color: #eaf3ec;
}

/* Press feedback for airport links */
.links:active {
    background-color: rgba(255, 255, 255, 0.15);
}

.disable-interactions {
    pointer-events: none;
    opacity: 0.5;
}

/* Loading spinner overlay */
.spinner-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #00602C;
    opacity: 0.2;
}

.spinner:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin-top: -30px;
    margin-left: -30px;
    border-radius: 50%;
    border: 4px solid #003415;
    border-top-color: transparent;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Larger screens: give the content a touch more breathing room */
@media (min-width: 480px) {
    .content {
        max-width: 460px;
        padding: 24px;
    }

    h1 {
        font-size: 1.9rem;
    }
}
