/* ==========================================================================
   SOFTRIP — mobile et mode app (lot 4, 06/11/2026)

   Deux styles, une seule feuille :
   1. Navigateur d'un téléphone : @media (max-width: 767.98px), responsive classique.
   2. Mode app : html.app-shell (app Median, PWA installée, test ?app=1).
      Barre du bas, en-tête compact avec retour, pas de pied de page.
   Rien ici ne s'applique à l'ordinateur hors mode app : chaque règle est sous
   l'une de ces deux portées (sauf le bouton WhatsApp sous les fenêtres, règle e du 06/11).
   ========================================================================== */

:root {
    --sr-blue: #1e3889;
    --sr-blue-dark: #162a6b;
    --sr-blue-soft: #eef2fb;
    --sr-red: #e53023;
    --sr-text: #0f172a;
    --sr-muted: #64748b;
    --sr-line: #e5e7eb;
    --sr-tap: 44px;
    --sr-radius: 16px;
    --sr-tabbar-h: 62px;
    --sr-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* --------------------------------------------------------------------------
   Tous modes
   -------------------------------------------------------------------------- */

/* Bouton WhatsApp : jamais au-dessus d'une fenêtre (MyPVit…) ni du bouton
   « Activer la caméra » (la page de scan ne l'affiche pas). */
.whatsapp-float { z-index: 1040 !important; }
body.modal-open .whatsapp-float { display: none !important; }

/* Éléments du mode app, masqués ailleurs. */
.app-tabbar,
.app-back { display: none !important; }

/* Bandeau « Télécharger l'app » : navigateur du téléphone seulement. */
@media (min-width: 992px) {
    #softrip-app-banner { display: none !important; }
}

/* --------------------------------------------------------------------------
   1. Navigateur d'un téléphone (et mode app sur téléphone)
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    /* Pas de zoom automatique de l'iPhone sur les champs. */
    input:not([type=checkbox]):not([type=radio]):not([type=range]),
    select,
    textarea { font-size: 16px; }

    /* Zones tactiles de l'en-tête (42 px → 44 px). */
    .nav-cart,
    .nav-hamburger,
    .nav-user-avatar { min-width: var(--sr-tap); min-height: var(--sr-tap); }

    /* --- Pilote 1 : listes « Mes réservations » --- */
    .flight-booking-card,
    .car-booking-card { border-radius: var(--sr-radius); }
    .flight-booking-card .flight-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 12px;
    }
    .flight-booking-card .flight-detail-item { min-width: 0; }
    .flight-booking-card .flight-detail-item .value { overflow-wrap: anywhere; }
    .flight-booking-card .btn,
    .car-booking-card .btn,
    .flight-booking-card .fb-actions a,
    .car-booking-card .booking-actions a {
        min-height: var(--sr-tap);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .user-sidebar-link { min-height: var(--sr-tap); }

    /* --- Pilote 2 : paiement --- */
    /* Mobile Money (paiement principal, XAF) en premier. */
    .payment-selection .payment-methods { display: flex; flex-direction: column; }
    .payment-selection .payment-method:has(.mypvit-btn) { order: -1; }
    .payment-selection .payment-method:has(.payment-btn.disabled) { order: 1; }
}

/* --------------------------------------------------------------------------
   2. Mode app : html.app-shell
   -------------------------------------------------------------------------- */
html.app-shell body {
    padding-bottom: calc(var(--sr-tabbar-h) + var(--sr-safe-bottom));
    background: #f6f7fb;
}

/* Pas de pied de page, de bandeau, d'installation ni de fil d'Ariane du site. */
html.app-shell .modern-footer,
html.app-shell footer,
html.app-shell #softrip-app-banner,
html.app-shell .mobile-breadcrumb,
html.app-shell .user-dashboard-mobile-bar,
html.app-shell .user-sidebar-profile { display: none !important; }

/* Barre du bas. */
html.app-shell .app-tabbar {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    height: calc(var(--sr-tabbar-h) + var(--sr-safe-bottom));
    padding: 0 4px var(--sr-safe-bottom);
    background: #fff;
    border-top: 1px solid var(--sr-line);
    box-shadow: 0 -6px 18px rgba(15, 23, 42, .06);
}
.app-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: var(--sr-tap);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--sr-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
}
.app-tab:hover { color: var(--sr-blue); }
.app-tab.active { color: var(--sr-blue); }
.app-tab.active .app-tab-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -9px;
    width: 26px;
    height: 3px;
    margin-left: -13px;
    border-radius: 3px;
    background: var(--sr-blue);
}
.app-tab-icon { position: relative; font-size: 20px; line-height: 1; }
.app-tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tab-badge {
    position: absolute;
    top: -7px;
    right: -11px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--sr-red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

/* En-tête compact : retour, logo réduit, panier et compte. */
html.app-shell .nav-inner { height: 56px !important; }
html.app-shell .nav-logo img { height: 32px !important; }
html.app-shell .site-navbar { background: #fff; }
html.app-shell .app-back {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: var(--sr-tap);
    height: var(--sr-tap);
    margin-right: 4px;
    border-radius: 50%;
    color: var(--sr-blue);
    font-size: 18px;
    text-decoration: none;
}
html.app-shell .app-back:active { background: var(--sr-blue-soft); }
html.app-shell .nav-logo-wrap { display: flex; align-items: center; }
html.app-shell.is-home .app-back { display: none !important; }

/* Pas de bouton WhatsApp en mode app (Median / test : non rendu ; PWA : ici). */
html.app-shell .whatsapp-float { display: none !important; }

/* Titre de page compact (bandeau bleu des espaces client). */
html.app-shell .bookings-hero {
    padding: 16px 0 14px !important;
    min-height: 0 !important;
    text-align: left;
}
html.app-shell .bookings-hero::before { display: none !important; }
html.app-shell .bookings-hero .hero-content { text-align: left !important; padding: 0 !important; }
html.app-shell .bookings-hero .hero-title {
    font-size: 21px !important;
    line-height: 1.25 !important;
    margin: 0 !important;
}
html.app-shell .bookings-hero .hero-subtitle { display: none !important; }
html.app-shell .innerpagewrap { padding-top: 12px !important; }

/* Onglets de l'espace client : libellés entiers, en pastilles. */
html.app-shell .user-sidebar-wrap {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
}
html.app-shell .user-sidebar-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 6px !important;
    scrollbar-width: none;
}
html.app-shell .user-sidebar-nav::-webkit-scrollbar { display: none; }
html.app-shell .user-sidebar-link {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    gap: 6px;
    width: auto !important;
    min-width: 0 !important;
    min-height: 40px !important;
    padding: 8px 14px !important;
    border-radius: 999px !important;
    background: #fff !important;
    border: 1px solid var(--sr-line) !important;
    color: var(--sr-text) !important;
    white-space: nowrap;
}
html.app-shell .user-sidebar-link.active {
    background: var(--sr-blue) !important;
    border-color: var(--sr-blue) !important;
    color: #fff !important;
}
html.app-shell .user-sidebar-link .user-sidebar-icon { width: auto !important; height: auto !important; background: none !important; font-size: 14px; color: inherit !important; }
html.app-shell .user-sidebar-link .user-sidebar-label {
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 13px !important;
    color: inherit !important;
}
html.app-shell .user-sidebar-logout { display: none !important; }

/* --- Pilote 1 : cartes de réservation --- */
html.app-shell .flight-booking-card,
html.app-shell .car-booking-card {
    border: 0 !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .06) !important;
    margin-bottom: 14px !important;
}
html.app-shell .flight-booking-card .passenger-info { display: none; }
html.app-shell .flight-booking-card .fb-actions,
html.app-shell .car-booking-card .booking-actions {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
}
html.app-shell .flight-booking-card .fb-actions > *,
html.app-shell .car-booking-card .booking-actions > * { width: 100% !important; }
html.app-shell .flight-booking-card .fb-footer,
html.app-shell .car-booking-card .booking-footer { flex-direction: column; align-items: stretch !important; gap: 12px; }

/* --- Pilote 2 : paiement --- */
/* Moyens indisponibles ou « bientôt » : retirés de l'écran en mode app. */
html.app-shell .payment-selection .payment-method:has(.payment-btn.disabled) { display: none !important; }
html.app-shell .payment-selection .payment-methods { display: flex; flex-direction: column; }
html.app-shell .payment-selection .payment-method:has(.mypvit-btn) { order: -1; }

/* Fenêtre MyPVit en feuille du bas. */
@media (max-width: 767.98px) {
    html.app-shell #mypvitModal .modal-dialog {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        max-width: none;
        width: 100%;
        transform: none;
    }
    html.app-shell #mypvitModal .modal-content {
        border-radius: 22px 22px 0 0 !important;
        max-height: 92vh;
        overflow-y: auto;
        padding-bottom: var(--sr-safe-bottom);
    }
}

/* Bouton d'action fixé au-dessus de la barre du bas (ex. « Payer »),
   en mode app seulement. */
.sr-action-bar { display: none !important; }
html.app-shell .sr-action-bar {
    display: block !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--sr-tabbar-h) + var(--sr-safe-bottom));
    z-index: 1025;
    padding: 10px 16px;
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--sr-line);
    box-shadow: 0 -4px 14px rgba(15, 23, 42, .06);
}
html.app-shell .sr-action-bar .btn { width: 100%; min-height: 48px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
html.app-shell body:has(.sr-action-bar) { padding-bottom: calc(var(--sr-tabbar-h) + 72px + var(--sr-safe-bottom)); }

/* Aides à l'installation (fenêtre #pwaInstallHelp) : étapes illustrées. */
.pwa-help-steps { list-style: none; padding: 0; margin: 0; }
.pwa-help-steps li { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-height: var(--sr-tap); }
.pwa-help-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--sr-blue-soft);
    color: var(--sr-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* --------------------------------------------------------------------------
   Repris de l'ancien css/app-mode.css (retiré le 06/11/2026)
   -------------------------------------------------------------------------- */
html.app-shell .hide-in-app,
html.app-shell .hide-in-app-hero-text,
html.app-shell .hide-in-app-features,
html.app-shell .hide-in-app-testimonials,
html.app-shell .hide-in-app-newsletter,
html.app-shell .nav-brand-name,
html.app-shell .hero-wrapper video { display: none !important; }
html.app-shell .hero-section { padding: 20px 0; }
html.app-shell .search-tab-btn .tab-icon { display: none !important; }
html.app-shell .search-tab-btn {
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    min-height: var(--sr-tap);
    background: #fff !important;
    color: var(--sr-blue) !important;
    border: 1.5px solid var(--sr-blue) !important;
    box-shadow: none !important;
}
html.app-shell .search-tab-btn.active {
    background: var(--sr-blue) !important;
    color: #fff !important;
}

/* --------------------------------------------------------------------------
   Ajustements des pilotes (mode app)
   -------------------------------------------------------------------------- */
/* Le panier est dans la barre du bas : pas de doublon dans l'en-tête. */
html.app-shell .nav-cart { display: none !important; }

/* Listes : pas de carte autour des cartes. */
html.app-shell .dashtask {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
}
html.app-shell .user-main-col { margin-top: 0 !important; }
html.app-shell .dashboard-layout { --bs-gutter-y: .5rem; }

/* Détail sans valeur (« Non disponible ») : masqué sur téléphone et en mode app. */
@media (max-width: 767.98px) {
    .flight-detail-item.fb-detail-na { display: none !important; }
}
html.app-shell .flight-detail-item.fb-detail-na { display: none !important; }

/* Paiement : titre compact. */
html.app-shell .payment-selection { padding-top: 12px !important; }
html.app-shell .payment-selection .payment-card { padding: 16px !important; border-radius: var(--sr-radius) !important; }
html.app-shell .payment-selection .payment-header { margin-bottom: 14px !important; padding: 0 !important; text-align: left !important; }
html.app-shell .payment-selection .payment-header h2 { font-size: 20px !important; margin: 0 !important; }
html.app-shell .payment-selection .payment-header p { display: none !important; }

/* Fenêtre MyPVit : la feuille touche le bas de l'écran. */
@media (max-width: 767.98px) {
    html.app-shell #mypvitModal .modal-dialog { min-height: 0 !important; height: auto !important; display: block !important; }
}


/* --------------------------------------------------------------------------
   Champ + bouton collé (06/11/2026) : jamais empilés, jamais en pleine largeur.
   Cause : css/style.css, sous 768 px, met tout .input-group en colonne et tous
   les .btn à 100 % — le champ « mot de passe » était réduit à un carré et le
   bouton « œil » passait dessous en pleine largeur (aussi : code promo, scan,
   lien revendeur…). Ici, même seuil (max-width: 768px), tous modes (navigateur,
   Median, PWA) ; l'ordinateur n'est pas concerné.
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .input-group {
        flex-direction: row;
        flex-wrap: wrap; /* le message d'erreur (.invalid-feedback) passe dessous */
        align-items: stretch;
    }
    .input-group > .form-control,
    .input-group > .form-select,
    .input-group > input:not([type=hidden]),
    .input-group > textarea {
        flex: 1 1 auto;
        width: 1%;
        min-width: 0;
    }
    .input-group > .btn,
    .input-group > button,
    .input-group > a.btn,
    .input-group > .input-group-text {
        flex: 0 0 auto;
        width: auto;
        min-width: var(--sr-tap);
        min-height: var(--sr-tap);
    }
    /* Même règle pour un bouton collé à un champ dans une simple rangée flex. */
    .d-flex > .form-control ~ .btn,
    .d-flex > .form-control ~ button {
        flex: 0 0 auto;
        width: auto;
        min-width: var(--sr-tap);
    }
}
