/* =========================================================
   site.css — Complete (Mobile-first, desktop-premium, app-like UX)
   Goals:
   - No weird scroll/zoom
   - True app-like bottom nav on mobile
   - Desktop: no empty sidebar gap, nice max width
   - Buttons: full-width only on mobile, normal on desktop
   ========================================================= */

/* ---------- Root tokens ---------- */
:root {
    --bottom-nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --content-max: 1100px;
}

/* ---------- Base / Typography ---------- */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
}

/* Prevent any accidental horizontal scrolling */
html, body {
    overflow-x: hidden;
}

/* ---------- Focus styles (Bootstrap compatible) ---------- */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ---------- Layout container ---------- */
/* Use dvh for modern mobile browsers; keep vh as fallback */
main.app-container {
    min-height: 100vh;
    min-height: 100dvh;
}

/* Desktop: premium readable width (prevents "huge empty column" feel) */
@media (min-width: 768px) {
    main.app-container .container,
    main.app-container .container-sm,
    main.app-container .container-md,
    main.app-container .container-lg,
    main.app-container .container-xl,
    main.app-container .container-xxl {
        max-width: var(--content-max);
    }
}

/* A small spacing helper */
.page-wrap {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

@media (min-width: 768px) {
    .page-wrap {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

/* ---------- Offline banner ---------- */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: 0.4rem 0.75rem;
    background: #0b1220;
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
}

/* Keep content visible when banner is shown */
html.is-offline main.app-container {
    padding-top: 3rem;
}

/* ---------- Mobile-first helpers ---------- */

/* iOS: prevent auto zoom on form focus */
@media (max-width: 767.98px) {
    input,
    select,
    textarea,
    .form-control,
    .form-select {
        font-size: 16px;
    }
}

/* Better tap targets */
a.btn, button.btn {
    /*min-height: 44px;*/
}

/* Buttons: full width ONLY on mobile */
.w-mobile-100 {
    width: 100% !important;
}

@media (min-width: 576px) {
    .w-mobile-100 {
        width: auto !important;
    }
}

/* If some views still use .w-100 (Bootstrap), override on desktop */
@media (min-width: 576px) {
    a.btn.w-100,
    button.btn.w-100,
    input.btn.w-100 {
        width: auto !important;
        display: inline-flex;
    }
}

/* Form layout */
.form-narrow {
    max-width: 520px;
}

.form-actions {
    display: grid;
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .form-actions {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 0.5rem;
    }

        .form-actions .btn {
            width: auto !important;
        }
}

/* Club switcher: avoid fixed widths on small screens */
.club-switch {
    min-width: 0;
}

@media (min-width: 576px) {
    .club-switch {
        min-width: 220px;
    }
}

/* Tables: smoother scroll if needed */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ---------- Bottom navigation (Mobile) ---------- */
@media (max-width: 767.98px) {
    /* Reserve space so fixed bottom-nav never overlays content */
    main.app-container {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
    }

    .bottom-nav {
        height: var(--bottom-nav-height);
        padding-bottom: var(--safe-bottom);
    }

        .bottom-nav .nav-link {
            padding: 0.35rem 0;
            font-size: 0.95rem;
        }

        .bottom-nav .small {
            font-size: 0.72rem;
            line-height: 1rem;
        }

        /* App-like nav buttons */
        .bottom-nav .nav-link {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            color: inherit;
            border-radius: 14px;
            line-height: 1.05;
        }

            .bottom-nav .nav-link:active {
                transform: scale(0.98);
            }

            .bottom-nav .nav-link.active {
                font-weight: 600;
                background: rgba(11, 18, 32, 0.06);
            }

    /* Floating Action Button (FAB) — above bottom nav */
    .fab {
        position: fixed;
        right: 1rem;
        bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
        z-index: 1030;
        width: 56px;
        height: 56px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    }

        .fab .fab-plus {
            font-size: 1.5rem;
            line-height: 1;
            margin-top: -2px;
        }
}

/* ---------- Desktop navbar spacing (optional polish) ---------- */
@media (min-width: 768px) {
    .navbar .nav-link {
        padding-top: .5rem;
        padding-bottom: .5rem;
    }
}

/* ---------- Offcanvas: bigger touch targets ---------- */
.offcanvas .nav-link {
    padding: 0.75rem 0.85rem;
    border-radius: 0.9rem;
}

/* ---------- Small app-like interaction polish ---------- */
.bottom-nav .nav-link,
.btn,
.card,
.list-group-item {
    transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

    .btn:active {
        transform: scale(0.99);
    }
