/* --- CONFIGURATION GLOBALE --- */
body {
    background-color: var(--bg-color, #f8f9fa); /* Fallback si PHP plante */
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- SÉCURITÉ : HONEYPOT --- */
.hp-field {
    display: none !important;
    visibility: hidden !important;
    opacity: 0;
    position: absolute;
    left: -9999px;
}

/* --- NAVBAR (Structure & Fix Mobile) --- */
/* Z-INDEX BOMBING : On s'assure que rien ne passe devant le header */
header, .navbar-epiquoi {
    position: relative;
    z-index: 9999 !important; /* Au-dessus de tout le site */
}

/* Fix spécifique pour le bouton hamburger */
.navbar-toggler {
    position: relative;
    z-index: 10000 !important; /* Encore plus haut que la navbar */
    cursor: pointer; /* Force le curseur main */
}

.navbar-epiquoi {
    /* La couleur de fond est gérée par PHP via style inline ou classes */
    /* Réduction de 60% du padding vertical (0.8rem -> 0.32rem) */
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.5px;
}

.navbar-logo {
    height: 70px;
    width: auto;
    display: block;
}

.nav-link {
    font-weight: 500;
    margin: 0 5px;
    border-radius: 5px;
    transition: all 0.2s;
}

.nav-link.active {
    font-weight: 700;
    border-bottom: 2px solid var(--accent-color);
}

/* --- FOOTER --- */
footer {
    background-color: var(--main-color);
    color: #f9f5e7; /* Beige clair */
    margin-top: auto;
}
footer a { color: #f9f5e7; text-decoration: none; }
footer a:hover { text-decoration: underline; }

.footer-logo {
    height: 50px;
    width: auto;
    display: inline-block;
}

/* --- ELEMENTS DE LISTE / TIMELINE (Flux d'activité) --- */
.timeline-avatar {
    width: 50px; 
    height: 50px; 
    object-fit: cover; 
    border-radius: 50%;
}
.timeline-card {
    border-left: 4px solid #dee2e6;
    transition: transform 0.2s;
}
.timeline-card:hover {
    transform: translateX(5px);
}

/* Bordures sémantiques pour la timeline */
.border-demande { border-left-color: #ffc107 !important; } /* Jaune */
.border-validation { border-left-color: #198754 !important; } /* Vert */
.border-refus { border-left-color: #dc3545 !important; } /* Rouge */
.border-systeme { border-left-color: #0d6efd !important; } /* Bleu */

.bg-light-yellow { background-color: #fffbf0; }

/* --- PAGE D'ACCUEIL (Vitrine) --- */
.hero-section {
    background-color: #e9f5e9;
    padding: 100px 0;
}
.hero-section h1 {
    font-weight: 800;
    letter-spacing: -1px;
}
.concept-section, .reasons-section, .teaser-section {
    padding: 60px 0;
}

/* --- AVATARS --- */
.avatar-preview {
    width: 150px; 
    height: 150px; 
    object-fit: cover; 
    border-radius: 50%;
    border: 3px solid var(--main-color);
}

/* --- WIDGET CATEGORIE MOBILE --- */
.category-widget-wrapper .btn-select-category {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-style: dashed; /* Style "Choisir" */
    padding: 0.75rem 1rem;
}

#modalCategoryBody {
    padding: 0; /* Pour que la list-group touche les bords */
}

/* Items de liste optimisés pour le pouce (Tactile) */
.category-item, #btn-category-back {
    min-height: 56px; /* Confort tactile supérieur au standard 44px */
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.05rem;
    border-left: none;
    border-right: none;
}

.category-item:active {
    background-color: var(--bs-light);
}

.modal-header .modal-title {
    font-size: 1.1rem;
}

/* --- COMPOSANT PHOTO TOUCH (UX_C) --- */
.photo-touch-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    background-color: #f8f9fa;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.photo-touch-zone:hover {
    border-color: var(--main-color, #466646);
    background-color: #e9f5e9;
}

.photo-touch-placeholder {
    z-index: 10;
    text-align: center;
    color: #6c757d;
    transition: opacity 0.2s;
    pointer-events: none; /* Permet le clic sur le label parent */
    width: 100%;
    position: absolute;
    padding: 0 10px;
}

.photo-touch-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important; /* Force le redimensionnement */
    object-fit: cover; /* Remplit sans déformer */
    z-index: 20;
    background-color: #fff;
    border-radius: 10px;
}

.photo-touch-edit-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 30;
    pointer-events: none;
    display: none;
}

/* État avec image présente */
.photo-touch-zone.has-image {
    border-style: solid;
    border-color: var(--main-color, #466646);
}

.photo-touch-zone.has-image .photo-touch-placeholder {
    opacity: 0 !important;
    visibility: hidden;
}

.photo-touch-zone.has-image .photo-touch-edit-badge {
    display: block;
}

/* VARIATION CIRCULAIRE POUR L'AVATAR (UX_C) */
.photo-touch-zone.is-avatar {
    width: 180px; 
    height: 180px;
    border-radius: 50%;
    margin: 0 auto; /* Centrage horizontal dans la carte */
}

.photo-touch-zone.is-avatar .photo-touch-preview {
    border-radius: 50%;
}

.photo-touch-zone.is-avatar .photo-touch-edit-badge {
    right: 50%;
    transform: translateX(50%);
    bottom: 5px;
}

/* --- NAVIGATION SÉQUENTIELLE INBOX (UX_B) --- */
@media (max-width: 767.98px) {
    .inbox-sidebar, .inbox-chat {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    #inboxWrapper:not(.active-conversation) .inbox-chat {
        display: none !important;
    }

    #inboxWrapper.active-conversation .inbox-sidebar {
        display: none !important;
    }

    .inbox-chat .border-bottom {
        padding-left: 0.5rem !important;
    }
}

/* --- CATALOGUE COMPACT MOBILE (UX_A) --- */
@media (max-width: 767.98px) {
    .catalogue-item-card {
        flex-direction: row !important; /* Mode horizontal */
        align-items: center;
        padding: 0.5rem;
        height: auto !important;
        min-height: 100px;
    }

    .catalogue-item-card .img-container-mobile {
        width: 80px !important;
        height: 80px !important;
        flex-shrink: 0;
        overflow: hidden;
        border-radius: 8px;
        aspect-ratio: 1 / 1; /* Image carrée */
    }

    .catalogue-item-card .img-container-mobile img {
        height: 100% !important;
        width: 100% !important;
        object-fit: cover;
    }

    .catalogue-item-card .card-body {
        /* FIX TRONCATURE : Ajout de padding-bottom (0.5rem) pour éviter que le texte ne touche le bord */
        padding: 0 0 0.5rem 1rem !important; 
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: visible !important; /* INTERDICTION de couper le contenu */
    }

    .catalogue-item-card .card-title {
        font-size: 1rem !important;
        margin-bottom: 0.15rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Masquage des éléments secondaires sur mobile */
    .catalogue-item-card .card-footer, 
    .catalogue-item-card .owner-info,
    .catalogue-item-card .btn-actions-desktop {
        display: none !important;
    }

    /* REPOSITIONNEMENT NATUREL DE LA CATÉGORIE (UX_A_REFLOW) */
    .catalogue-item-card .badge-cat-mobile {
        position: static !important; /* On annule le positionnement absolu */
        display: inline-block;
        width: fit-content;
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
        font-size: 0.75rem;
        padding: 0.1rem 0.5rem !important;
        color: #6c757d; /* Gris Bootstrap (text-muted) */
        background-color: #e9ecef; /* Gris très clair */
        border-radius: 4px;
        border: none !important;
        box-shadow: none !important;
        line-height: 1.2; /* Sécurité hauteur de ligne */
    }
}
/* --- SIDEBAR ORGANIC (V2: WARM & FRIENDLY) --- */
/* Palette : #466646 (Vert), #f9f5e7 (Beige), #333 (Gris) */

/* Conteneur : On enlève le fond blanc global pour laisser respirer les cartes */
.sidebar-organic {
    background: transparent;
    padding: 0.5rem 0;
}

/* --- BOUTON RESET (Style "Soft Pill") --- */
.btn-reset-organic {
    display: table; /* Pour ne pas prendre toute la largeur */
    margin: 0 auto 1.5rem auto; /* Centré */
    padding: 0.6rem 1.5rem;
    color: #6c757d; /* Gris doux par défaut */
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 50px; /* Forme de pillule */
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-decoration: none; /* Pas de soulignement */
}

/* Interaction : Devient rouge au survol */
.btn-reset-organic:hover {
    background-color: #fff5f5; /* Rouge très pâle */
    color: #dc3545;
    border-color: #ffc9c9;
    transform: translateY(-2px); /* Petit saut */
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.15);
}

.btn-reset-organic i {
    margin-right: 6px;
    font-size: 1.1em;
    vertical-align: -2px;
}

/* --- LIENS CATÉGORIES (Style "Floating Cards") --- */
.cat-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem; /* Plus d'espace */
    background: #ffffff;
    color: #444;
    text-decoration: none;
    transition: all 0.2s ease;
    
    /* Le style carte */
    border: 1px solid #f0f0f0;
    border-left: 4px solid transparent; /* Prêt pour l'accent */
    border-radius: 10px; /* Coins bien arrondis */
    margin-bottom: 10px; /* Espace entre les cartes */
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); /* Ombre subtile */
    font-weight: 600;
}

/* Survol : La carte s'active */
.cat-link:hover {
    background-color: #ffffff;
    color: #466646; /* Vert ÉpiQuoi */
    border-left-color: #466646; /* Barre verte à gauche */
    transform: translateX(5px); /* Glissement vers la droite */
    box-shadow: 0 4px 12px rgba(70, 102, 70, 0.1); /* Ombre verte portée */
}

/* --- ÉTATS --- */

/* 1. Parent Actif (Sur le chemin) */
.cat-link.has-active-child {
    background-color: #fcfbf6; /* Beige très léger */
    border-left-color: #aebfb0; /* Vert pâle */
    color: #466646;
}

/* 2. Item Sélectionné (Full Vert) */
.cat-link.is-active {
    background-color: #466646 !important;
    color: #ffffff !important;
    border-color: #466646;
    border-left-color: #466646;
    transform: scale(1.02); /* Légèrement plus grand */
    box-shadow: 0 4px 15px rgba(70, 102, 70, 0.3);
}

/* 3. Enfants (Sous-catégories) */
.cat-link.is-child {
    font-size: 0.95rem;
    margin-left: 1rem; /* Décalage visuel */
    width: calc(100% - 1rem);
    border-left-width: 2px; /* Bordure plus fine */
}

/* --- BADGES (Compteurs) --- */
.cat-link .badge {
    font-weight: 600;
    padding: 0.5em 0.8em;
    border-radius: 6px;
    transition: all 0.2s;
}

/* Badge par défaut : Style "Bio" */
.cat-link .badge.bg-light {
    background-color: #e9f5e9 !important; /* Vert très pâle */
    color: #466646 !important; /* Texte vert */
    border: none !important;
}

/* Badge sur l'élément actif */
.cat-link.is-active .badge {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

/* Loader AJAX */
.ajax-loading {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.8);
    transition: all 0.3s;
}
/* --- STABILISATION UI : MASQUAGE DES NOTIFICATIONS (Invisible mais existant) --- */
.notification-dot, 
.badge-red, 
.badge-unread, 
.nb-non-lus,
span[class*="badge-"][class*="danger"] {
    display: none !important;
}