/* =========================================
   POLICES SYSTÈME
   ========================================= */

/* =========================================
   VARIABLES & THÈMES
   ========================================= */
:root {
    --bg:       #0d1117;
    --surface:  #161b27;
    --surface2: #1e2736;
    --border:   rgba(255, 255, 255, 0.08);
    --border2:  rgba(255, 255, 255, 0.12);

    --text:     #e6edf3;
    --muted:    #8b949e;

    /* Theme Default (Violet) */
    --primary:  #8b5cf6;
    --pink:     #ec4899;
    --green:    #22c55e;
    --red:      #f87171;
    --blue:     #4f8ef7;

    --grad: linear-gradient(135deg, var(--primary), var(--pink));

    --smooth: cubic-bezier(0.25, 0.8, 0.25, 1);

    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  18px;
    --r-xl:  24px;

    /* Aliases */
    --bg-color:   var(--bg);
    --card-bg:    var(--surface);
    --text-light: var(--text);
    --text-muted: var(--muted);
    --secondary:  var(--pink);
    --success:    var(--green);
    --danger:     var(--red);
}

/* =========================================
   SCROLLBAR & SELECTION
   ========================================= */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--surface2);
    border-radius: 10px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

::selection {
    background: rgba(139, 92, 246, 0.3);
    color: #ffffff;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after, input, button, select, textarea {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 64px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        radial-gradient(ellipse 80% 50% at 85% -10%, rgba(var(--primary-rgb, 139,92,246), 0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 10% 110%, rgba(var(--pink-rgb, 236,72,153), 0.1) 0%, transparent 60%);
}

a { text-decoration: none; color: inherit; }
img { display: block; }
button { font-family: inherit; }

/* =========================================
   LAYOUT
   ========================================= */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px;
    /* J'ai retiré l'animation fadeUp ici pour que ce soit instantané ! */
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================
   NAVBAR
   ========================================= */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    margin-bottom: 30px;
    background: rgba(22, 27, 39, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border2);
    border-radius: var(--r-lg);
    box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 10px 30px rgba(0,0,0,.4);
    position: relative;
    z-index: 1000;
}

.nav h2 {
    font-size: 1.2em;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =========================================
   BOUTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--r-sm);
    font-size: .9em;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all .3s var(--smooth);
}

.btn:active { transform: scale(.94); }

.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,.4);
}
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,.6);
}

.btn-success {
    background: var(--green);
    color: #fff;
    box-shadow: 0 4px 15px rgba(34,197,94,.2);
}
.btn-success:hover {
    background: #16a34a;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(34,197,94,.4);
}

.btn-danger {
    background: rgba(248,113,113,.1);
    color: var(--red);
    border: 1px solid rgba(248,113,113,.3);
}
.btn-danger:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(248,113,113,.4);
}

.btn-outline {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border2);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(255,255,255,.05);
}

.btn-admin {
    padding: 14px 44px;
    font-size: 1.05em;
}

/* =========================================
   FORM BOX (collapsible)
   ========================================= */
.form-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
    transition: border-color .3s var(--smooth);
}
.form-box:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.form-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.form-box-header h3 {
    font-size: 1em;
    font-weight: 600;
    pointer-events: none;
}

.form-box-header .toggle-icon {
    color: var(--muted);
    font-size: .9em;
    pointer-events: none;
    transition: transform .4s var(--smooth);
}

.form-box.open .form-box-header .toggle-icon {
    transform: rotate(180deg);
}

.form-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height .5s var(--smooth), opacity .4s var(--smooth), margin-top .4s var(--smooth);
}

.form-box.open .form-body {
    max-height: 1200px;
    opacity: 1;
    margin-top: 20px;
}

/* Inputs dans les form-box */
.form-body input,
.form-body textarea,
.form-body select {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 14px;
    background: rgba(13, 17, 23, .6);
    border: 1px solid var(--border2);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: .9em;
    font-weight: 500;
    transition: all .3s var(--smooth);
}

.form-body input:focus,
.form-body textarea:focus,
.form-body select:focus {
    outline: none;
    background: rgba(13, 17, 23, .9);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,0,0,.15), inset 0 1px 2px rgba(0,0,0,.2);
}

/* =========================================
   GRILLE & CARDS
   ========================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .4s var(--smooth), box-shadow .4s var(--smooth), border-color .4s var(--smooth);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,.6);
    border-color: var(--primary);
}

.card-img-wrapper {
    position: relative;
    height: 290px;
    overflow: hidden;
    flex-shrink: 0;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--smooth);
}

.card:hover .card-img-wrapper img {
    transform: scale(1.08);
}

.card-img-overlay {
    position: absolute;
    inset: auto 0 0 0;
    height: 60%;
    background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
    pointer-events: none;
}

.card-body {
    padding: 0 18px 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
    z-index: 2;
}

.card-title {
    font-size: 1.05em;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.badge {
    display: inline-block;
    width: fit-content;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75em;
    font-weight: 700;
    background: var(--grad);
    color: #fff;
    letter-spacing: .02em;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.desc-text {
    font-size: .85em;
    color: var(--muted);
    line-height: 1.6;
    font-weight: 500;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .75em;
    color: var(--muted);
    padding-top: 12px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    opacity: .8;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.actions .btn {
    flex: 1;
    padding: 8px 6px;
    font-size: .8em;
}

/* =========================================
   PAGE TOOLBAR (search + tri)
   ========================================= */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.toolbar-info {
    font-size: .9em;
    color: var(--muted);
    font-weight: 500;
    padding-left: 4px;
}

.toolbar-info strong {
    color: var(--text);
    font-weight: 700;
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(22, 27, 39, .8);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border2);
    border-radius: var(--r-md);
    box-shadow: 0 4px 15px rgba(0,0,0,.2);
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    transition: all .3s var(--smooth);
}

.toolbar-controls:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    background: rgba(22, 27, 39, .95);
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.search-field i {
    position: absolute;
    left: 10px;
    color: var(--muted);
    font-size: .8em;
    pointer-events: none;
    z-index: 1;
    transition: color .3s ease;
}

.search-field input:focus + i,
.search-field input:not(:placeholder-shown) + i {
    color: var(--primary);
}

.search-field input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    margin: 0;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: .88em;
    font-weight: 500;
}

.search-field input::placeholder { color: var(--muted); opacity: .7; font-weight: 400; }
.search-field input:focus { outline: none; }

.toolbar-sep {
    display: block;
    width: 1px;
    height: 24px;
    background: var(--border2);
    flex-shrink: 0;
    margin: 0 6px;
}

.sort-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-field i {
    color: var(--muted);
    font-size: .8em;
    flex-shrink: 0;
}

.sort-field select {
    margin: 0;
    padding: 8px 24px 8px 4px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: .88em;
    font-weight: 600;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%238b949e' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    min-width: 115px;
}

.sort-field select:focus { outline: none; }
.sort-field select option { background: #1e2736; color: #e6edf3; font-weight: 500;}

/* =========================================
   ACCUEIL — MENU TILES
   ========================================= */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.menu-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 50px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    color: var(--text);
    font-size: 1.2em;
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    z-index: 1;
    transition: all .4s var(--smooth);
}

.menu-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad);
    opacity: 0;
    transition: opacity .4s var(--smooth);
    z-index: -1;
}

.menu-tile:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 35px rgba(0,0,0,.3);
    border-color: transparent;
    color: #fff;
}
.menu-tile:hover::before { opacity: 1; }

.tile-icon {
    font-size: 2.5em;
    display: block;
    transition: transform .4s var(--smooth);
}
.menu-tile:hover .tile-icon { transform: scale(1.2) translateY(-4px); }

.admin-section { text-align: center; margin-top: 56px; }

/* =========================================
   AUTH / GLASS FORM (login, register, edit)
   ========================================= */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    padding: 20px;
}

.glass-form {
    width: 100%;
    max-width: 440px;
    padding: 48px 44px;
    background: rgba(22,27,39,.5);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--r-xl);
    box-shadow: 0 24px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1);
    position: relative;
    overflow: hidden;
    /* J'ai retiré le fadeUp ici aussi pour accélérer le chargement */
}

.glass-form h2 {
    text-align: center;
    font-size: 1.8em;
    font-weight: 800;
    margin-bottom: 32px;
    letter-spacing: -0.02em;
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-form input,
.glass-form textarea,
.glass-form select {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: rgba(0,0,0,.3);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: .9em;
    font-weight: 500;
    transition: all .3s var(--smooth);
}

.glass-form input:focus,
.glass-form textarea:focus,
.glass-form select:focus {
    outline: none;
    background: rgba(0,0,0,.4);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,0,0,.15);
}

.glass-form label {
    display: block;
    font-size: .8em;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 8px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.auth-links {
    text-align: center;
    margin-top: 24px;
    font-size: .9em;
    font-weight: 600;
}

.auth-links a { color: var(--muted); transition: color .3s; }
.auth-links a:hover { color: var(--primary); }

/* =========================================
   ADMIN TABLES
   ========================================= */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    background: var(--surface);
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

.admin-table th,
.admin-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: .9em;
    color: var(--text);
}

.admin-table th {
    background: rgba(0,0,0,.3);
    font-weight: 700;
    color: var(--primary);
    font-size: .8em;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.03); }

.admin-section-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 40px 0 12px;
    color: var(--text);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .container { padding: 16px 14px; }

    .nav {
        flex-direction: column;
        gap: 12px;
        padding: 16px 20px;
        text-align: center;
    }

    .form-box { padding: 18px 20px; }

    .form-body form > div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .form-body form > div[style*="display: flex"] > input {
        width: 100% !important;
        margin-bottom: 14px !important;
    }

    .card-img-wrapper { height: 230px; }

    .glass-form { padding: 36px 24px; }
    .glass-form h2 { font-size: 1.6em; }

    .menu-tile { padding: 40px 20px; font-size: 1.1em; }
    .btn-admin { width: 100%; max-width: 300px; }

    .page-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .toolbar-controls { width: 100%; max-width: 100%; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
    .search-field { flex: 1; min-width: 0; }
    .search-field input, .search-field input:focus { width: 100%; }
    .toolbar-sep { display: none; }
    .sort-field { flex: 1; min-width: 0; }
    .sort-field select { width: 100%; min-width: 0; }
}

@media (max-width: 480px) {
    .grid { grid-template-columns: repeat(1, 1fr); gap: 16px; }
    .card-img-wrapper { height: 210px; }
}

/* =========================================
   PROFIL & MESSAGERIE (AJOUTS)
   ========================================= */

/* Dropdown Navbar */
.nav-profile-container { position: relative; display: inline-block; }
.nav-avatar { width: 42px; height: 42px; border-radius: 50% !important; aspect-ratio: 1/1 !important; object-fit: cover !important; cursor: pointer; border: 2px solid var(--primary); transition: transform 0.3s; background: var(--surface2); }
.nav-avatar:hover { transform: scale(1.1); }

.profile-dropdown { display: none; position: absolute; right: -15px; top: 55px; background: var(--surface); min-width: 160px; box-shadow: 0 8px 30px rgba(0,0,0,0.6); border: 1px solid var(--border); border-radius: var(--r-md); z-index: 1000; overflow: hidden; animation: fadeUp 0.2s ease-out forwards; }
.profile-dropdown.show { display: block; }
.profile-dropdown a { color: var(--text); padding: 12px 16px; text-decoration: none; display: block; font-size: 0.9em; font-weight: 600; transition: background 0.2s; }
.profile-dropdown a:hover { background: rgba(255,255,255,0.05); }

/* Page Profil */
.profile-header { text-align: center; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border2); }
.profile-big-avatar { width: 100px; height: 100px; border-radius: 50% !important; aspect-ratio: 1/1 !important; object-fit: cover !important; border: 3px solid var(--primary); margin: 0 auto 15px auto; box-shadow: 0 5px 15px rgba(0,0,0,0.3); background: var(--surface2); }

/* Messagerie */
.chat-layout { display: flex; gap: 20px; height: calc(100vh - 160px); min-height: 500px; }
.chat-sidebar { width: 250px; overflow-y: auto; flex-shrink: 0; }
.contact-list { display: flex; flex-direction: column; gap: 5px; }
.contact-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-sm); transition: background 0.3s; }
.contact-item:hover, .contact-item.active { background: rgba(255,255,255,0.05); color: var(--primary); }
.contact-avatar { width: 35px; height: 35px; border-radius: 50% !important; aspect-ratio: 1/1 !important; object-fit: cover !important; background: var(--surface2); }

.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 15px 20px; background: rgba(0,0,0,0.2); border-bottom: 1px solid var(--border2); }
.chat-messages { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.chat-input-area { padding: 15px; background: rgba(0,0,0,0.2); border-top: 1px solid var(--border2); }

/* Input Chat dans la DA du site */
.chat-input-field {
    width: 100%; padding: 12px 16px; background: rgba(13, 17, 23, .6); border: 1px solid var(--border2);
    border-radius: var(--r-sm); color: var(--text); font-size: .9em; font-weight: 500; transition: all .3s var(--smooth); margin: 0;
}
.chat-input-field:focus {
    outline: none; background: rgba(13, 17, 23, .9); border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,0,0,.15), inset 0 1px 2px rgba(0,0,0,.2);
}

/* Bulles de chat */
.msg-wrapper { display: flex; flex-direction: column; max-width: 70%; }
.msg-me { align-self: flex-end; align-items: flex-end; }
.msg-other { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 10px 15px; border-radius: 18px; font-size: 0.95em; line-height: 1.4; word-break: break-word; }
.msg-me .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg-other .msg-bubble { background: rgba(255,255,255,0.1); color: var(--text); border-bottom-left-radius: 4px; }
.msg-date { font-size: 0.7em; color: var(--muted); margin-top: 5px; }

/* Badge de notification sur le profil */
.notif-badge {
    position: absolute; top: -5px; right: -5px;
    background: var(--danger); color: white;
    font-size: 0.7em; font-weight: 800;
    padding: 2px 6px; border-radius: 10px;
    border: 2px solid var(--bg);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Statuts de présence */
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-online { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-offline { background: #6b7280; }
.status-text { font-size: 0.8em; font-weight: 600; }

@media (max-width: 768px) {
    .chat-layout { flex-direction: column; height: auto; }
    .chat-sidebar { width: 100%; max-height: 200px; }
    .chat-main { height: 500px; }
}

/* =========================================
   LECTEUR MANHWA
   ========================================= */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .9em;
    color: var(--muted);
    margin-bottom: 28px;
}
.breadcrumb a {
    color: var(--primary);
    font-weight: 600;
    transition: opacity .2s;
}
.breadcrumb a:hover { opacity: .7; }
.breadcrumb .sep { color: var(--surface2); }
.breadcrumb .current { color: var(--text); font-weight: 700; }

/* Toolbar Catalogue */
.catalogue-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 16px;
    transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--primary); }
.search-bar i { color: var(--muted); font-size: .95em; flex-shrink: 0; }
.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: .95em;
    width: 100%;
    font-weight: 500;
}
.search-bar input::placeholder { color: var(--muted); }
.search-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    display: none;
}

/* Filtres */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 7px 18px;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, .3);
    background: rgba(139, 92, 246, .08);
    color: var(--primary);
    font-weight: 600;
    font-size: .85em;
    text-decoration: none;
    transition: all .2s;
}
.filter-btn:hover, .filter-btn.active {
    background: rgba(139, 92, 246, .3);
    border-color: var(--primary);
    color: var(--text);
}

/* Grille Manhwas */
.manhwa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 22px;
}
.manhwa-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    color: var(--text);
    transition: transform .3s, box-shadow .3s, border-color .3s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.manhwa-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 32px rgba(139, 92, 246, .3);
    border-color: var(--primary);
}
.manhwa-cover {
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(139, 92, 246, .3), rgba(168, 85, 247, .1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5em;
}
.manhwa-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s;
}
.manhwa-card:hover .manhwa-cover img { transform: scale(1.06); }
.lazy-cover-anim {
    animation: pulse 1.5s infinite;
    filter: brightness(.7);
}
@keyframes pulse {
    0% { opacity: .6; }
    50% { opacity: .9; }
    100% { opacity: .6; }
}
.manhwa-info {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.manhwa-title-card {
    font-weight: 800;
    font-size: 1em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.manhwa-meta {
    font-size: .85em;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.manhwa-stats { display: flex; align-items: center; gap: 6px; }

/* Badges */
.fav-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    text-decoration: none;
    transition: all .3s;
    border: 1.5px solid rgba(255, 255, 255, .3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
    cursor: pointer;
}
.fav-badge:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, .95);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .8);
}
.fav-badge.is-fav {
    color: #fbbf24;
    box-shadow: 0 4px 12px rgba(251, 191, 36, .4);
}
.fav-badge.is-fav:hover {
    box-shadow: 0 6px 16px rgba(251, 191, 36, .6);
}
.fav-badge:not(.is-fav) { color: rgba(255, 255, 255, .6); }

/* Bouton édition cover */
.cover-edit-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 5;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8em;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .15);
    color: var(--muted);
    transition: all .2s;
    opacity: 0;
}
.manhwa-card:hover .cover-edit-btn { opacity: 1; }
.cover-edit-btn:hover {
    background: rgba(139, 92, 246, .8);
    color: var(--text);
    border-color: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.modal-box h3 {
    margin: 0 0 8px;
    font-size: 1.1em;
    color: var(--text);
}
.modal-box p {
    margin: 0 0 18px;
    font-size: .85em;
    color: var(--muted);
    line-height: 1.5;
}
.modal-input {
    width: 100%;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: .9em;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s;
}
.modal-input:focus { border-color: var(--primary); }
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.modal-btn {
    flex: 1;
    padding: 9px 14px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: .88em;
    border: 1px solid;
    cursor: pointer;
    transition: all .22s;
    min-width: 90px;
}
.modal-btn.confirm {
    background: rgba(139, 92, 246, .2);
    border-color: rgba(139, 92, 246, .5);
    color: var(--primary);
}
.modal-btn.confirm:hover { background: rgba(139, 92, 246, .45); color: var(--text); }
.modal-btn.reset {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .3);
    color: var(--danger);
}
.modal-btn.reset:hover { background: rgba(239, 68, 68, .3); color: var(--text); }
.modal-btn.cancel {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .15);
    color: var(--muted);
}
.modal-btn.cancel:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.modal-preview {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    display: block;
    margin-top: 12px;
    background: rgba(139, 92, 246, .15);
}

/* Page Manga */
.manga-header {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    margin-bottom: 36px;
    flex-wrap: wrap;
}
.manga-header-cover {
    width: 180px;
    flex-shrink: 0;
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(139, 92, 246, .3), rgba(168, 85, 247, .1));
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    position: relative;
    cursor: pointer;
}
.manga-header-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cover-edit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity .25s;
    font-size: .8em;
    color: var(--text);
    font-weight: 600;
    letter-spacing: .03em;
}
.manga-header-cover:hover .cover-edit-overlay { opacity: 1; }
.manga-header-info { flex: 1; min-width: 0; }
.manga-header-info h2 {
    font-size: 1.8em;
    font-weight: 900;
    margin: 0 0 12px;
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.manga-desc {
    color: var(--muted);
    font-size: .92em;
    line-height: 1.65;
    margin: 0 0 16px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 10px;
}
.manga-desc::-webkit-scrollbar { width: 6px; }
.manga-desc::-webkit-scrollbar-track { background: rgba(255, 255, 255, .05); border-radius: 4px; }
.manga-desc::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

.manga-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.btn-fav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: .9em;
    text-decoration: none;
    transition: all .25s;
    border: 1px solid;
}
.btn-fav.is-fav {
    background: rgba(245, 158, 11, .15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, .4);
}
.btn-fav.is-fav:hover { background: rgba(245, 158, 11, .3); }
.btn-fav:not(.is-fav) {
    background: rgba(255, 255, 255, .05);
    color: var(--muted);
    border-color: rgba(255, 255, 255, .15);
}
.btn-fav:not(.is-fav):hover {
    background: rgba(245, 158, 11, .1);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, .3);
}
.btn-read-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: .88em;
    text-decoration: none;
    transition: all .25s;
    border: 1px solid;
}
.btn-read-action.first {
    background: rgba(139, 92, 246, .2);
    border-color: rgba(139, 92, 246, .5);
    color: var(--primary);
}
.btn-read-action.first:hover { background: rgba(139, 92, 246, .45); color: var(--text); }
.btn-read-action.last {
    background: rgba(168, 85, 247, .15);
    border-color: rgba(168, 85, 247, .4);
    color: #e9d5ff;
}
.btn-read-action.last:hover { background: rgba(168, 85, 247, .35); color: var(--text); }

/* Chapitres */
.chapters-section {}
.chapters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.chapters-header h3 {
    font-size: 1.1em;
    color: var(--muted);
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.btn-order {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .8em;
    font-weight: 700;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .12);
    color: var(--muted);
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}
.btn-order:hover {
    background: rgba(139, 92, 246, .15);
    border-color: var(--primary);
    color: var(--primary);
}
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chapter-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    transition: all .22s;
    position: relative;
    overflow: hidden;
}
.chapter-item:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, .12);
    transform: translateX(4px);
}
.chapter-item.read {
    background: rgba(139, 92, 246, .06);
    border-color: rgba(139, 92, 246, .18);
}
.chapter-item.read .chap-num { color: #a78bfa; }
.chapter-item.read::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 3px 0 0 3px;
}
.read-tag {
    margin-left: auto;
    flex-shrink: 0;
    font-size: .72em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(139, 92, 246, .2);
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, .35);
}
.chap-num { font-weight: 800; font-size: 1em; flex-shrink: 0; min-width: 80px; }
.chap-date { font-size: .82em; color: var(--muted); }

/* Lecteur */
.reader-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
}
.reader-wrap img {
    display: block;
    width: 100%;
    max-width: 800px;
    height: auto;
    vertical-align: bottom;
}
.reader-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px;
    flex-wrap: wrap;
}
.reader-nav a, .reader-nav span {
    padding: 10px 20px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: .9em;
    text-decoration: none;
}
.btn-chap {
    background: rgba(139, 92, 246, .2);
    border: 1px solid rgba(139, 92, 246, .4);
    color: var(--primary);
    transition: all .22s;
    display: inline-block;
    text-align: center;
}
.btn-chap:hover { background: rgba(139, 92, 246, .45); color: var(--text); }
.btn-chap.disabled { opacity: .3; pointer-events: none; }
.chap-info { color: var(--muted); font-size: .85em; text-align: center; flex: 1; }

/* Scroll to top */
#scrollTopBtn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text);
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(139, 92, 246, .5);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .3s, transform .3s;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}
#scrollTopBtn.visible { opacity: 1; transform: translateY(0); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-state .icon { font-size: 3em; margin-bottom: 12px; }

/* --- MODE PERFORMANCE (Ultra Light) --- */
:root.theme-perf {
    --primary: #555; --pink: #555; --grad: #333; --bg: #000; --surface: #111;
}
html.theme-perf * {
    animation: none !important; transition: none !important;
    box-shadow: none !important; backdrop-filter: none !important;
    border-radius: 0 !important;
}
html.theme-perf img { filter: grayscale(100%) !important; }
html.theme-perf .grid img, html.theme-perf .nav-avatar,
html.theme-perf .manhwa-cover img, html.theme-perf .manga-header-cover img,
html.theme-perf .lazy-cover, html.theme-perf .reader-wrap img { filter: none !important; }

/* Fix pour les icônes du menu profil */
.d-icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.profile-dropdown a { display: flex !important; align-items: center; gap: 10px; text-decoration: none; }