/* ============================================================
   vl_app.css — Mode « application » mobile (PWA)
   Ville Lecture Saint-Hilaire
   Variables de styles.css : --brun, --ocre, --beige, --gris, --encre
   ============================================================ */

/* La barre du bas est cachée par défaut (ordinateur) */
.vl-appbar, .vl-appsheet { display: none; }
.vl-install-banner { display: none; }

@media (max-width: 768px) {

    /* ── Barre de navigation du bas ───────────────────────── */
    .vl-appbar {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 1000;
        background: #fff;
        border-top: 1px solid var(--beige, #f5f1eb);
        box-shadow: 0 -2px 12px rgba(0,0,0,.08);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .vl-appbar-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 58px;
        padding: 6px 2px;
        background: none;
        border: 0;
        font: inherit;
        color: var(--gris, #6b6b6b);
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .vl-appbar-item.is-active { color: var(--ocre, #b86b3c); font-weight: 700; }
    .vl-appbar-ico { position: relative; font-size: 1.45rem; line-height: 1; }
    .vl-appbar-lbl { font-size: .68rem; letter-spacing: .2px; }
    .vl-appbar-badge {
        position: absolute; top: -6px; right: -12px;
        min-width: 18px; height: 18px; padding: 0 5px;
        border-radius: 9px; background: #dc3545; color: #fff;
        font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center;
    }
    .vl-appbar-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: -2px; right: -6px; }
    .vl-appbar-inline { position: static; display: inline-block; margin-left: .4rem; vertical-align: middle; }

    /* Espace réservé pour que le contenu ne passe pas sous la barre */
    body { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0)); }

    /* ── Feuille « Plus » ─────────────────────────────────── */
    .vl-appsheet { position: fixed; inset: 0; z-index: 1100; }
    .vl-appsheet:not([hidden]) { display: block; }
    .vl-appsheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
    .vl-appsheet-panel {
        position: absolute; left: 0; right: 0; bottom: 0;
        background: #fff;
        border-radius: 18px 18px 0 0;
        padding: .6rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
        max-height: 80vh; overflow-y: auto;
        animation: vlSheetUp .2s ease-out;
    }
    @keyframes vlSheetUp { from { transform: translateY(100%); } to { transform: none; } }
    .vl-appsheet-grip { width: 42px; height: 4px; border-radius: 2px; background: #ddd; margin: 0 auto .8rem; }
    .vl-appsheet-user { margin: 0 0 .4rem; font-weight: 700; color: var(--brun, #7c4a2f); }
    .vl-appsheet-panel a,
    .vl-appsheet-logout {
        display: block; width: 100%; box-sizing: border-box;
        padding: .95rem .4rem; text-align: left;
        border: 0; border-top: 1px solid var(--beige, #f5f1eb); background: none;
        font: inherit; font-size: 1.02rem; color: var(--encre, #2b2b2b);
        text-decoration: none; cursor: pointer;
    }
    .vl-appsheet-logout { color: #dc3545; font-weight: 600; }

    /* ── Confort de lecture et de saisie ──────────────────── */
    main, .vl-container { padding-left: 12px !important; padding-right: 12px !important; }
    .vl-grid, .vl-member-layout, .vl-auth-grid { grid-template-columns: 1fr !important; display: grid !important; gap: 1.2rem !important; }
    .vl-form-row { display: block; }
    /* 16 px minimum : évite le zoom automatique d'iOS dans les champs */
    input, select, textarea, .vl-input, .vl-form-control, .forum-input, .forum-textarea { font-size: 16px !important; }
    .vl-btn { min-height: 44px; }
    .vl-btn-sm { min-height: 40px; }
    h1 { font-size: 1.5rem; }

    /* Tableau du planning → une « carte » par séance */
    .vl-table, .vl-table tbody, .vl-table tr, .vl-table td { display: block; width: 100%; box-sizing: border-box; }
    .vl-table thead { display: none; }
    .vl-table tr { margin-bottom: .8rem; border: 1px solid #eee !important; border-radius: 10px; overflow: hidden; }
    .vl-table td { padding: .45rem .9rem !important; }
    .vl-table td:nth-child(1)::before { content: "Date : "; font-weight: 700; }
    .vl-table td:nth-child(2)::before { content: "Apprenant : "; font-weight: 700; }
    .vl-table td:nth-child(3)::before { content: "Durée : "; font-weight: 700; }
    .vl-table td:nth-child(4)::before { content: "Préparation : "; font-weight: 700; }
    .vl-table td:nth-child(5)::before { content: "Statut : "; font-weight: 700; }

    /* Pied de page moins encombrant */
    .footer { padding-bottom: 1rem; }
    .cookie-banner { bottom: calc(66px + env(safe-area-inset-bottom, 0)); }

    /* ── Bandeau « Installer l'application » ──────────────── */
    .vl-install-banner {
        display: flex; align-items: center; gap: .7rem;
        margin: .6rem 12px 0; padding: .7rem .9rem;
        background: #fdf6ef; border: 1px solid #e8d5bf; border-radius: 12px;
        font-size: .88rem; color: #7a5020;
    }
    .vl-install-banner span { flex: 1; }
    .vl-install-banner button {
        border: 0; border-radius: 8px; padding: .55rem .9rem; font: inherit; font-weight: 600; cursor: pointer;
    }
    .vl-install-go { background: var(--ocre, #b86b3c); color: #fff; }
    .vl-install-close { background: none; color: #7a5020; font-size: 1.2rem; padding: .2rem .5rem !important; }
}

/* Application installée : on masque le menu burger du site public
   (la barre du bas le remplace pour les membres) */
@media (max-width: 768px) and (display-mode: standalone) {
    body.vl-has-appbar .burger { display: none; }
    body.vl-has-appbar .main-nav { display: none !important; }
}
