/* Talaria — WebApp : adaptation à tous les écrans
   Points de rupture : 1280 (laptop) · 1180 (tablette paysage, rail d'icônes) · 900 (tablette portrait / mobile, barre d'onglets) · 600 · 420 (petits mobiles) */

/* éléments propres au mobile : masqués par défaut */
.topbar__logo, .tabbar, .btn-filtres, .filtres-fermer, .filtres-appliquer { display: none; }
body.no-scroll { overflow: hidden; }
:root { --tabbar-h: 68px; }

/* ───────────────────────── ≤ 1280 : laptop ───────────────────────── */
@media (max-width: 1280px) {
    .grille-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grille-voy-p { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .votes-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vols-colonnes { flex-wrap: wrap; }
    .vols-lateral { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .vols-lateral > * { flex: 1 1 280px; }
    .suggestions { flex-direction: column; }
    .suggestions__cote { width: 100%; }
}

/* ───────────────────────── 768 – 1180 : tablette — rail de 88 px (maquettes « Tablette · 834 px ») ───────────────────────── */
.logo-rail { display: none; }
.nav-court { display: none; }
@media (min-width: 768px) and (max-width: 1180px) {
    :root { --sidebar-w: 88px; }
    .sidebar { padding: var(--espace-lg) 0; align-items: center; gap: var(--espace-lg); overflow-x: hidden; }
    .sidebar__logo { padding: 0; }
    .sidebar__logo .logo-h { display: none; }
    .sidebar__logo .logo-rail { display: block; width: 50.4px; height: 40px; }
    .sidebar nav { width: 100%; align-items: center; gap: var(--espace-xs); }
    .nav-link { flex-direction: column; justify-content: center; gap: var(--espace-2xs); width: 64px; height: 56px; padding: 0; border-radius: var(--rayon-lg); font: 500 11px/1.2 var(--font-titre); }
    .nav-link .icon { width: 24px; height: 24px; }
    .nav-long { display: none; }
    .nav-court { display: inline; }
    .sidebar .btn-nouveau { width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 0; gap: 0; justify-content: center; }
    .sidebar__espace, .sidebar__invite { display: none; }
    .sidebar__user { border: 0; padding: 0; margin-top: 10px; }
    .sidebar__user img { width: 44px; height: 44px; }
    .sidebar__user > div, .sidebar__user > .icon { display: none; }
    .sidebar__connexion { width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 0; gap: 0; justify-content: center; }
    .topbar { padding-left: var(--espace-xl); padding-right: var(--espace-xl); }
    .topbar__recherche { width: 460px; max-width: 100%; flex: none; }
    .page { padding-left: var(--espace-lg); padding-right: var(--espace-lg); }
    .liste-lieux, .panneau-explorer { width: 340px; }
    .params-menu { width: 280px; }
}

@media (max-width: 1100px) {
    .ligne-principale, .cols, .amis-colonnes, .creer-cols, .profil-cols, .params-cols { flex-direction: column; align-items: stretch; }
    .colonne-laterale, .cols__lat, .amis-lateral, .recap, .profil-droite, .params-menu { width: 100%; }
    .prochain { min-height: 380px; }
    .filtres-vols { width: 100%; }
    .vols-colonnes { flex-direction: column; }
    .profil-infos { flex-wrap: wrap; }
    .profil-boutons { width: 100%; }
    .criteres { flex-wrap: wrap; border-radius: var(--rayon-lg); }
    .critere--depart, .critere--dest, .critere--dates, .critere--voy { flex: 1 1 200px; width: auto; }
    .recap { display: grid; grid-template-columns: 220px 1fr; }
    .recap > img { height: 100%; min-height: 220px; }
}

/* ───────────────────────── ≤ 900 : mobile & tablette portrait ───────────────────────── */
@media (max-width: 767px) {
    :root { --topbar-h: 69px; --sidebar-w: 0px; --tabbar-h: 72px; }
    html { -webkit-text-size-adjust: 100%; }
    .app { flex-direction: column; }
    .sidebar { display: none; }
    .main { padding-bottom: calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)); }

    /* en-tête mobile (maquette « WebApp/En-tête mobile ») : logo, recherche, notifications, avatar */
    .topbar { position: sticky; top: 0; z-index: 50; height: calc(69px + env(safe-area-inset-top)); min-height: 0; gap: var(--espace-xs); padding: 12px var(--espace-md); padding-top: calc(12px + env(safe-area-inset-top)); background: var(--color-fond-page); border-bottom: 1px solid var(--color-bordure-subtile); color: var(--color-texte-principal); }
    .topbar__logo { display: flex; flex: none; margin-right: auto; padding-left: 9.6px; }
    .topbar__logo img { width: 88px; height: auto; }
    .topbar__recherche { flex: none; width: 44px; height: 44px; padding: 0; gap: 0; justify-content: center; border-radius: 50%; font-size: 0; }
    .topbar__recherche > span, .topbar__recherche .kbd { display: none; }
    .topbar__actions { gap: var(--espace-xs); }
    .topbar__actions .pill { display: none; }
    .topbar__actions .btn-rond { width: 44px; height: 44px; background: var(--color-fond-surface-pleine); border: 1px solid var(--color-bordure-defaut); color: var(--color-texte-principal); }
    .topbar__avatar img { width: 40px; height: 40px; border: 0; }

    /* barre d'onglets flottante (maquette « Navbar ») */
    .tabbar { position: fixed; left: 15px; right: 15px; bottom: calc(15px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; justify-content: space-between; height: var(--tabbar-h); padding: 0 var(--espace-sm); background: rgba(253, 250, 241, 0.96); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid var(--color-bordure-subtile); border-radius: 48px; box-shadow: 0 8px 12px rgba(79, 32, 62, 0.14); }
    .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--espace-2xs); width: 64px; height: 56px; min-width: 0; color: var(--color-texte-principal); opacity: 0.7; font: 500 10px/1 var(--font-titre); -webkit-tap-highlight-color: transparent; }
    .tab__ico { display: flex; align-items: center; justify-content: center; width: 52px; height: 32px; border-radius: var(--rayon-pilule); transition: background 0.2s ease; }
    .tab .icon { width: 22px; height: 22px; }
    .tab[aria-current='page'] { opacity: 1; font-weight: 600; }
    .tab[aria-current='page'] .tab__ico { background: var(--color-fond-accent-lavande); }
    .tab--fab { opacity: 1; }
    .tab--fab .tab__ico { width: 48px; margin: 0; background: var(--color-fond-marque); color: #fff; box-shadow: none; }
    .tab--fab[aria-current='page'] .tab__ico { background: var(--color-fond-marque); }
    .toast { bottom: calc(var(--tabbar-h) + 15px + env(safe-area-inset-bottom) + 14px); width: max-content; max-width: calc(100vw - 32px); text-align: center; }

    /* pages */
    .page { gap: 20px; padding: 20px 16px 28px; }
    .page--serree { gap: 16px; }
    .t-titre { font-size: 30px; }
    .page-entete { align-items: stretch; gap: 14px; }
    .page-entete__actions { width: 100%; gap: 8px; }
    .page-entete__actions > .btn, .page-entete__actions > .onglets { flex: 1 1 auto; }
    .page-entete__actions > .onglets { display: flex; }
    .page-entete__actions > .onglets > * { flex: 1; }
    .section-titre { gap: 8px; }

    .grille-4, .votes-grille, .indicateurs, .amis-grille, .amis-choix { grid-template-columns: 1fr; }
    .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .voyages-grille { grid-template-columns: 1fr; gap: 16px; }
    .jours, .calendrier-prix { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
    .jours::-webkit-scrollbar, .calendrier-prix::-webkit-scrollbar { display: none; }
    .jours > *, .calendrier-prix > * { flex: 0 0 auto; scroll-snap-align: start; }
    .jour-p { width: 68px; }
    .jour { min-width: 96px; }

    /* accueil */
    .prochain { min-height: 340px; }
    .finances__montants b { font-size: 28px; }

    /* recherche (volet) */
    .fond-voile { left: 0; top: var(--topbar-h); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0; align-items: stretch; }
    .panneau-recherche { width: 100%; padding: 16px; gap: 16px; border-radius: 0; overflow-y: auto; }
    .criteres, .barre-recherche { display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--rayon-lg); gap: 6px; padding: 8px; }
    .criteres .critere, .barre-recherche .critere { width: auto !important; flex: none; padding: 10px 12px; border-radius: var(--rayon-md); background: var(--color-fond-marque-tres-leger); min-width: 0; }
    .criteres .critere--dest, .criteres .critere--depart, .criteres .critere--dates { grid-column: 1 / -1; }
    .criteres #swap { display: none; }
    .criteres .btn--l, .barre-recherche .btn { grid-column: 1 / -1; width: 100%; justify-content: center; }
    .dates-champs input { width: 50%; }
    .explorer { flex-direction: column; align-items: stretch; text-align: left; }
    .explorer .btn { width: 100%; }
    .raccourcis { display: none; }

    /* vols */
    .vol { flex-direction: column; }
    .vol__prix { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-left: 0; border-top: 1px solid var(--color-bordure-subtile); }
    .vol__prix .gros { flex: 1 1 100%; }
    .vol__prix .btn { flex: 1 1 140px; }
    .trajet { flex-wrap: nowrap; gap: 10px; }
    .trajet__h b { font-size: 20px; }
    .vols-colonnes { gap: 16px; }
    .btn-filtres { display: inline-flex; align-self: flex-start; }
    .filtres-vols { display: none; }
    .filtres-vols.ouvert { display: flex; position: fixed; inset: 0; z-index: 120; gap: 20px; padding: calc(16px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--color-fond-page); animation: feuille 0.28s ease; }
    .filtres-fermer { display: inline-flex; }
    .filtres-vols__titre { gap: 12px; }
    .filtres-vols__titre #reset { margin-left: auto; }
    .filtres-appliquer { display: flex; position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 121; box-shadow: 0 10px 30px rgba(79, 32, 62, 0.3); }
    .tris { flex-direction: row; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
    .tris .tri { flex: 0 0 auto; min-width: 150px; }
    .mini-carte { display: none; }
    .comparateur { padding: var(--espace-md); }
    .comparateur__liste { grid-template-columns: 1fr; }
    .compteur-vols { flex-wrap: wrap; row-gap: 8px; }

    /* voyage */
    .voyage-entete { height: auto; min-height: 230px; gap: 28px; padding: 16px; border-radius: var(--rayon-lg); }
    .voyage-entete h1 { font-size: 34px; }
    .voyage-entete__haut { flex-wrap: wrap; gap: 8px; }
    .voyage-entete__bas { flex-direction: column; align-items: flex-start; gap: 12px; }
    .btn-sur-photo { height: 40px; padding: 0 14px; font-size: 14px; }
    .onglets-voyage { gap: 0; margin: 0 -16px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; background: var(--color-fond-page); position: sticky; top: var(--topbar-h); z-index: 30; }
    .onglet-v { flex: 1; justify-content: center; padding: 12px 6px; font-size: 14px; white-space: nowrap; }
    .act { flex-wrap: wrap; row-gap: 6px; }
    .act__h { width: 48px; }
    .act__photo { width: 72px; height: 56px; }
    .act__txt { flex: 1 1 calc(100% - 140px); }
    .act > .tag { margin-left: 60px; }
    .table-ligne .cat, .table-ligne .par, .table-ligne--titres span:nth-child(2), .table-ligne--titres span:nth-child(3) { display: none; }
    .chat-msgs { min-height: 0; max-height: 58dvh; overflow-y: auto; padding: 16px; }
    .saisie-bar { position: sticky; bottom: 0; }

    /* découvrir & explorer : la carte d'abord, la liste dessous */
    .page--split { flex-direction: column; height: auto; min-height: 0; }
    .page--split > .carte-zone { order: -1; flex: none; height: 62dvh; min-height: 400px; }
    .liste-lieux, .panneau-explorer { width: 100%; overflow: visible; border: 0; padding: 16px; }
    .liste-lieux { border-top: 1px solid var(--color-bordure-subtile); }
    .carte-filtres, .filtres-carte { right: 68px; left: 12px; top: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
    .carte-filtres::-webkit-scrollbar, .filtres-carte::-webkit-scrollbar { display: none; }
    .carte-filtres .pill, .filtres-carte .pill { flex: none; }
    .zoom, .carte-boutons { right: 12px; top: 12px; }
    .zoom button { width: 40px; height: 40px; }
    .fiche-lieu, .fiche-dest { left: 10px; right: 10px; bottom: 10px; width: auto; max-width: none; max-height: 50%; overflow-y: auto; margin: 0; border-radius: var(--rayon-lg); }
    .fiche-lieu > img, .fiche-dest > img { display: none; }
    .monde-scene { transform-origin: 0 0; transform: scale(0.43) !important; }
    .carte-boutons { display: none; }
    .page--split > .carte-zone .monde { height: 100%; }
    .carte-scene { left: 50%; margin-left: -396px; }
    .categories { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
    .categories::-webkit-scrollbar { display: none; }
    .categories .pill { flex: none; }

    /* création */
    .etapes-wizard { gap: 6px; padding: 6px; overflow-x: auto; scrollbar-width: none; justify-content: center; }
    .etape-w { flex: none; padding: 4px; gap: 8px; }
    .etape-w > div { display: none; }
    .etape-w--actif { padding-right: 14px; }
    .etape-w--actif > div { display: flex; }
    .etape-w--actif small { display: none; }
    .champ-ligne2 { flex-direction: column; }
    .formulaire { padding: 20px 16px; gap: 18px; }
    .nav-etapes { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
    .nav-etapes .btn { width: 100%; justify-content: center; }
    .recap { display: block; }
    .recap > img { height: 150px; min-height: 0; }
    .vol-suggere { flex-wrap: wrap; }
    .logement-sel { flex-direction: column; }
    .logement-sel > img { width: 100%; height: 180px; }
    .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* profil */
    .profil-couv { height: 150px; }
    .profil-couv__tags { left: 12px; top: 12px; flex-wrap: wrap; }
    .profil-infos { flex-direction: column; align-items: center; gap: 12px; padding: 0 16px 16px; text-align: center; }
    .profil-avatar { width: 112px; height: 48px; }
    .profil-avatar img { width: 112px; height: 112px; top: -64px; }
    .profil-avatar .avatar--init { width: 112px !important; height: 112px !important; top: -64px; font-size: 42px !important; }
    .profil-identite { align-items: center; }
    .profil-meta { justify-content: center; }
    .profil-boutons { width: 100%; }
    .profil-boutons .btn { flex: 1; }
    .profil-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }
    .stat { padding: 12px; gap: 10px; }
    .stat .pastille { width: 44px; height: 44px; }
    .stat b { font-size: 26px; }
    .profil-onglets { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
    .profil-onglets .pill { flex: none; }
    .grille-voy-p { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .voy-p__photo { height: 120px; }
    .article img { width: 72px; height: 56px; }

    /* paramètres */
    .params-menu { padding: 12px; }
    .params-entree { height: 52px; }
    .params-panneau { padding: 20px 16px; gap: 20px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
    .params-panneau > h2 { font-size: 28px; }
    .params-ligne { flex-wrap: wrap; padding: 14px; gap: 10px 12px; }
    .params-ligne > div { flex: 1 1 140px; }

    /* amis */
    .amis-outils { flex-wrap: wrap; }
    .amis-outils .saisie { flex: 1 1 100%; }
    .ami__boutons .btn { flex: 1; justify-content: center; }

    /* boîtes de dialogue : feuille qui monte du bas */
    .dialogue-voile { align-items: flex-end; padding: 0; }
    .dialogue { width: 100%; max-height: 92dvh; overflow-y: auto; padding: 22px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; animation: feuille 0.28s ease; }
    .dialogue:has(#carte-route) { width: 100%; }
    .dialogue .champ-ligne { flex-direction: column; }
    .dialogue .actions { flex-direction: column-reverse; }
    .dialogue .actions .btn { width: 100%; justify-content: center; }

    /* saisies : 16 px minimum pour éviter le zoom automatique d'iOS */
    input, select, textarea { font-size: 16px; }
    .menu-contextuel { max-width: calc(100vw - 16px); }
}

@keyframes feuille { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────────────────────── ≤ 600 ───────────────────────── */
@media (max-width: 600px) {
    .t-titre { font-size: 28px; }
    .grille-4 { grid-template-columns: 1fr; }
    .bons-plans, .grille-bons { grid-template-columns: 1fr; }
    .vol__trajets { padding: 14px; }
    .trajet__cie { display: none; }
    .page-entete__actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
    .page-entete__actions > .onglets { flex: 1 1 100%; }
    .modes { grid-template-columns: 1fr 1fr; }
}

/* ───────────────────────── ≤ 420 : petits mobiles ───────────────────────── */
@media (max-width: 420px) {
    .indicateurs { grid-template-columns: 1fr 1fr; gap: 10px; }
    .indic b { font-size: 24px; }
    .voyage-entete h1 { font-size: 30px; }
    .stat b { font-size: 24px; }
    .grille-voy-p { grid-template-columns: 1fr 1fr; }
    .mode { padding: 12px; }
}

/* ───────────────────────── écrans tactiles ───────────────────────── */
@media (hover: none) and (pointer: coarse) {
    .btn--xs, .pill--xs { min-height: 40px; }
    .jour:hover, .jour-p:hover, .repere:hover { box-shadow: none; transform: none; }
    .toggle { min-width: 52px; }
    .ligne-case { min-height: 44px; }
}

/* ───────────────────────── mobile en paysage (peu de hauteur) ───────────────────────── */
@media (max-width: 767px) and (max-height: 480px) {
    :root { --tabbar-h: 56px; --topbar-h: 56px; }
    .tab__txt { display: none; }
    .tab { height: 44px; }
    .tab--fab .tab__ico { margin-top: -10px; width: 44px; height: 44px; }
    .page--split > .carte-zone { height: 80dvh; }
    .dialogue { max-height: 96dvh; }
}

@media (prefers-reduced-motion: reduce) {
    .filtres-vols.ouvert, .dialogue { animation: none; }
}

@media (max-width: 767px) {
    .profil-boutons { flex-wrap: wrap; }
    .profil-boutons .btn { flex: 1 1 150px; min-width: 0; padding-inline: 14px; }
    .voyage-entete__haut { flex-wrap: nowrap; justify-content: space-between; align-items: center; }
    .voyage-entete__actions { display: flex; gap: 8px; }
    .voyage-entete__actions .btn-sur-photo { width: 40px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
    .voyage-entete__actions .btn-sur-photo .icon { width: 20px; height: 20px; }
}

@media (max-width: 1100px) {
    .vols-colonnes { flex-wrap: nowrap; align-items: stretch; }
    .vols-colonnes > * { min-width: 0; }
    .vols-resultats { width: 100%; }
}
@media (max-width: 767px) {
    .vote__btns { flex-wrap: wrap; }
    .vote__btns .btn { flex: 1 1 120px; }
}

@media (max-width: 767px) {
    .votes-resume { flex-direction: column; align-items: stretch; gap: 12px; }
    .votes-resume .btn { width: 100%; justify-content: center; }
}

/* boutons qui ne doivent jamais dépasser de leur conteneur */
@media (max-width: 767px) {
    .prochain { padding: 20px 16px; }
    .prochain__titre { font-size: 38px; }
    .prochain__bas { flex-direction: column; align-items: stretch; gap: 16px; }
    .prochain__bas > .btn { width: 100%; justify-content: center; }
    .prochain__haut { flex-wrap: wrap; }
    .act-proposee { flex-direction: column; }
    .act-proposee img { width: 100%; height: 110px; }
    .act-proposee > div { min-width: 0; }
    .act-proposee .btns { flex-wrap: wrap; }
    .act-proposee .btns .btn { flex: 1 1 110px; justify-content: center; }
}
.btn, .pill, .tag { max-width: 100%; }
.btn { white-space: normal; text-align: center; }
.btn--xs, .btn--s, .pill, .pill--xs { white-space: nowrap; }
.ami .tag, .ami__haut + .tag { height: auto; min-height: 32px; padding-block: 6px; white-space: normal; text-align: left; line-height: 1.25; }
.section-titre .lien-action, .section-titre > a { white-space: nowrap; flex: none; }
.section-titre > h2 { min-width: 0; }
