/* ======================================================
   HEADER.CSS - Styles spécifiques au header et sidebar
   Design original préservé - Manga Samy
   ====================================================== */

/* ─────────────────────────────────────────
   1. VARIABLES (uniquement pour le header)
───────────────────────────────────────── */
:root {
    --bg:          #121212;
    --surface:     #1a1a2e;
    --surface-2:   #16213e;
    --orange:      #FF8C00;
    --gold:        #FFD700;
    --red-light:   #ff7f7f;
    --red:         #FF4C4C;
    --red-dark:    #8B0000;
    --text:        #f5f5f5;
    --text-dark:   #121212;
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

/* ─────────────────────────────────────────
   2. HEADER PRINCIPAL
───────────────────────────────────────── */
.main-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #9b0303 !important;
    padding: 0.4rem 1.2rem;
    box-shadow: 0 3px 0 var(--red-dark), 0 6px 20px rgba(0,0,0,0.6);
}

/* Trait tricolore en bas */
.main-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--red-dark), var(--orange), var(--gold));
    pointer-events: none;
}

/* Logo */
.main-header a img {
    filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0.5));
    transition: filter 0.3s, transform 0.3s;
}
.main-header a:hover img {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.85));
    transform: scale(1.04);
    text-decoration: none;
}

/* ─────────────────────────────────────────
   3. BARRE DE RECHERCHE DESKTOP (#formSearch)
───────────────────────────────────────── */
#formSearch .form-control {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,140,0,0.4);
    color: var(--text);
    border-radius: 4px 0 0 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#formSearch .form-control::placeholder {
    color: rgba(245,245,245,0.45);
}
#formSearch .form-control:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255,140,0,0.2);
    background: rgba(0,0,0,0.5);
    color: var(--text);
    outline: none;
}
#formSearch .btn-outline-light {
    border-color: rgba(255,140,0,0.5);
    border-radius: 0 4px 4px 0;
    transition: background 0.2s, border-color 0.2s;
}
#formSearch .btn-outline-light:hover {
    background: rgba(255,140,0,0.15);
    border-color: var(--orange);
}

/* ─────────────────────────────────────────
   4. BOUTON HAMBURGER
───────────────────────────────────────── */
#hamburgerBtn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 4px !important;
    background: var(--gold) !important;
    color: var(--text-dark) !important;
    font-size: 1.2rem;
    border: none !important;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 3px 3px 0 var(--red-dark);
}
#hamburgerBtn:hover {
    background: var(--orange) !important;
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--red-dark);
}
#hamburgerBtn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--red-dark);
}

/* ─────────────────────────────────────────
   5. SIDEBAR (mobile + desktop)
───────────────────────────────────────── */
#mobileMenu,
#desktopSidebar {
    background: var(--surface) !important;
    position: fixed;
    top: 0;
    right: -260px;
    width: 250px;
    height: 100%;
    padding: 1rem;
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
}

/* Titre de section sidebar */
#mobileMenu::before,
#desktopSidebar::before {
    content: 'MANGA SAMY';
    display: block;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--orange);
    padding: 0.8rem 0 1rem;
    border-bottom: 1px solid rgba(255,140,0,0.2);
    margin-bottom: 0.5rem;
}

/* Liens sidebar */
#mobileMenu ul a,
#desktopSidebar ul a {
    color: var(--text) !important;
    font-weight: 600;
    font-size: 0.98rem;
    border-radius: 3px;
    padding: 0.55rem 0.7rem !important;
    margin-bottom: 2px;
    display: flex !important;
    align-items: center;
    transition: background 0.2s, color 0.2s, padding-right 0.2s;
    position: relative;
}

/* Trait orange au survol */
#mobileMenu ul a::before,
#desktopSidebar ul a::before {
    content: '';
    position: absolute;
    right: 0; top: 20%; bottom: 20%;
    width: 0;
    background: var(--orange);
    border-radius: 2px;
    transition: width 0.2s;
}
#mobileMenu ul a:hover,
#desktopSidebar ul a:hover {
    background: rgba(255,140,0,0.1);
    color: var(--gold) !important;
    padding-right: 1rem !important;
    text-decoration: none;
}
#mobileMenu ul a:hover::before,
#desktopSidebar ul a:hover::before {
    width: 3px;
}

/* Icônes */
#mobileMenu ul a i,
#desktopSidebar ul a i {
    margin-left: 10px !important;
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}
#mobileMenu ul a:hover i,
#desktopSidebar ul a:hover i {
    transform: scale(1.2);
}

/* ─────────────────────────────────────────
   6. RECHERCHE DANS SIDEBAR MOBILE
───────────────────────────────────────── */
#formSearch {
    min-width: 428px;
}
#mobileMenu .form-control {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,140,0,0.35);
    color: var(--text);
    border-radius: 4px 0 0 4px;
}
#mobileMenu .form-control::placeholder {
    color: rgba(245,245,245,0.4);
}
#mobileMenu .form-control:focus {
    border-color: var(--orange);
    background: rgba(0,0,0,0.5);
    color: var(--text);
    box-shadow: 0 0 0 2px rgba(255,140,0,0.2);
    outline: none;
}
#mobileMenu .btn-outline-light {
    border-color: rgba(255,140,0,0.4);
    border-radius: 0 4px 4px 0;
}
#mobileMenu .btn-outline-light:hover {
    background: rgba(255,140,0,0.15);
    border-color: var(--orange);
}

/* ─────────────────────────────────────────
   7. CARTE UTILISATEUR (USER LEVEL)
───────────────────────────────────────── */
.user-level {
    position: relative;
    bottom: unset;
    margin-top: 1.2rem;
    padding: 1rem 0.8rem 0.8rem;
    border-top: 1px solid rgba(255,140,0,0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    background: linear-gradient(145deg, rgba(255,140,0,0.07) 0%, rgba(139,0,0,0.12) 100%);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    border: 1px solid rgba(255,140,0,0.15);
}

/* Coin coupé décoratif */
.user-level::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 14px; height: 14px;
    background: var(--orange);
    clip-path: polygon(0 0, 100% 100%, 100% 0);
    opacity: 0.6;
}

/* ── Avatar avec anneau SVG ── */
.icon-level {
    position: relative;
    width: 96px;
    height: 96px;
    margin-bottom: 0.6rem;
}

.circle-wrapper {
    position: absolute;
    inset: -12px;
    border-radius: 40%;
    overflow: hidden;
    border: none;
    box-shadow: 0 0 16px rgba(255, 140, 0, 0.5);
    z-index: 1;
}
.circle-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    scale: 1.5;
}

/* Anneau SVG animé */
.icon-level svg.ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    z-index: 2;
    pointer-events: none;
}
.icon-level svg.ring circle.track {
    fill: none;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 4;
}
.icon-level svg.ring circle.fill-1 {
    fill: none;
    stroke: url(#ringGrad1);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 263;
    stroke-dashoffset: 263;
    animation: ring-draw-1 1.2s 0.3s var(--ease-out-expo) forwards;
}
.icon-level svg.ring circle.fill-2 {
    fill: none;
    stroke: url(#ringGrad2);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 263;
    stroke-dashoffset: 263;
    animation: ring-draw-2 1.2s 0.5s var(--ease-out-expo) forwards;
    opacity: 0.55;
}

@keyframes ring-draw-1 {
    to { stroke-dashoffset: var(--ring-offset-1, 80); }
}
@keyframes ring-draw-2 {
    to { stroke-dashoffset: var(--ring-offset-2, 160); }
}

/* ── Stats sous l'avatar ── */
.user-stats {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.2rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
}

.stat-icon {
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.stat-label {
    color: rgba(245,245,245,0.5);
    font-size: 0.7rem;
    width: 32px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.stat-fill {
    height: 100%;
    border-radius: 3px;
    width: 0;
    animation: stat-grow 1s var(--ease-out-expo) 0.6s forwards;
}
.stat-fill.pts {
    background: linear-gradient(90deg, #127acf, #1cdf0a);
}
.stat-fill.xp {
    background: linear-gradient(90deg, #d62e04, var(--orange));
}

@keyframes stat-grow {
    to { width: var(--stat-w, 60%); }
}

.stat-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    min-width: 28px;
    text-align: right;
    flex-shrink: 0;
}

.classement-label {
    margin-top: 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--orange);
    text-align: center;
    opacity: 0.85;
}

/* Cacher les anciens éléments de progression */
.progress-bar-level,
.progress-bar-pts1,
.progress-bar-pts2,
.classement-pts {
    display: none !important;
}

/* ─────────────────────────────────────────
   8. AUTOCOMPLETE SEARCH (dropdown)
───────────────────────────────────────── */
.search-autocomplete-wrap {
    position: relative;
    flex: 1;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 9999;
    background: #0e0e1c;
    border: 1px solid rgba(255, 140, 0, 0.25);
    border-top: 2px solid #FF8C00;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 4px 12px rgba(255,140,0,0.08);
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.search-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Scrollbar */
.search-dropdown::-webkit-scrollbar {
    width: 4px;
}
.search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.search-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255,140,0,0.3);
    border-radius: 2px;
}

/* Items */
.sd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
    color: #f5f5f5;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    position: relative;
}
.sd-item:last-child {
    border-bottom: none;
}
.sd-item:hover,
.sd-item.focused {
    background: rgba(255,140,0,0.08);
}
.sd-item:hover .sd-title,
.sd-item.focused .sd-title {
    color: #FFD700;
}

/* Trait orange gauche */
.sd-item::before {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 0;
    background: #FF8C00;
    transition: width 0.15s;
}
.sd-item:hover::before,
.sd-item.focused::before {
    width: 3px;
}

/* Cover */
.sd-cover {
    width: 42px;
    height: 58px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #1a1a2e;
    box-shadow: 2px 2px 0 rgba(139,0,0,0.5);
}
.sd-cover-placeholder {
    width: 42px;
    height: 58px;
    border-radius: 4px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: rgba(255,140,0,0.4);
}

/* Texte */
.sd-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sd-title {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.sd-title mark {
    background: rgba(255,215,0,0.2);
    color: #FFD700;
    border-radius: 2px;
    padding: 0 2px;
}

.sd-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}
.sd-status {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 2px;
    color: #fff;
}
.sd-rating {
    font-size: 0.68rem;
    color: #FFD700;
    display: flex;
    align-items: center;
    gap: 2px;
}
.sd-rating::before {
    content: '★';
}
.sd-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.sd-cat {
    font-size: 0.6rem;
    color: rgba(255,140,0,0.7);
    background: rgba(255,140,0,0.07);
    border: 1px solid rgba(255,140,0,0.15);
    padding: 0 5px;
    border-radius: 2px;
}

/* États */
.sd-empty,
.sd-loading {
    padding: 1.2rem;
    text-align: center;
    color: rgba(245,245,245,0.35);
    font-size: 0.82rem;
}
.sd-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.sd-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,140,0,0.2);
    border-top-color: #FF8C00;
    border-radius: 50%;
    animation: sd-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes sd-spin {
    to { transform: rotate(360deg); }
}

/* Footer dropdown */
.sd-footer {
    padding: 8px 14px;
    font-size: 0.72rem;
    color: rgba(245,245,245,0.3);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sd-footer kbd {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.68rem;
    color: rgba(245,245,245,0.4);
}

/* ─────────────────────────────────────────
   9. RESPONSIVE (mobile)
───────────────────────────────────────── */
@media (max-width: 768px) {
    .search-dropdown {
        border-radius: 0 0 8px 8px;
    }
    .sd-cover,
    .sd-cover-placeholder {
        width: 36px;
        height: 50px;
    }
    .sd-title {
        font-size: 0.82rem;
    }
}