/* ==========================================================================
   GolfHub Mobile App skin — area utente autenticata (<768px)
   Scopato su `body.user-mobile`. Nessun effetto su altre pagine o su desktop.
   ========================================================================== */

:root {
    --gh-ink: #0B1E3B;
    --gh-ink-soft: #1E3A5F;
    --gh-primary: #2563EB;
    --gh-primary-dark: #1E40AF;
    --gh-cyan: #06B6D4;
    --gh-success: #10B981;
    --gh-warning: #F59E0B;
    --gh-error: #EF4444;
    --gh-surface: #FFFFFF;
    --gh-bg: #F5F7FB;
    --gh-muted: #64748B;
    --gh-border: #E5E9F2;

    --gh-shadow: 0 1px 2px rgba(17, 34, 64, .04), 0 4px 12px rgba(17, 34, 64, .06);
    --gh-shadow-lg: 0 6px 20px rgba(37, 99, 235, .25);

    --gh-radius-card: 20px;
    --gh-radius-hero: 18px;
    --gh-radius-pill: 100px;
    --gh-radius-btn: 14px;

    --gh-hero-gradient: linear-gradient(135deg, #1E40AF 0%, #2563EB 45%, #06B6D4 100%);
    --gh-card-gradient: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%);

    --gh-bottom-nav-h: 68px;
    --gh-safe-bottom: env(safe-area-inset-bottom, 0px);
    --gh-safe-top: env(safe-area-inset-top, 0px);
}

/* Su desktop / tablet ≥768px → tutti i componenti .gh-* sono invisibili.
   Il layout pubblico/Bootstrap rimane intatto. */
.gh-mobile-header,
.gh-bottom-nav,
.gh-only-mobile {
    display: none;
}

/* ==========================================================================
   MOBILE: <768px
   ========================================================================== */
@media (max-width: 767.98px) {

    /* Nasconde la navbar pubblica e il footer per le pagine utente mobile */
    body.user-mobile > nav.navbar,
    body.user-mobile .public-footer {
        display: none !important;
    }

    body.user-mobile {
        background: var(--gh-bg);
        color: var(--gh-ink);
        font-family: 'Inter', system-ui, -apple-system, sans-serif;
    }

    body.user-mobile .public-main {
        padding-top: 0;
        padding-bottom: calc(var(--gh-bottom-nav-h) + var(--gh-safe-bottom) + 16px);
    }

    /* Rende visibili i componenti mobile-only */
    body.user-mobile .gh-mobile-header,
    body.user-mobile .gh-bottom-nav {
        display: flex;
    }

    body.user-mobile .gh-only-mobile {
        display: block;
    }

    body.user-mobile .gh-hide-on-mobile {
        display: none !important;
    }

    /* Container mobile: azzera i bordi Bootstrap per adattarsi a schermi stretti */
    body.user-mobile .container,
    body.user-mobile .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
        max-width: 100%;
    }

    /* Alert di flash messaggi più compatti */
    body.user-mobile .alert {
        border-radius: 14px;
        border: none;
        box-shadow: var(--gh-shadow);
    }

    /* Auto-skin delle card Bootstrap nelle pagine utente mobile:
       arrotonda radius e ombra soft. Non tocca i contenuti. */
    body.user-mobile .card {
        border-radius: var(--gh-radius-card) !important;
        border: none !important;
        box-shadow: var(--gh-shadow) !important;
        overflow: hidden;
    }

    body.user-mobile .card-header {
        border: none;
        font-weight: 600;
    }

    body.user-mobile .breadcrumb {
        font-size: 12px;
        margin-bottom: 8px;
    }

    /* h1 display-5 troppo grandi su mobile: ridimensiona nelle pagine utente */
    body.user-mobile h1.display-5 {
        font-size: 22px;
        font-weight: 700;
    }

    body.user-mobile .lead {
        font-size: 14px;
    }

    /* Container: ridurre padding verticale sulle pagine user */
    body.user-mobile .container.py-5 {
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }

    /* Bottoni Bootstrap: allarga hit-target e arrotonda */
    body.user-mobile .btn {
        border-radius: 12px;
    }

    body.user-mobile .btn-lg {
        border-radius: var(--gh-radius-btn);
        min-height: 48px;
    }

    /* Tabelle dentro card: riduci padding e font per mobile */
    body.user-mobile .table {
        font-size: 13px;
    }

    body.user-mobile .table td,
    body.user-mobile .table th {
        padding: 8px 6px;
    }

    /* Btn-group: spezza su mobile per evitare overflow */
    body.user-mobile .btn-group {
        flex-wrap: wrap;
        gap: 4px;
    }

    body.user-mobile .btn-group > .btn {
        border-radius: 10px !important;
        margin-left: 0 !important;
    }

    /* ----------------------------------------------------------------------
       HEADER mobile sticky
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-mobile-header {
        position: sticky;
        top: 0;
        z-index: 1020;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: calc(var(--gh-safe-top) + 14px) 16px 14px;
        background: var(--gh-surface);
        border-bottom: 1px solid var(--gh-border);
    }

    body.user-mobile .gh-mobile-header--dark {
        background: var(--gh-hero-gradient);
        color: #fff;
        border-bottom: none;
    }

    .gh-mobile-header__back {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border-radius: 12px;
        border: none;
        background: #F1F5FB;
        color: var(--gh-ink);
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        box-shadow: var(--gh-shadow);
        font-size: 18px;
    }

    .gh-mobile-header--dark .gh-mobile-header__back {
        background: rgba(255, 255, 255, .15);
        color: #fff;
        box-shadow: none;
    }

    .gh-mobile-header__title {
        flex: 1 1 auto;
        min-width: 0;
    }

    .gh-mobile-header__title h1 {
        font-size: 17px;
        font-weight: 700;
        margin: 0;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .gh-mobile-header__title small {
        display: block;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 1.2px;
        text-transform: uppercase;
        opacity: .6;
        margin-top: 2px;
    }

    .gh-mobile-header__action {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        border: none;
        background: transparent;
        color: inherit;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }

    /* ----------------------------------------------------------------------
       HERO (blocco introduttivo con gradient)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-hero {
        position: relative;
        margin: 16px 0 20px;
        padding: 20px;
        border-radius: var(--gh-radius-card);
        background: var(--gh-hero-gradient);
        color: #fff;
        overflow: hidden;
        box-shadow: var(--gh-shadow-lg);
    }

    body.user-mobile .gh-hero--compact {
        padding: 16px;
    }

    .gh-hero__label {
        display: inline-block;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 1.4px;
        text-transform: uppercase;
        opacity: .85;
        margin-bottom: 8px;
    }

    .gh-hero__num {
        font-size: 72px;
        font-weight: 800;
        line-height: .95;
        letter-spacing: -3px;
        margin: 4px 0;
    }

    .gh-hero__num--sm {
        font-size: 54px;
        letter-spacing: -2px;
    }

    .gh-hero__sub {
        font-size: 13px;
        opacity: .85;
        margin: 0;
    }

    .gh-hero__title {
        font-size: 22px;
        font-weight: 700;
        margin: 0 0 4px;
        line-height: 1.2;
    }

    /* ----------------------------------------------------------------------
       CARD (bianca, bordo arrotondato, doppia ombra soft)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-card {
        background: var(--gh-surface);
        border-radius: var(--gh-radius-card);
        padding: 16px;
        margin-bottom: 14px;
        box-shadow: var(--gh-shadow);
        border: none;
    }

    body.user-mobile .gh-card--accent {
        background: linear-gradient(135deg, rgba(37, 99, 235, .06) 0%, rgba(6, 182, 212, .06) 100%);
        border: 1px solid rgba(37, 99, 235, .2);
    }

    body.user-mobile .gh-card--warning {
        background: #FFF8E1;
        border: 1px solid rgba(245, 158, 11, .25);
    }

    .gh-card__title {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 1.4px;
        text-transform: uppercase;
        color: var(--gh-muted);
        margin: 0 0 10px;
    }

    .gh-card__heading {
        font-size: 16px;
        font-weight: 700;
        margin: 0 0 6px;
        color: var(--gh-ink);
    }

    /* ----------------------------------------------------------------------
       PILL / BADGE
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-pill {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px 12px;
        border-radius: var(--gh-radius-pill);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 1px;
        text-transform: uppercase;
        line-height: 1.4;
        background: #EEF2F7;
        color: var(--gh-ink);
        border: none;
    }

    .gh-pill--primary { background: rgba(37, 99, 235, .12); color: var(--gh-primary); }
    .gh-pill--cyan    { background: rgba(6, 182, 212, .15); color: #0E7490; }
    .gh-pill--success { background: #D1FAE5; color: #047857; }
    .gh-pill--warning { background: #FEF3C7; color: #92400E; }
    .gh-pill--error   { background: #FEE2E2; color: #B91C1C; }
    .gh-pill--dark    { background: var(--gh-ink); color: #fff; }
    .gh-pill--outline { background: transparent; border: 1px solid var(--gh-border); }

    /* ----------------------------------------------------------------------
       BUTTONS override Bootstrap (solo mobile, solo area user)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 46px;
        padding: 10px 20px;
        border-radius: var(--gh-radius-btn);
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        border: none;
        background: var(--gh-hero-gradient);
        color: #fff;
        box-shadow: var(--gh-shadow-lg);
        transition: transform .1s;
    }

    body.user-mobile .gh-btn:active { transform: scale(.98); }

    body.user-mobile .gh-btn--block {
        width: 100%;
    }

    body.user-mobile .gh-btn--ghost {
        background: var(--gh-surface);
        color: var(--gh-primary);
        border: 1px solid var(--gh-border);
        box-shadow: var(--gh-shadow);
    }

    body.user-mobile .gh-btn--muted {
        background: #F1F5FB;
        color: var(--gh-ink);
        box-shadow: none;
    }

    /* ----------------------------------------------------------------------
       LIST ROW (icona + label + valore destra)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-list {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    body.user-mobile .gh-list-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--gh-border);
        font-size: 14px;
    }

    body.user-mobile .gh-list-row:last-child {
        border-bottom: none;
    }

    .gh-list-row__icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: #F1F5FB;
        color: var(--gh-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 36px;
    }

    .gh-list-row__label {
        flex: 1 1 auto;
        min-width: 0;
        font-weight: 600;
        color: var(--gh-ink);
    }

    .gh-list-row__label small {
        display: block;
        color: var(--gh-muted);
        font-weight: 400;
        font-size: 12px;
    }

    .gh-list-row__value {
        font-weight: 700;
        color: var(--gh-ink);
        text-align: right;
        white-space: nowrap;
    }

    body.user-mobile .gh-list-row--highlight {
        background: linear-gradient(90deg, rgba(37, 99, 235, .08), rgba(37, 99, 235, 0));
        margin: 0 -16px;
        padding-left: 16px;
        padding-right: 16px;
        border-radius: 10px;
    }

    /* ----------------------------------------------------------------------
       SHORTCUT GRID (2x2 su dashboard)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-shortcut-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    body.user-mobile .gh-shortcut {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 16px;
        border-radius: var(--gh-radius-card);
        background: var(--gh-surface);
        box-shadow: var(--gh-shadow);
        text-decoration: none;
        color: var(--gh-ink);
        min-height: 96px;
    }

    .gh-shortcut__icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: rgba(37, 99, 235, .1);
        color: var(--gh-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .gh-shortcut__label {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.3;
    }

    /* ----------------------------------------------------------------------
       STAT GRID (3 colonne, divisori verticali)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-stat-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
    }

    body.user-mobile .gh-stat-grid > div {
        text-align: center;
        padding: 0 8px;
        border-right: 1px solid var(--gh-border);
    }

    body.user-mobile .gh-stat-grid > div:last-child {
        border-right: none;
    }

    .gh-stat__label {
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: var(--gh-muted);
        display: block;
        margin-bottom: 4px;
    }

    .gh-stat__value {
        font-size: 22px;
        font-weight: 800;
        color: var(--gh-ink);
        line-height: 1;
    }

    /* ----------------------------------------------------------------------
       FORM controls — arrotonda e ingrandisce i controlli Bootstrap
       ---------------------------------------------------------------------- */
    body.user-mobile .form-control,
    body.user-mobile .form-select {
        border-radius: 14px;
        padding: 12px 14px;
        font-size: 15px;
        border: 1px solid var(--gh-border);
    }

    body.user-mobile .form-control:focus,
    body.user-mobile .form-select:focus {
        border-color: var(--gh-primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
    }

    body.user-mobile .form-label {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 1.2px;
        text-transform: uppercase;
        color: var(--gh-muted);
        margin-bottom: 6px;
    }

    /* ----------------------------------------------------------------------
       BOTTOM TAB BAR (fixed, 5 voci, center hero)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        height: calc(var(--gh-bottom-nav-h) + var(--gh-safe-bottom));
        padding-bottom: var(--gh-safe-bottom);
        background: var(--gh-surface);
        border-top: 1px solid var(--gh-border);
        box-shadow: 0 -4px 16px rgba(17, 34, 64, .05);
    }

    .gh-tab {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        text-decoration: none;
        color: var(--gh-muted);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .3px;
        border: none;
        background: transparent;
    }

    .gh-tab i {
        font-size: 20px;
        line-height: 1;
    }

    .gh-tab.active {
        color: var(--gh-primary);
    }

    .gh-tab-hero {
        flex: 0 0 auto;
        width: 54px;
        height: 54px;
        margin-top: -18px;
        border-radius: var(--gh-radius-hero);
        background: var(--gh-hero-gradient);
        color: #fff;
        border: 3px solid var(--gh-surface);
        box-shadow: var(--gh-shadow-lg);
        display: flex;
        align-items: center;
        justify-content: center;
        align-self: center;
    }

    .gh-tab-hero i {
        font-size: 22px;
    }

    /* ----------------------------------------------------------------------
       TABELLE responsive (score hole-by-hole)
       ---------------------------------------------------------------------- */
    body.user-mobile .gh-table-wrap {
        overflow-x: auto;
        margin: 0 -4px;
        -webkit-overflow-scrolling: touch;
    }

    body.user-mobile .gh-table-wrap table {
        margin: 0;
    }

    body.user-mobile .gh-table-wrap .table {
        font-size: 13px;
    }

    /* ----------------------------------------------------------------------
       LOGIN card mobile — design GolfHub (gradient navy con accento cyan)
       ---------------------------------------------------------------------- */
    body.user-mobile.gh-login-body {
        background: radial-gradient(ellipse at 30% 0%, #2563EB 0%, #0F2547 55%, #0B1E3B 100%) !important;
        min-height: 100vh;
    }

    body.user-mobile.gh-login-body .gh-mobile-header,
    body.user-mobile.gh-login-body .gh-bottom-nav {
        display: none !important;
    }

    body.user-mobile.gh-login-body .login-card {
        border: 1px solid rgba(255, 255, 255, .12);
        background: rgba(255, 255, 255, .06);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-radius: var(--gh-radius-card);
        box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
        margin: 16px;
        width: calc(100% - 32px);
        color: #fff;
    }

    body.user-mobile.gh-login-body .login-card .text-golf-dark,
    body.user-mobile.gh-login-body .login-card h2 {
        color: #fff !important;
        font-weight: 800;
        letter-spacing: -.5px;
    }

    body.user-mobile.gh-login-body .login-card .text-muted {
        color: rgba(255, 255, 255, .65) !important;
    }

    body.user-mobile.gh-login-body .login-card .form-label {
        color: rgba(255, 255, 255, .55);
    }

    body.user-mobile.gh-login-body .login-card .form-control {
        background: rgba(255, 255, 255, .08);
        border: 1px solid rgba(255, 255, 255, .14);
        color: #fff;
    }

    body.user-mobile.gh-login-body .login-card .form-control::placeholder {
        color: rgba(255, 255, 255, .35);
    }

    body.user-mobile.gh-login-body .login-card .form-control:focus {
        background: rgba(255, 255, 255, .1);
        border-color: rgba(96, 165, 250, .5);
        color: #fff;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
    }

    body.user-mobile.gh-login-body .login-card .golf-logo {
        width: 72px;
        height: 72px;
        margin: 0 auto;
        border-radius: 22px;
        background: linear-gradient(135deg, #06B6D4, #60A5FA);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 36px;
        color: #fff;
        box-shadow: 0 12px 30px rgba(6, 182, 212, .35);
    }

    body.user-mobile.gh-login-body .login-card .btn-golf,
    body.user-mobile.gh-login-body .login-card .btn-primary {
        background: linear-gradient(135deg, #06B6D4, #3B82F6);
        border: none;
        height: 54px;
        border-radius: 16px;
        font-weight: 700;
        letter-spacing: -.2px;
        box-shadow: 0 10px 24px rgba(59, 130, 246, .4);
    }
}

/* ==========================================================================
   DESKTOP / TABLET ≥768px: safety net — azzera stili mobile
   (già implicito, ma garantisce compatibilità anche se body.user-mobile è attivo)
   ========================================================================== */
@media (min-width: 768px) {
    .gh-mobile-header,
    .gh-bottom-nav {
        display: none !important;
    }
}
