/* ==================================================
   RÉGLAGES GÉNÉRAUX
================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --background: #09080d;
    --surface: #121018;
    --surface-light: #191620;
    --surface-hover: #24202c;

    --purple: #8b5cf6;
    --purple-light: #b99aff;
    --purple-dark: #6d3bd9;

    --text: #ffffff;
    --text-secondary: #aaa4b5;
    --text-muted: #746e7c;

    --border: #302a39;
    --border-light: rgba(185, 154, 255, 0.23);

    --danger: #ff8f9c;
    --danger-background: #3b2027;

    --success: #8ee6bd;
    --sidebar-width: 270px;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* ==================================================
   ÉLÉMENTS PARTAGÉS
================================================== */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-logo {
    display: flex;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: white;
    background: linear-gradient(
        135deg,
        var(--purple-dark),
        var(--purple-light)
    );
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.28);
    font-size: 21px;
    font-weight: 800;
}

.brand-name {
    font-size: 23px;
    font-weight: 750;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    min-height: 44px;
    padding: 11px 17px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 10px;
    font-weight: 700;
    transition:
        background 0.2s,
        border-color 0.2s,
        box-shadow 0.2s,
        transform 0.2s;
}

.primary-button {
    color: white;
    background: linear-gradient(
        135deg,
        var(--purple-dark),
        var(--purple)
    );
    border: none;
    box-shadow: 0 10px 24px rgba(109, 59, 217, 0.23);
}

.primary-button:hover {
    background: linear-gradient(135deg, #7946e7, #9e75fa);
    box-shadow: 0 13px 30px rgba(109, 59, 217, 0.34);
    transform: translateY(-1px);
}

.secondary-button {
    color: #ddd7e5;
    background: #2b2632;
    border: 1px solid #3c3545;
}

.secondary-button:hover {
    background: #393240;
    border-color: #51475c;
}

.form-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #ded9e7;
    font-size: 14px;
    font-weight: 700;
}

.form-group input,
.form-group textarea,
.form-group select,
.dashboard-toolbar input,
.dashboard-toolbar select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--text);
    background: #0e0c13;
    border: 1px solid #403849;
    border-radius: 10px;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        background 0.2s;
}

.form-group textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.dashboard-toolbar input::placeholder {
    color: #6f6878;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.dashboard-toolbar input:focus,
.dashboard-toolbar select:focus {
    background: #110e18;
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.13);
}

.form-group input[type="file"] {
    min-height: 58px;
    padding: 10px;
}

.form-group input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 9px 12px;
    color: white;
    background: #312441;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.form-group small {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

/* ==================================================
   PAGE DE CONNEXION
================================================== */

.login-page {
    display: grid;
    min-height: 100vh;
    grid-template-rows: auto 1fr auto;
    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(92, 53, 145, 0.42) 0%,
            rgba(25, 18, 36, 0.3) 38%,
            transparent 66%
        ),
        var(--background);
}

.login-header {
    display: flex;
    min-height: 80px;
    padding: 20px 40px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.login-main {
    display: flex;
    width: 100%;
    padding: 45px 20px;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 38px;
    background: rgba(23, 19, 31, 0.94);
    border: 1px solid var(--border-light);
    border-radius: 22px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
}

.login-icon {
    display: flex;
    width: 62px;
    height: 62px;
    margin: 0 auto 23px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        135deg,
        var(--purple-dark),
        var(--purple-light)
    );
    border-radius: 17px;
    box-shadow: 0 15px 35px rgba(139, 92, 246, 0.35);
    font-size: 29px;
    font-weight: 800;
}

.login-introduction {
    margin-bottom: 27px;
    text-align: center;
}

.login-introduction h1 {
    margin-bottom: 10px;
    font-size: 29px;
}

.login-introduction p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.55;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 19px;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 90px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    padding: 7px 9px;
    color: var(--purple-light);
    background: transparent;
    border: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    transform: translateY(-50%);
}

.password-toggle:hover {
    background: rgba(139, 92, 246, 0.13);
}

.login-button {
    width: 100%;
    min-height: 50px;
    margin-top: 3px;
    padding: 13px 20px;
    color: white;
    background: linear-gradient(
        135deg,
        var(--purple-dark),
        var(--purple)
    );
    border: none;
    border-radius: 11px;
    box-shadow: 0 12px 25px rgba(109, 59, 217, 0.25);
    font-weight: 750;
}

.login-button:hover {
    background: linear-gradient(135deg, #7946e7, #9e75fa);
    transform: translateY(-1px);
}

.login-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.form-message {
    min-height: 20px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

.form-message.success {
    color: var(--success);
}

.form-message.error {
    color: var(--danger);
}

.login-information {
    display: flex;
    margin-top: 8px;
    padding: 15px;
    align-items: flex-start;
    gap: 10px;
    background: rgba(139, 92, 246, 0.07);
    border: 1px solid rgba(139, 92, 246, 0.14);
    border-radius: 11px;
}

.login-information p {
    color: #aaa3b4;
    font-size: 12px;
    line-height: 1.5;
}

.login-footer {
    padding: 20px;
    color: #716b7b;
    font-size: 12px;
    text-align: center;
}

/* ==================================================
   TABLEAU DE BORD
================================================== */

.dashboard-page {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 70% 0%,
            rgba(91, 49, 143, 0.13),
            transparent 38%
        ),
        var(--background);
}

/* Barre latérale */

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    width: var(--sidebar-width);
    padding: 22px 16px;
    flex-direction: column;
    background: #100e15;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    margin-bottom: 31px;
    padding: 0 8px;
    align-items: center;
    justify-content: space-between;
}

.mobile-close-button {
    display: none;
    width: 35px;
    height: 35px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 27px;
}

.main-navigation {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.navigation-button {
    display: grid;
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    grid-template-columns: 25px 1fr auto;
    align-items: center;
    gap: 7px;
    color: #aaa4b5;
    background: transparent;
    border: none;
    border-radius: 9px;
    text-align: left;
}

.navigation-button:hover,
.navigation-button.active {
    color: white;
    background: #292136;
}

.navigation-icon {
    color: var(--purple-light);
    font-size: 17px;
}

.navigation-count {
    min-width: 24px;
    padding: 3px 7px;
    color: #a89fb3;
    background: #25202c;
    border-radius: 20px;
    font-size: 11px;
    text-align: center;
}

.sidebar-section {
    margin-top: 28px;
}

.sidebar-section-header {
    display: flex;
    min-height: 32px;
    padding: 0 8px;
    align-items: center;
    justify-content: space-between;
}

.sidebar-section-header h2 {
    color: #817a8b;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.icon-button {
    display: flex;
    width: 29px;
    height: 29px;
    align-items: center;
    justify-content: center;
    color: white;
    background: #2b203b;
    border: none;
    border-radius: 8px;
    font-size: 19px;
}

.icon-button:hover {
    background: var(--purple-dark);
}

.categories-list {
    display: flex;
    margin-top: 7px;
    flex-direction: column;
    gap: 4px;
}

.sidebar-empty-message {
    padding: 10px 8px;
    color: #696371;
    font-size: 13px;
}

.category-sidebar-item,
.subcategory-sidebar-item {
    display: flex;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    align-items: center;
    gap: 8px;
    color: #aaa4b5;
    background: transparent;
    border: none;
    border-radius: 8px;
    text-align: left;
}

.category-sidebar-item:hover,
.subcategory-sidebar-item:hover,
.category-sidebar-item.active,
.subcategory-sidebar-item.active {
    color: white;
    background: #251f2d;
}

.subcategory-sidebar-item {
    padding-left: 33px;
    font-size: 13px;
}

.category-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    background: var(--purple);
    border-radius: 50%;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 25px;
}

.user-summary {
    display: flex;
    margin-bottom: 12px;
    padding: 11px;
    align-items: center;
    gap: 10px;
    background: #17141c;
    border: 1px solid #29242f;
    border-radius: 11px;
}

.user-avatar {
    display: flex;
    width: 37px;
    height: 37px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    background: #342548;
    border-radius: 10px;
    font-weight: 800;
}

.user-information {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.user-information strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-information span {
    color: #817a8b;
    font-size: 11px;
}

.logout-button {
    width: 100%;
    min-height: 40px;
    color: var(--danger);
    background: transparent;
    border: 1px solid #49313a;
    border-radius: 9px;
    font-weight: 700;
}

.logout-button:hover {
    background: var(--danger-background);
}

/* Contenu principal */

.dashboard-main {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.dashboard-header {
    display: flex;
    min-height: 95px;
    padding: 23px 38px;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    background: rgba(15, 13, 20, 0.84);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-title-group h1 {
    margin-bottom: 5px;
    font-size: 27px;
}

.header-title-group p {
    color: var(--text-secondary);
    font-size: 14px;
}

.mobile-menu-button {
    display: none;
    width: 40px;
    height: 40px;
    color: white;
    background: #211c28;
    border: 1px solid #332c3d;
    border-radius: 9px;
    font-size: 20px;
}

.dashboard-toolbar {
    display: flex;
    padding: 28px 38px 15px;
    align-items: center;
    gap: 13px;
}

.search-field {
    position: relative;
    width: min(100%, 600px);
}

.search-field input {
    padding-left: 42px;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    z-index: 1;
    color: #7f7888;
    font-size: 20px;
    transform: translateY(-50%);
}

.dashboard-toolbar select {
    width: auto;
    min-width: 180px;
}

.library-summary {
    display: flex;
    padding: 7px 38px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.library-summary strong {
    color: white;
}

.storage-information {
    color: #777080;
    font-size: 11px;
}

/* Vidéothèque */

.video-library {
    padding: 10px 38px 40px;
}

.empty-library,
.no-results {
    display: flex;
    min-height: 420px;
    padding: 40px 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(18, 16, 24, 0.8);
    border: 1px dashed #443b4f;
    border-radius: 17px;
}

.empty-library-icon {
    display: flex;
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: center;
    color: #c8a9ff;
    background: #2b203b;
    border-radius: 50%;
    font-size: 25px;
}

.empty-library h2,
.no-results h2 {
    margin-bottom: 8px;
    font-size: 21px;
}

.empty-library p,
.no-results p {
    max-width: 440px;
    margin-bottom: 22px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
}

.video-card {
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        transform 0.2s;
}

.video-card:hover {
    border-color: #684d86;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
    transform: translateY(-2px);
}

.video-card video {
    display: block;
    width: 100%;
    height: 185px;
    background: black;
    object-fit: contain;
}

.video-card-content {
    padding: 16px;
}

.video-card-badges {
    display: flex;
    margin-bottom: 11px;
    flex-wrap: wrap;
    gap: 6px;
}

.video-badge {
    display: inline-block;
    padding: 5px 8px;
    color: #cdb2ff;
    background: #2b203b;
    border-radius: 20px;
    font-size: 11px;
}

.video-card h3 {
    margin-bottom: 7px;
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-description {
    display: -webkit-box;
    min-height: 40px;
    overflow: hidden;
    color: #928b9b;
    font-size: 13px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.video-card-footer {
    display: flex;
    margin-top: 15px;
    padding-top: 13px;
    flex-wrap: wrap;
    gap: 7px;
    border-top: 1px solid #2b2632;
}

.card-action,
.download-action {
    padding: 7px 9px;
    color: #d8d2df;
    background: #2b2632;
    border: none;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.card-action:hover,
.download-action:hover {
    color: white;
    background: #41374c;
}

.delete-action {
    color: var(--danger);
}

/* ==================================================
   FENÊTRES
================================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    padding: 20px;
    align-items: center;
    justify-content: center;
    background: rgba(5, 4, 8, 0.84);
    backdrop-filter: blur(6px);
}

.modal-card {
    width: 100%;
    max-width: 580px;
    max-height: 92vh;
    padding: 27px;
    overflow-y: auto;
    background: #17131f;
    border: 1px solid #443752;
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.category-modal-card {
    max-width: 650px;
}

.modal-header {
    display: flex;
    margin-bottom: 24px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.modal-header h2 {
    margin-bottom: 5px;
    font-size: 23px;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.modal-close-button {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 28px;
}

.modal-close-button:hover {
    color: white;
    background: #2d2637;
}

.modal form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.modal-actions {
    display: flex;
    margin-top: 3px;
    justify-content: flex-end;
    gap: 10px;
}

.modal-message {
    min-height: 18px;
    color: var(--danger);
    font-size: 13px;
}

.selected-file-information {
    display: flex;
    margin-top: -8px;
    padding: 12px;
    flex-direction: column;
    gap: 4px;
    background: #211a2c;
    border-radius: 9px;
}

.selected-file-information strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-information span {
    color: var(--text-secondary);
    font-size: 11px;
}

/* Gestion des catégories */

.category-management {
    margin-top: 27px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.category-management h3 {
    margin-bottom: 13px;
    font-size: 16px;
}

.category-management-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.management-empty-message {
    color: var(--text-muted);
    font-size: 13px;
}

.management-category {
    padding: 12px;
    background: #211d28;
    border: 1px solid #332d3c;
    border-radius: 10px;
}

.management-category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.management-category-name {
    font-size: 14px;
    font-weight: 700;
}

.management-actions {
    display: flex;
    gap: 6px;
}

.management-button {
    padding: 6px 8px;
    color: #d8d2df;
    background: #332d3c;
    border: none;
    border-radius: 6px;
    font-size: 11px;
}

.management-delete-button {
    color: var(--danger);
}

.management-subcategories {
    display: flex;
    margin-top: 9px;
    padding-left: 14px;
    flex-direction: column;
    gap: 6px;
}

.management-subcategory {
    display: flex;
    padding: 7px 8px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #aaa4b5;
    background: #18151e;
    border-radius: 7px;
    font-size: 12px;
}

/* ==================================================
   ADAPTATION AUX PETITS ÉCRANS
================================================== */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(5, 4, 8, 0.72);
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-close-button,
    .mobile-menu-button {
        display: block;
    }

    .dashboard-main {
        width: 100%;
        margin-left: 0;
    }

    .dashboard-header {
        padding: 20px 24px;
    }

    .dashboard-toolbar,
    .library-summary,
    .video-library {
        padding-right: 24px;
        padding-left: 24px;
    }
}

@media (max-width: 650px) {
    .login-header {
        min-height: 70px;
        padding: 15px 20px;
    }

    .login-main {
        padding: 25px 14px;
        align-items: flex-start;
    }

    .login-card {
        padding: 28px 21px;
        border-radius: 18px;
    }

    .login-introduction h1 {
        font-size: 25px;
    }

    .dashboard-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-header .primary-button {
        width: 100%;
    }

    .dashboard-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-toolbar select {
        width: 100%;
    }

    .library-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .videos-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 10px;
        align-items: flex-end;
    }

    .modal-card {
        max-height: 94vh;
        padding: 22px 18px;
        border-radius: 18px 18px 10px 10px;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 24px 16px;
    }

    .password-toggle {
        position: static;
        width: 100%;
        margin-top: 8px;
        background: rgba(139, 92, 246, 0.1);
        transform: none;
    }

    .password-field input {
        padding-right: 14px;
    }
}