/* =====================================================================
   HaliTrace — Feuille de style
   Palette ancrée dans le monde de la pêche sénégalaise :
   bleu Atlantique profond, teal des eaux côtières, corail des pirogues.
   ================================================================== */

:root {
    --ht-abysse:   #0B2A3A;   /* bleu profond — barre latérale, texte fort */
    --ht-ocean:    #12506B;   /* bleu océan — primaire */
    --ht-lagune:   #1D9E8A;   /* teal lagune — accents, succès doux */
    --ht-corail:   #E5613C;   /* corail pirogue — action, alertes chaudes */
    --ht-sable:    #F5F1E8;   /* sable — fond de page */
    --ht-ecume:    #FFFFFF;   /* écume — cartes */
    --ht-brume:    #6B7B84;   /* gris-bleu — texte secondaire */
    --ht-ligne:    #E1E6E9;   /* hairline */

    --ht-radius:   14px;
    --ht-shadow:   0 1px 3px rgba(11, 42, 58, .06), 0 8px 24px rgba(11, 42, 58, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--ht-sable);
    color: var(--ht-abysse);
    -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------
   Écran d'authentification
   ---------------------------------------------------------------------- */
.ht-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(29, 158, 138, .18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(229, 97, 60, .14), transparent 55%),
        var(--ht-abysse);
}

.ht-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--ht-ecume);
    border-radius: var(--ht-radius);
    padding: 2.5rem 2.25rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
    animation: ht-rise .6s cubic-bezier(.22, 1, .36, 1) both;
}

.ht-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -.02em;
    color: var(--ht-abysse);
}

.ht-brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--ht-ocean);
    color: #fff;
    flex: none;
}

/* -------------------------------------------------------------------------
   Structure application (sidebar + contenu)
   ---------------------------------------------------------------------- */
.ht-shell { display: flex; min-height: 100vh; }

.ht-sidebar {
    width: 250px;
    flex: none;
    background: var(--ht-abysse);
    color: #cfe0e7;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.ht-sidebar::-webkit-scrollbar { width: 6px; }
.ht-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }

.ht-sidebar .ht-brand { color: #fff; font-size: 1.2rem; margin-bottom: 1.75rem; }

.ht-nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }

.ht-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    border-radius: 10px;
    color: #a9c0ca;
    text-decoration: none;
    font-size: .93rem;
    font-weight: 500;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.ht-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; transform: translateX(2px); }
.ht-nav a.active { background: var(--ht-ocean); color: #fff; }
.ht-nav a i { width: 20px; text-align: center; font-size: 1.05rem; }

.ht-nav-section {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5c7783;
    margin: 1.1rem .8rem .35rem;
}

.ht-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.ht-topbar {
    height: 64px;
    background: var(--ht-ecume);
    border-bottom: 1px solid var(--ht-ligne);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 20;
}

.ht-content { padding: 1.75rem 1.5rem; flex: 1; }

/* -------------------------------------------------------------------------
   Cartes, statistiques
   ---------------------------------------------------------------------- */
.ht-card {
    background: var(--ht-ecume);
    border: 1px solid var(--ht-ligne);
    border-radius: var(--ht-radius);
    box-shadow: var(--ht-shadow);
}

.ht-stat {
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    animation: ht-rise .5s ease both;
}
.ht-stat-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.ht-stat-label { color: var(--ht-brume); font-size: .85rem; font-weight: 500; }
.ht-stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; font-size: 1.15rem; margin-bottom: .35rem;
}
.ht-i-ocean  { background: rgba(18, 80, 107, .1);  color: var(--ht-ocean); }
.ht-i-lagune { background: rgba(29, 158, 138, .12); color: var(--ht-lagune); }
.ht-i-corail { background: rgba(229, 97, 60, .12);  color: var(--ht-corail); }
.ht-i-abysse { background: rgba(11, 42, 58, .08);   color: var(--ht-abysse); }

/* Décalage d'entrée pour un déploiement en cascade */
.ht-stagger > * { opacity: 0; animation: ht-rise .5s ease forwards; }
.ht-stagger > *:nth-child(1) { animation-delay: .04s; }
.ht-stagger > *:nth-child(2) { animation-delay: .10s; }
.ht-stagger > *:nth-child(3) { animation-delay: .16s; }
.ht-stagger > *:nth-child(4) { animation-delay: .22s; }
.ht-stagger > *:nth-child(5) { animation-delay: .28s; }
.ht-stagger > *:nth-child(6) { animation-delay: .34s; }

/* -------------------------------------------------------------------------
   Boutons & badges (surcouche Bootstrap)
   ---------------------------------------------------------------------- */
.btn-ht {
    background: var(--ht-ocean);
    border: none; color: #fff; font-weight: 600;
    border-radius: 10px; padding: .55rem 1.1rem;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-ht:hover { background: #0f4459; color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(18, 80, 107, .25); }

.btn-corail { background: var(--ht-corail); border: none; color: #fff; font-weight: 600; border-radius: 10px; }
.btn-corail:hover { background: #cf5030; color: #fff; }

.ht-timeline { position: relative; padding-left: 1.5rem; }
.ht-timeline::before {
    content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px;
    width: 2px; background: var(--ht-ligne);
}
.ht-timeline-item { position: relative; padding-bottom: 1.1rem; }
.ht-timeline-item::before {
    content: ""; position: absolute; left: -1.5rem; top: 3px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--ht-lagune); border: 3px solid var(--ht-sable);
}

/* -------------------------------------------------------------------------
   Animations
   ---------------------------------------------------------------------- */
@keyframes ht-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* -------------------------------------------------------------------------
   Responsive : la barre latérale passe en haut sur mobile
   ---------------------------------------------------------------------- */
/* Bouton hamburger (masqué sur desktop via d-lg-none de Bootstrap) */
.ht-burger {
    border: 1px solid rgba(11,42,58,.12);
    background: #fff;
    border-radius: 9px;
    font-size: 1.25rem;
    line-height: 1;
    padding: .25rem .55rem;
    color: var(--ht-ocean);
}
.ht-burger:hover { background: #f1f5f6; }

/* Overlay sombre derrière le menu mobile */
.ht-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(11,42,58,.5);
    z-index: 1040;
    opacity: 0; transition: opacity .25s ease;
}
.ht-overlay.actif { display: block; opacity: 1; }

@media (max-width: 991px) {
    /* La sidebar devient un panneau qui glisse depuis la gauche */
    .ht-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100%;
        width: 260px;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.22,.61,.36,1);
        z-index: 1050;
        flex-direction: column;
    }
    .ht-sidebar.ouvert { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.25); }
    .ht-nav { flex-direction: column; }
    .ht-nav-section { display: block; }
    /* Le contenu principal prend toute la largeur */
    .ht-main { width: 100%; }
}

@media (min-width: 992px) {
    /* Sur desktop, jamais d'overlay ni de transform */
    .ht-overlay { display: none !important; }
    .ht-sidebar { transform: none !important; }
}

/* Confort tactile général sur petit écran */
@media (max-width: 767px) {
    .ht-topbar { padding-left: .75rem; padding-right: .75rem; }
    .ht-main-inner, .ht-content { padding: 1rem !important; }
    .ht-card { border-radius: 12px; }
    h1.h4, .h4 { font-size: 1.25rem; }
    /* Les tableaux deviennent défilables horizontalement */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    /* Boutons plus faciles à toucher */
    .btn { min-height: 40px; }
    .dropdown-item { padding: .6rem .75rem; }
}

/* =========================================================================
   ANIMATIONS — enrichissement (chantier « animer tout le site »)
   ========================================================================= */

/* Respect de l'accessibilité : on coupe tout si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Révélation au défilement (piloté par app.js via IntersectionObserver) */
[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .55s ease, transform .55s cubic-bezier(.22,.61,.36,1);
    will-change: opacity, transform;
}
[data-reveal].est-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Entrée en cascade des enfants (ex : cartes de statistiques) */
.ht-stagger > * {
    opacity: 0;
    transform: translateY(16px);
    animation: htFadeUp .5s cubic-bezier(.22,.61,.36,1) forwards;
}
.ht-stagger > *:nth-child(1) { animation-delay: .05s; }
.ht-stagger > *:nth-child(2) { animation-delay: .13s; }
.ht-stagger > *:nth-child(3) { animation-delay: .21s; }
.ht-stagger > *:nth-child(4) { animation-delay: .29s; }
.ht-stagger > *:nth-child(5) { animation-delay: .37s; }
.ht-stagger > *:nth-child(6) { animation-delay: .45s; }

@keyframes htFadeUp {
    to { opacity: 1; transform: translateY(0); }
}

/* Apparition douce générique */
@keyframes htFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ht-content > * { animation: htFadeIn .4s ease; }

/* Cartes : élévation au survol */
.ht-card {
    transition: transform .25s ease, box-shadow .25s ease;
}
.ht-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(11,42,58,.10);
}
/* On neutralise l'effet hover sur les cartes contenant un formulaire long
   pour éviter que ça « saute » pendant la saisie */
.ht-card:focus-within {
    transform: none;
}

/* Statistiques : la valeur « pulse » légèrement à l'apparition */
.ht-stat-value {
    animation: htPop .6s cubic-bezier(.18,.89,.32,1.28) both;
    animation-delay: .3s;
}
@keyframes htPop {
    0% { transform: scale(.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Icônes de statistiques : rotation douce au survol de la carte */
.ht-stat-icon { transition: transform .3s ease; }
.ht-card:hover .ht-stat-icon { transform: scale(1.08) rotate(-4deg); }

/* Boutons : ressenti tactile */
.btn { transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-ht:hover, .btn-corail:hover { box-shadow: 0 6px 18px rgba(18,80,107,.25); }

/* Liens de navigation : glissement de l'indicateur */
.ht-nav a {
    transition: background-color .2s ease, color .2s ease, padding-left .2s ease;
}
.ht-nav a:hover { padding-left: 1.15rem; }

/* Lignes de tableau : surbrillance progressive */
.table-hover tbody tr { transition: background-color .18s ease; }

/* Badges : légère apparition */
.badge { transition: transform .15s ease; }
.badge:hover { transform: scale(1.06); }

/* Barre de progression animée (utilisée dans les dashboards) */
.ht-progress {
    height: 8px; border-radius: 99px; background: #E8EEF1; overflow: hidden;
}
.ht-progress > span {
    display: block; height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--ht-ocean), var(--ht-lagune));
    width: 0; animation: htGrow 1.1s cubic-bezier(.22,.61,.36,1) forwards;
    animation-delay: .35s;
}
@keyframes htGrow { to { width: var(--valeur, 0%); } }

/* Chip de statut animée dans les timelines */
.ht-timeline-item { transition: transform .2s ease; }
.ht-timeline-item:hover { transform: translateX(3px); }

/* Spinner de chargement discret (si besoin) */
@keyframes htSpin { to { transform: rotate(360deg); } }
.ht-spin { animation: htSpin .8s linear infinite; }

/* Flottement léger pour les icônes hero de l'accueil */
@keyframes htFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.ht-float { animation: htFloat 4s ease-in-out infinite; }

/* =========================================================================
   DASHBOARD PAR ACTEUR — composants
   ========================================================================= */

/* Bandeau d'accueil personnalisé */
.ht-hero-card {
    background:
        radial-gradient(600px 240px at 12% -30%, rgba(29,158,138,.22), transparent 60%),
        linear-gradient(120deg, var(--ht-abysse), var(--ht-ocean));
    color: #fff; border-radius: 18px; padding: 1.6rem 1.8rem;
    box-shadow: 0 10px 30px rgba(11,42,58,.18);
}
.ht-hello { font-size: 1.35rem; font-weight: 700; }
.ht-hello-sub { color: #cfe0e7; font-size: .92rem; margin-top: .15rem; }
.ht-role-badge {
    background: rgba(255,255,255,.16); color: #fff; font-weight: 600;
    padding: .5rem .85rem; border-radius: 99px; backdrop-filter: blur(4px);
}

/* Cartes d'accès rapide */
.ht-action {
    display: flex; align-items: center; gap: .9rem;
    padding: 1rem 1.1rem; border-radius: 14px; text-decoration: none;
    background: #fff; border: 1px solid #E8EEF1; color: var(--ht-abysse);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ht-action:hover {
    transform: translateY(-2px); box-shadow: 0 10px 24px rgba(11,42,58,.10);
    border-color: transparent;
}
.ht-action-icon {
    width: 44px; height: 44px; border-radius: 11px; flex: none;
    display: grid; place-items: center; font-size: 1.25rem; color: #fff;
}
.ht-action-title { font-weight: 600; font-size: .95rem; }
.ht-action-desc { font-size: .78rem; color: var(--ht-gris, #6B7B84); }
.ht-action .bi-arrow-right { color: #9AA7AD; transition: transform .2s ease; }
.ht-action:hover .bi-arrow-right { transform: translateX(4px); color: var(--ht-ocean); }

.ht-action-ocean  .ht-action-icon { background: var(--ht-ocean); }
.ht-action-lagune .ht-action-icon { background: var(--ht-lagune); }
.ht-action-corail .ht-action-icon { background: var(--ht-corail); }
.ht-action-abysse .ht-action-icon { background: var(--ht-abysse); }

/* =========================================================================
   RAFFINEMENTS MODERNES (logo, ombres, profondeur, typographie)
   ========================================================================= */

/* Typographie plus soignée */
body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(900px 500px at 100% 0%, rgba(29,158,138,.05), transparent 60%),
        var(--ht-sable, #F5F1E8);
}

/* Logo : légère ombre portée pour le détacher du fond */
.lp-nav img, .ht-sidebar img, .ht-brand img, .ht-auth img { filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }

/* Barre supérieure de l'accueil : verre dépoli plus prononcé */
.lp-nav {
    background: rgba(11, 42, 58, .55) !important;
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: sticky; top: 0; z-index: 50;
}

/* Cartes : ombre plus douce et moderne, bord subtil */
.ht-card {
    border: 1px solid rgba(11,42,58,.06);
    box-shadow: 0 1px 3px rgba(11,42,58,.04), 0 8px 24px rgba(11,42,58,.05);
    border-radius: 16px;
}

/* Boutons principaux : dégradé subtil + ombre colorée */
.btn-ht, .btn-corail {
    border: none;
    background-image: linear-gradient(135deg, var(--ht-ocean), #0d3f56);
    box-shadow: 0 4px 14px rgba(18,80,107,.25);
}
.btn-corail {
    background-image: linear-gradient(135deg, var(--ht-corail), #d24e28);
    box-shadow: 0 4px 14px rgba(229,97,60,.28);
}
.btn-ht:hover, .btn-corail:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* Hero de l'accueil : titre plus grand et lettrage serré */
.lp-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: -.03em;
    text-shadow: 0 2px 20px rgba(0,0,0,.2);
}
.lp-hero .badge {
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(4px);
}

/* Cartes du circuit : numéro en pastille dégradée */
.lp-step-num {
    background: linear-gradient(135deg, var(--ht-ocean), var(--ht-lagune)) !important;
    box-shadow: 0 4px 12px rgba(29,158,138,.3);
}

/* Icônes de fonctionnalités : fond dégradé doux */
.lp-icon {
    background: linear-gradient(135deg, rgba(29,158,138,.14), rgba(18,80,107,.10)) !important;
}

/* Sidebar : marque avec un léger séparateur */
.ht-sidebar .ht-brand {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center;
}

/* Champs de formulaire : focus plus doux et moderne */
.form-control:focus, .form-select:focus {
    border-color: var(--ht-lagune);
    box-shadow: 0 0 0 .2rem rgba(29,158,138,.15);
}

/* Badges plus arrondis */
.badge { border-radius: 7px; font-weight: 600; letter-spacing: .01em; }

/* Tableaux : en-tête plus doux */
.table > thead.table-light th {
    background: #F3F7F8;
    border-bottom: 2px solid #E1EAED;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #5a6f78;
}

/* Topbar de l'app : fond léger translucide */
.ht-topbar {
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(11,42,58,.06);
    position: sticky; top: 0; z-index: 20;
}

/* Scrollbar générale discrète (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(11,42,58,.18); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(11,42,58,.3); background-clip: content-box; }

/* =========================================================================
   BOUTONS & TOPBAR — stylisation
   ========================================================================= */

/* Bouton contour océan (page publique, actions secondaires) */
.btn-outline-ht {
    border: 1.5px solid var(--ht-ocean);
    color: var(--ht-ocean);
    background: transparent;
    font-weight: 600;
    border-radius: 9px;
    transition: all .2s ease;
}
.btn-outline-ht:hover {
    background: var(--ht-ocean);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(18,80,107,.22);
}

/* Bouton du menu utilisateur (topbar) */
.ht-user-btn {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: .3rem .5rem;
    transition: background .2s ease, border-color .2s ease;
}
.ht-user-btn:hover { background: #F1F5F6; border-color: rgba(11,42,58,.08); }

/* Item de déconnexion : rouge doux au survol */
.dropdown-item.text-danger:hover { background: #fdecec; color: #c0392b !important; }

/* Menu déroulant : coins arrondis et ombre douce */
.dropdown-menu {
    border: 1px solid rgba(11,42,58,.08);
    border-radius: 12px;
    padding: .4rem;
    box-shadow: 0 12px 32px rgba(11,42,58,.12);
}
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .9rem; }
.dropdown-item:active { background: var(--ht-ocean); }

/* Messages flash : apparition animée + style plus doux */
.alert {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(11,42,58,.06);
    animation: htSlideDown .4s cubic-bezier(.22,.61,.36,1);
}
@keyframes htSlideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-success { background: #E6F6F1; color: #0f6b52; }
.alert-danger  { background: #FDECEC; color: #b23b3b; }
.alert-info    { background: #E7F2F6; color: #145d76; }
.alert-warning { background: #FCF3E3; color: #97640f; }

/* Bouton corail arrondi pour la caméra (photo profil) */
.btn-corail.rounded-circle { display: grid; place-items: center; }
