/* Base & Container */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-smooth),
            color var(--transition-smooth);
    user-select: none;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header & Navigation Globale */
.main-header {
    display: flex;
    justify-content: space-between;
    padding: 16px 30px;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--shadow-xs);
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
    background: color-mix(in srgb, var(--bg-body) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.main-header h1 {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.03em;
    margin: 0;
}

.main-header h1 a {
    display: flex;
    align-items: center;
    color: inherit;
}

.logo-site {
    width: 34px;
    height: 34px;
    margin-right: 10px;
    border-radius: 50%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1000%) brightness(0);
}

html[data-theme="dark"] .logo-site {
    filter: grayscale(100%) contrast(1000%) brightness(0) invert(1);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.welcome-text {
    font-weight: 600;
    color: var(--text-muted);
    font-size: var(--card-desc-font-size);
}

.btn-theme {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: var(--card-desc-font-size);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-theme:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Navigation par Catégories (Onglets) */
.category-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    padding: 0.6rem 1.5rem;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--card-desc-font-size);
    border-radius: var(--radius-pill);
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-tab:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.nav-tab.active {
    background: var(--primary);
    color: var(--text-main);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

/* Conteneur d'Actions Admin / Globaux */
.actions-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2.5rem;
    gap: 15px;
}

/* Sections & Menus Déroulants */
.division-section {
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.division-section:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.division-title {
    color: var(--text-main);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    list-style: none;
    padding: 1.25rem 1.5rem;
    transition: background-color 0.2s ease;
}

.division-title:hover {
    background-color: rgba(128, 128, 128, 0.04);
}

.division-title::-webkit-details-marker {
    display: none;
}

.toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

details[open].division-section .toggle-icon {
    transform: rotate(90deg);
    background: var(--primary);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

details[open].division-section .division-title {
    border-bottom: 1px solid var(--border-color);
}

.division-body {
    padding: 1.5rem;
}

/* Sous-catégories */
.subcategory-details>summary {
    list-style: none;
    padding: 0.5rem 0;
}

.subcategory-details>summary::-webkit-details-marker {
    display: none;
}

.sub-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--primary);
    background: var(--primary-light);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.subcategory-details[open]>summary .sub-toggle {
    transform: rotate(90deg);
    background: var(--primary);
    color: var(--text-main);
}

.subcategory-details {
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
    padding: 10px;
}

.drag-handle-sub,
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.drag-handle-sub {
    font-size: 1.1rem;
    padding-right: 5px;
}

.drag-handle-sub:hover,
.drag-handle:hover {
    color: var(--primary);
}

/* Grille Fluide & Cartes */
.cards-grid {
    display: grid;
    /* Grid 100% Fluide et Responsive sans besoin de Media Queries complexes */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    min-height: 50px;
    padding-top: 15px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.card:active {
    cursor: grabbing;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 1.5rem 1rem 1.5rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-date {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 5px;
    position: absolute;
    top: 1.5rem;
    width: 85%;
    text-align: center;
    background: var(--bg-card);
    padding: 2px 0;
    border-radius: 4px;
}

.card-link-block {
    display: flex;
    color: inherit;
    flex-grow: 1;
}

.card-title {
    margin: 0 0 0.5rem 0;
    color: var(--text-main);
    font-size: var(--card-title-font-size);
    font-weight: 700;
    line-height: 1.3;
    transition: color 0.2s;
    word-wrap: break-word;
}

.card-link-block:hover .card-title {
    color: var(--primary);
}

.card-desc {
    font-size: var(--card-desc-font-size);
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
    max-height: calc(1.6em * 3);
    overflow-y: auto;
    padding-right: 6px;
    word-wrap: break-word;
}

.card-desc::-webkit-scrollbar {
    width: 4px;
}

.card-desc::-webkit-scrollbar-track {
    background: transparent;
}

.card-desc::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: var(--radius-pill);
}

.card-desc::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* Badges */
.card-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 20px;
}

.badge {
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: default;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.badge-season {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-episode {
    background: var(--info-bg);
    color: var(--info-text);
}

.card-actions-bottom {
    padding: 1rem 1.5rem;
    background: rgba(128, 128, 128, 0.02);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: center;
}

.status-completed {
    opacity: 0.6;
    filter: grayscale(30%);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--icon-font-size);
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-edit-sm:hover {
    color: var(--warning);
}

.btn-delete-sm:hover {
    color: var(--danger);
}

/* Boutons Globaux */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: var(--card-desc-font-size);
    text-decoration: none !important;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    position: relative;
}

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

.btn-primary,
.btn-success {
    background-color: var(--primary);
    color: var(--text-main);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover,
.btn-success:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.btn-warning {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-info {
    background-color: var(--info);
    color: var(--text-main);
}

.btn-increment {
    background: var(--info-bg);
    border: 1px solid var(--danger-text);
    color: var(--danger-text);
    cursor: pointer;
    font-weight: 800;
    margin-left: 6px;
    border-radius: var(--radius-pill);
    padding: 2px 6px;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.btn-increment:hover {
    background: var(--danger-text);
    color: var(--text-main);
}

.btn-login {
    color: var(--text-main);
    font-weight: 600;
    padding: 0.5rem 1rem;
}

.btn-login:hover {
    color: var(--primary);
}

.btn-register {
    background-color: var(--text-main);
    color: var(--bg-card);
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.btn-register:hover {
    background-color: var(--primary);
    color: var(--text-main);
    transform: translateY(-2px);
}

.btn-logout {
    color: var(--danger);
    font-weight: 600;
    padding: 0.5rem 1rem;
}

.btn-cancel {
    background-color: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background-color: var(--border-color);
}

.btn-suppr {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-suppr:hover {
    color: var(--text-main);
}

/* Formulaires d'Ajout/Edition */
.form-container {
    max-width: 600px;
    margin: 3rem auto;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.form-container .header-title {
    margin-top: 0;
    margin-bottom: 2.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group.row {
    display: flex;
    gap: 1.5rem;
}

.col-half {
    flex: 1;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: var(--card-desc-font-size);
}

.form-help {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.search-container [hidden],
.form-container [hidden] {
    display: none !important;
}

.card-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.card-filter-bar .choices {
    flex: 0 0 auto;
    width: 220px;
    margin-bottom: 0;
}

.card-filter-bar .choices__inner {
    display: flex;
    align-items: center;
    min-height: 44px !important;
    height: 44px;
    padding: 0.35rem 2rem 0.35rem 0.9rem !important;
}

.card-filter-bar .choices[data-type*="select-one"] .choices__inner {
    padding-bottom: 0.35rem !important;
}

.card-filter-bar .choices__list--single {
    padding: 0;
}

.card-filter-select {
    width: 220px;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
}

.card-result-count {
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 3.6rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 10;
    font-size: 1.2rem;
}

.password-toggle:hover {
    color: var(--text-main);
}

.form-floating .password-toggle {
    top: 40px;
    transform: none;
}

.form-floating2 .password-toggle2 {
    top: 45px;
    transform: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Etats vides, Images & Alertes */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border-color);
    color: var(--text-muted);
    margin-top: 2rem;
}

.empty-state h2 {
    color: var(--text-main);
    margin-bottom: 1rem;
    font-weight: 800;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: var(--card-desc-font-size);
    font-weight: 600;
}

.alert-danger {
    background-color: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger-text);
}

.alert-success {
    background-color: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-text);
}

.card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 1rem;
    flex-shrink: 0;
}

.image-view {
    width: 70px;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-md);
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

/* Tableaux d'Admin */
.admin-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    padding: 1.25rem 1.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background: rgba(128, 128, 128, 0.02);
}

.admin-table td {
    padding: 1.25rem 1.5rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background-color: rgba(128, 128, 128, 0.02);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
}

.status-badge.active {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-badge.banned {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.action-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-action {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-edit {
    background: var(--info-bg);
    color: var(--info-text);
}

.btn-edit:hover {
    background: var(--info);
    color: var(--text-main);
    transform: translateY(-2px);
}

.btn-ban {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.btn-ban:hover {
    background: var(--danger);
    color: var(--text-main);
    transform: translateY(-2px);
}

/* Toasts de Notifications */
.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.4s ease, transform 0.4s ease;
    border-left: 6px solid transparent;
    transform: translateX(120%);
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-danger {
    border-left-color: var(--danger);
}

.toast-info {
    border-left-color: var(--info);
}

/* Footer */
.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.logo-footer {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1000%) brightness(0);
}

html[data-theme="dark"] .logo-footer {
    filter: grayscale(100%) contrast(1000%) brightness(0) invert(1);
}

/* Utilitaires & Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.fade-in {
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    opacity: 0;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: var(--primary-light);
    border: 2px dashed var(--primary);
    transform: scale(0.98);
    border-radius: var(--radius-lg);
}

.logs {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* =========================================
   CHOICES.JS - ADAPTATION AU THÈME SOMBRE
   ========================================= */

/* Le champ principal (remplace .form-control) */
.choices__inner {
    background-color: var(--bg-body) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.5rem 1.2rem !important;
    min-height: auto !important;
    font-size: 1rem !important;
}

.choices[data-type*="select-one"] .choices__inner {
    padding-bottom: 0.5rem !important;
}

/* Le menu déroulant contenant les options */
.choices__list--dropdown {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    color: var(--text-main) !important;
    margin-top: 5px;
    /* Petit espace sous le champ */
}

/* Les options individuelles */
.choices__list--dropdown .choices__item {
    color: var(--text-main) !important;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

/* Option survolée ou sélectionnée */
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--primary-light) !important;

    color: var(--primary) !important;
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: var(--bg-body) !important;
    color: var(--primary) !important;
}

/* Effet lors du clic/focus (remplace le focus rouge/bleu) */
.choices.is-focused .choices__inner {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-light) !important;
    background-color: var(--primary-light) !important;
        color: var(--primary) !important;
}

/* Texte de l'option actuellement affichée */
.choices__inner .choices__item {
    color: var(--text-main) !important;
}

/* Retrait de la ligne sous l'élément actif par défaut dans Choices */
.choices__list--dropdown .choices__item--selectable {
    padding-right: 1rem;
}

/* Bloquer strictement l'apparition du menu natif blanc */
select.choices__input,
select.form-control[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* =========================================================
   PROFIL - RESPONSIVE
   Desktop / Tablette / Mobile
   ========================================================= */

/* ---------------------------------------------------------
   BASE
   --------------------------------------------------------- */

.profile-container {
    width: min(800px, calc(100% - 40px));
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
    box-sizing: border-box;
}

.profile-container .header-title {
    margin: 0 0 2rem !important;
}

.profile-card {
    margin-bottom: 2rem !important;
}

.profile-card:last-child {
    margin-bottom: 0 !important;
}

.profile-card .card-body {
    min-width: 0;
}

.profile-card h3 {
    margin-top: 0 !important;
}

.profile-container p {
    overflow-wrap: anywhere;
}


/* ---------------------------------------------------------
   MESSAGES
   --------------------------------------------------------- */

.profile-container .alert ul {
    margin: 0 !important;
    padding-left: 20px !important;
}

.profile-container .alert li {
    overflow-wrap: anywhere;
}


/* ---------------------------------------------------------
   STATISTIQUES
   --------------------------------------------------------- */

.profile-stats {
    display: flex;
    align-items: center;
    gap: 12px 24px;
    flex-wrap: wrap;
    margin: 0 0 20px;
}

.profile-stats p {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 !important;
}

.profile-stats .badge {
    white-space: nowrap;
}


/* ---------------------------------------------------------
   SECTION SÉRIES
   --------------------------------------------------------- */

.profile-series-section {
    min-width: 0;
}

.profile-series-section+.profile-series-section {
    margin-top: 36px;
}

.profile-series-section h3 {
    margin: 0 0 15px !important;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 8px 24px;
    flex-wrap: wrap;
    margin: 0 0 16px;
}

.profile-summary p {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 0 1rem !important;
}

.profile-summary .badge {
    padding: 3px 8px;
    border-radius: var(--radius-md);
    background-color: var(--warning);
    color: var(--text-main);
    white-space: nowrap;
}


/* ---------------------------------------------------------
   TABLEAUX
   --------------------------------------------------------- */

.profile-series-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed;
}

.profile-series-table th,
.profile-series-table td {
    padding: 12px !important;
}

.profile-series-table th {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.profile-series-table th:first-child,
.profile-series-table td:first-child {
    width: 45%;
    text-align: left !important;
}

.profile-series-table th:nth-child(2),
.profile-series-table td:nth-child(2),
.profile-series-table th:nth-child(3),
.profile-series-table td:nth-child(3) {
    width: 27.5%;
    text-align: center !important;
}

.profile-series-table tbody tr {
    border-bottom: 1px solid var(--border-color) !important;
}

.profile-series-table tbody tr:last-child {
    border-bottom: none !important;
}

.profile-series-table td strong {
    overflow-wrap: anywhere;
}

.profile-table-center {
    text-align: center !important;
    vertical-align: middle;
}

.profile-table-empty {
    padding: 16px !important;
    text-align: center !important;
    color: var(--text-muted);
}

.profile-not-synced {
    color: var(--text-muted);
    font-size: 0.85em;
    font-style: italic;
}

.profile-series-table .badge {
    display: inline-block;
    white-space: nowrap;
}


/* ---------------------------------------------------------
   FORMULAIRE MOT DE PASSE
   --------------------------------------------------------- */

.profile-password-form {
    margin-top: 15px !important;
}

.profile-password-form .form-group {
    margin-bottom: 1.5rem !important;
}

.profile-password-form .form-actions {
    margin-top: 2rem !important;
    border-top: none !important;
}

.profile-password-form .btn {
    max-width: 100%;
}

.profile-password-form input {
    max-width: 100%;
    box-sizing: border-box;
}

/* =========================================
   BOUTON SIGNALEMENT & BADGE (Intégré à la carte)
   ========================================= */
.card-actions-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(128, 128, 128, 0.02);
    border-top: 1px solid var(--border-color);
}

.dead-link-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: var(--bg-body);
    color: var(--success-text);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-report-link-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-pill);
    transition: var(--transition);
    margin-left: -8px;
    /* Aligne visuellement l'icône avec le texte du dessus */
}

.btn-report-link-inline:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

@media (max-width: 576px) {
    .card-actions-bottom {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .card-actions-bottom .btn-icon {
        width: 100%;
        justify-content: center;
        background: var(--bg-body);
        padding: 10px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
    }
}


/* =========================================================
   MOBILE
   ≤ 480px
   ========================================================= */

@media (max-width: 480px) {

    .profile-container {
        width: calc(100% - 20px);
        padding: 10px 0;
    }

    .profile-container .header-title {
        font-size: 1.45rem;
        margin-bottom: 1.25rem !important;
    }

    .profile-card {
        margin-bottom: 14px !important;
        border-radius: var(--radius-md);
    }

    .profile-card .card-body {
        padding: 15px !important;
    }


    /* ---------------------------------------------
       INFORMATIONS DU COMPTE
       --------------------------------------------- */

    .profile-card p {
        line-height: 1.5;
    }


    /* ---------------------------------------------
       STATISTIQUES
       --------------------------------------------- */

    .profile-stats {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 14px;
    }

    .profile-stats p {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        justify-content: space-between;
        padding: 11px 13px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--bg-body);
    }


    /* ---------------------------------------------
       SÉRIES
       --------------------------------------------- */

    .profile-series-section h3 {
        font-size: 1.2rem;
        margin-bottom: 12px !important;
    }

    .profile-summary {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
        margin-bottom: 14px;
    }

    .profile-summary p {
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
        padding: 9px 11px;
        margin: 0 !important;
        border-radius: var(--radius-md);
        background: var(--bg-body);
        border: 1px solid var(--border-color);
    }


    /* ---------------------------------------------
       TABLEAU → CARTES
       --------------------------------------------- */

    .profile-series-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto;
    }

    .profile-series-table thead {
        display: none;
    }

    .profile-series-table tbody {
        display: block;
        width: 100%;
    }

    .profile-series-table tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
        padding: 12px;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-md);
        background: var(--bg-body);
    }

    .profile-series-table tr:last-child {
        margin-bottom: 0;
    }

    .profile-series-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100% !important;
        box-sizing: border-box;
        padding: 8px 0 !important;
        border: none !important;
        text-align: right !important;
        vertical-align: middle;
    }

    .profile-series-table td:first-child {
        display: block;
        padding: 2px 0 10px !important;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--border-color) !important;
        text-align: left !important;
        font-size: 1rem;
    }

    .profile-series-table td:nth-child(2)::before {
        content: "Épisodes restants";
    }

    .profile-series-table td:nth-child(3)::before {
        content: "Saisons restantes";
    }

    .profile-series-table td:nth-child(2)::before,
    .profile-series-table td:nth-child(3)::before {
        flex: 1;
        min-width: 0;
        color: var(--text-muted);
        font-size: 0.85rem;
        font-weight: 500;
        text-align: left;
    }

    .profile-series-table td:nth-child(2),
    .profile-series-table td:nth-child(3) {
        min-height: 34px;
    }

    .profile-series-table td:nth-child(2) .badge,
    .profile-series-table td:nth-child(3) .badge {
        flex-shrink: 0;
    }

    .profile-series-table td.profile-table-empty {
        display: block;
        padding: 8px 0 !important;
        border: none !important;
        text-align: center !important;
    }

    .profile-series-table td.profile-table-empty::before {
        display: none;
    }


    /* ---------------------------------------------
       MOT DE PASSE
       --------------------------------------------- */

    .profile-password-form {
        margin-top: 10px !important;
    }

    .profile-password-form .form-group {
        margin-bottom: 1.2rem !important;
    }

    .profile-password-form .form-label {
        display: block;
        margin-bottom: 6px;
    }

    .profile-password-form .form-control {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }

    .profile-password-form .form-actions {
        margin-top: 1.25rem !important;
    }

    .profile-password-form .btn {
        width: 100%;
        min-height: 44px;
        padding: 10px 16px;
    }


    /* ---------------------------------------------
       ALERTES
       --------------------------------------------- */

    .profile-container .alert {
        margin-bottom: 12px;
        padding: 12px;
        font-size: 0.9rem;
    }
}


/* =========================================================
   TRÈS PETITS TÉLÉPHONES
   ≤ 360px
   ========================================================= */

@media (max-width: 360px) {

    .profile-container {
        width: calc(100% - 14px);
        padding: 7px 0;
    }

    .profile-card .card-body {
        padding: 12px !important;
    }

    .profile-container .header-title {
        font-size: 1.3rem;
    }

    .profile-series-table tr {
        padding: 10px;
    }

    .profile-series-table td {
        gap: 8px;
        font-size: 0.9rem;
    }

    .profile-series-table td:nth-child(2)::before,
    .profile-series-table td:nth-child(3)::before {
        font-size: 0.78rem;
    }

    .profile-series-table .badge {
        font-size: 0.8rem;
    }
}


/* =========================================================
   ACCESSIBILITÉ / TOUCH
   ========================================================= */

@media (hover: none) and (pointer: coarse) {

    .profile-container .btn,
    .profile-container button,
    .profile-container input {
        -webkit-tap-highlight-color: transparent;
    }

    .profile-password-form .password-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}


/* =========================================================
   MODE PAYSAGE SUR PETIT MOBILE
   ========================================================= */

@media (max-width: 768px) and (orientation: landscape) {

    .profile-container {
        width: min(680px, calc(100% - 24px));
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   RÈGLES RESPONSIVES (MEDIA QUERIES)
   ========================================= */

/* Tablettes (Paysage) & Petits Écrans (1024px et moins) */
@media (max-width: 1024px) {
    .container {
        padding: 0 16px;
    }

    .form-container {
        padding: 2.5rem;
    }

    .profile-container {
        width: min(800px, calc(100% - 32px));
        padding: 16px 0;
    }

    .profile-card {
        margin-bottom: 20px !important;
    }

    .profile-series-table th,
    .profile-series-table td {
        padding: 11px !important;
    }

    .profile-series-table th:first-child,
    .profile-series-table td:first-child {
        width: 42%;
    }

    .profile-series-table th:nth-child(2),
    .profile-series-table td:nth-child(2),
    .profile-series-table th:nth-child(3),
    .profile-series-table td:nth-child(3) {
        width: 29%;
    }
}

/* Tablettes (Portrait) (768px et moins) */
@media (max-width: 768px) {
    .actions-container {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }

    .actions-container .btn,
    .actions-container>div,
    .actions-container a {
        width: 100%;
        margin: 0 !important;
    }

    /* Centre le texte du lien "Cartes supprimées" quand les boutons sont à 100% */
    .btn-suppr {
        text-align: center;
        display: block;
        padding-top: 5px;
    }

    .form-group.row {
        flex-direction: column;
        gap: 0;
    }

    .form-group.row .col-half {
        margin-bottom: 1.5rem;
        width: 100%;
    }

    .form-group.row .col-half:last-child {
        margin-bottom: 0;
    }

    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
        margin: 0;
    }

    .profile-container {
        width: calc(100% - 28px);
        padding: 14px 0;
    }

    .profile-container .header-title {
        margin-bottom: 1.5rem !important;
        font-size: 1.7rem;
    }

    .profile-card {
        margin-bottom: 16px !important;
    }

    .profile-card .card-body {
        padding: 18px !important;
    }

    .profile-stats {
        gap: 10px;
        margin-bottom: 16px;
    }

    .profile-stats p {
        flex: 1 1 calc(50% - 10px);
        min-width: 220px;
    }

    .profile-summary {
        gap: 8px 14px;
    }

    .profile-summary p {
        margin-left: 0 !important;
    }

    .profile-series-section+.profile-series-section {
        margin-top: 28px;
    }

    /*
        * Sur tablette étroite, on garde le tableau mais on autorise
        * un défilement horizontal si un titre est extrêmement long.
        */
    .profile-series-table {
        min-width: 560px;
    }

    .profile-series-table th,
    .profile-series-table td {
        padding: 10px !important;
    }

    .profile-password-form .form-actions {
        margin-top: 1.5rem !important;
    }

    .profile-password-form .btn {
        width: 100%;
    }
}

/* Mobiles (576px et moins) */
@media (max-width: 576px) {

    .card-filter-bar {
        align-items: stretch;
    }

    .card-filter-bar .choices,
    .card-filter-select {
        width: 100%;
    }

    .card-result-count {
        padding: 4px 2px;
    }

    /* CORRECTION ICI : L'en-tête s'empile proprement verticalement */
    .main-header {
        flex-direction: column;
        align-items: center;
        padding: 15px 20px;
        gap: 15px;
    }

    .user-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        /* Permet aux liens de passer à la ligne si besoin */
        gap: 15px;
    }

    .category-nav {
        padding-bottom: 5px;
        margin-bottom: 25px;
        /* Ajoute un peu de marge visuelle sur les côtés pour le scroll horizontal */
        padding-left: 5px;
        padding-right: 5px;
    }

    .division-title {
        font-size: 1rem;
        padding: 1rem;
    }

    .form-container {
        padding: 1.5rem;
        margin: 1.5rem auto;
        border-radius: var(--radius-md);
    }

    .card-actions-bottom {
        flex-direction: column;
        gap: 10px;
        padding: 1rem;
    }

    .card-actions-bottom .btn-icon {
        width: 100%;
        justify-content: center;
        background: var(--bg-body);
        padding: 10px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
    }

    .toast-container {
        right: 15px;
        left: 15px;
        bottom: 15px;
    }

    .toast {
        width: 100%;
        box-sizing: border-box;
    }
}
