:root {
    --primary: #0b3f75;
    --primary-light: #0a5eb8;
    --primary-dark: #082f59;

    --accent: #d4af37;

    --sidebar-width: 280px;
    --sidebar-collapsed-width: 82px;
    --topbar-height: 76px;

    --body-bg: #f4f7fb;
    --white: #ffffff;

    --text: #1f2937;
    --muted: #6b7280;
    --border: #e7ebf0;

    --transition: 0.25s ease;
}


/* =====================================================
   RESET GLOBAL
===================================================== */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    overflow-x: hidden;

    background: var(--body-bg);
    color: var(--text);

    font-family:
        Inter,
        Arial,
        sans-serif;
}

button,
a {
    font: inherit;
}


/* =====================================================
   APPLICATION
===================================================== */

.app-shell {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
}

.candidate-layout-body,
.candidate-app-shell {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
}


/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
    position: fixed;

    top: 0;
    left: 0;
    bottom: 0;

    z-index: 1000;

    display: flex;
    flex-direction: column;

    width: var(--sidebar-width);
    min-height: 100vh;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            var(--primary-dark) 0%,
            var(--primary) 100%
        );

    color: var(--white);

    transition:
        width var(--transition),
        transform var(--transition);
}


/* =====================================================
   LOGO
===================================================== */

.sidebar-brand {
    display: flex;
    align-items: center;

    min-height: 96px;

    gap: 14px;

    padding: 16px 20px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 58px;
    height: 58px;

    flex-shrink: 0;

    padding: 5px;

    border-radius: 14px;

    background: #ffffff;
}

.brand-logo {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;

    min-width: 0;

    overflow: hidden;

    white-space: nowrap;
}

.brand-text strong {
    font-size: 20px;
    line-height: 1.1;
}

.brand-text span {
    margin-top: 3px;

    color:
        rgba(255, 255, 255, 0.85);

    font-size: 11px;

    letter-spacing: 2px;
}

.brand-text small {
    margin-top: 5px;

    color:
        rgba(255, 255, 255, 0.55);

    font-size: 11px;
}


/* =====================================================
   MENU
===================================================== */

.sidebar-menu {
    flex: 1;

    overflow-y: auto;

    padding:
        22px 12px 20px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    border-radius: 20px;

    background:
        rgba(255, 255, 255, 0.18);
}

.menu-section-title {
    padding:
        16px 14px 8px;

    color:
        rgba(255, 255, 255, 0.42);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 1.3px;

    white-space: nowrap;
}

.menu-item {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 48px;

    gap: 14px;

    padding: 0 14px;

    border: 0;
    border-radius: 10px;

    background: transparent;

    color:
        rgba(255, 255, 255, 0.78);

    text-decoration: none;

    cursor: pointer;

    transition:
        background var(--transition),
        color var(--transition);
}

.menu-item:hover {
    background:
        rgba(255, 255, 255, 0.09);

    color: #ffffff;
}

.menu-item.active {
    background: var(--primary-light);

    color: #ffffff;

    box-shadow:
        0 6px 16px
        rgba(0, 0, 0, 0.16);
}

.menu-icon {
    width: 22px;

    flex-shrink: 0;

    font-size: 16px;

    text-align: center;
}

.menu-text {
    min-width: 0;

    flex: 1;

    overflow: hidden;

    text-align: left;

    white-space: nowrap;
}

.menu-arrow {
    font-size: 12px;

    transition:
        transform var(--transition);
}

.menu-group.open .menu-arrow {
    transform:
        rotate(90deg);
}


/* =====================================================
   SOUS-MENU
===================================================== */

.submenu {
    display: none;

    margin:
        4px 0 8px 36px;

    padding-left: 16px;

    border-left:
        1px solid
        rgba(255, 255, 255, 0.14);
}

.menu-group.open .submenu {
    display: flex;
    flex-direction: column;
}

.submenu a {
    padding:
        9px 10px;

    border-radius: 7px;

    color:
        rgba(255, 255, 255, 0.65);

    font-size: 13px;

    text-decoration: none;

    transition:
        background var(--transition),
        color var(--transition);
}

.submenu a:hover {
    background:
        rgba(255, 255, 255, 0.08);

    color: #ffffff;
}

.submenu a.active {
    background:
        rgba(255, 255, 255, 0.12);

    color: #ffffff;
}


/* =====================================================
   FOOTER SIDEBAR
===================================================== */

.sidebar-footer {
    padding: 14px 12px;

    border-top:
        1px solid
        rgba(255, 255, 255, 0.12);
}

.sidebar-collapse-button {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 46px;

    gap: 14px;

    padding: 0 14px;

    border: 0;
    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.07);

    color: #ffffff;

    cursor: pointer;
}


/* =====================================================
   SIDEBAR RÉDUITE
===================================================== */

.sidebar.collapsed {
    width:
        var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .menu-text,
.sidebar.collapsed .menu-section-title,
.sidebar.collapsed .menu-arrow,
.sidebar.collapsed .submenu {
    display: none;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;

    padding:
        16px 10px;
}

.sidebar.collapsed .menu-item,
.sidebar.collapsed .sidebar-collapse-button {
    justify-content: center;

    padding: 0;
}

.sidebar.collapsed .menu-icon {
    width: auto;
}


/* =====================================================
   MAIN AREA
===================================================== */

.main-area {
    display: flex;
    flex-direction: column;

    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;

    margin-left: var(--sidebar-width);

    flex: 0 0 calc(100% - var(--sidebar-width));

    transition:
        margin-left var(--transition),
        width var(--transition),
        flex-basis var(--transition);
}


/* =====================================================
   MAIN AREA - SIDEBAR RÉDUITE
===================================================== */

.sidebar.collapsed ~ .main-area {
    width:
        calc(
            100% - var(--sidebar-collapsed-width)
        );

    margin-left:
        var(--sidebar-collapsed-width);

    flex-basis:
        calc(
            100% - var(--sidebar-collapsed-width)
        );
}


/* =====================================================
   TOPBAR
===================================================== */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    height: var(--topbar-height);

    flex: 0 0 var(--topbar-height);

    padding: 0 30px;

    position: sticky;
    top: 0;

    z-index: 900;

    border-bottom:
        1px solid var(--border);

    background:
        rgba(255, 255, 255, 0.96);

    backdrop-filter:
        blur(12px);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;

    min-width: 0;
}

.topbar-left {
    gap: 20px;
}

.topbar-right {
    gap: 14px;
}


/* =====================================================
   BOUTONS TOPBAR
===================================================== */

.sidebar-toggle,
.topbar-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: #ffffff;

    color: #374151;

    cursor: pointer;

    position: relative;

    transition:
        background var(--transition),
        border-color var(--transition);
}

.sidebar-toggle:hover,
.topbar-icon-button:hover {
    border-color: #d6dce5;

    background: #f8fafc;
}


/* =====================================================
   BREADCRUMB
===================================================== */

.breadcrumb {
    display: flex;
    align-items: center;

    min-width: 0;

    gap: 10px;

    color: var(--muted);

    font-size: 14px;
}

.breadcrumb strong {
    color: var(--text);
}


/* =====================================================
   ESPACE CANDIDAT
===================================================== */

.candidate-space-link {
    display: flex;
    align-items: center;

    gap: 8px;

    padding: 10px 14px;

    border-radius: 9px;

    background: #f0f6ff;

    color: var(--primary-light);

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
}


/* =====================================================
   NOTIFICATIONS
===================================================== */

.notification-badge {
    position: absolute;

    top: 4px;
    right: 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 17px;
    height: 17px;

    padding: 0 4px;

    border-radius: 20px;

    background: #dc2626;

    color: #ffffff;

    font-size: 9px;
    font-weight: 700;
}


/* =====================================================
   UTILISATEUR
===================================================== */

.user-menu-button {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 5px 8px 5px 5px;

    border: 0;
    border-radius: 12px;

    background: transparent;

    cursor: pointer;
}

.user-menu-button:hover {
    background: #f7f9fc;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            var(--primary-light),
            var(--primary)
        );

    color: #ffffff;

    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;

    min-width: 0;

    text-align: left;
}

.user-info strong {
    font-size: 13px;
}

.user-info span {
    margin-top: 2px;

    color: var(--muted);

    font-size: 11px;
}

.user-chevron {
    flex-shrink: 0;

    color: #9ca3af;

    font-size: 11px;
}


/* =====================================================
   PAGE CONTENT
===================================================== */

.page-content {
    width: 100%;
    min-width: 0;

    flex: 1 1 auto;

    min-height:
        calc(
            100vh - var(--topbar-height)
        );

    margin: 0;

    padding: 30px;

    max-width: none;

    box-sizing: border-box;
}

.page-content > * {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.candidate-page-content {
    display: block;
    overflow: visible;
}

.candidate-page-content-inner {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
}


/* =====================================================
   UPEAC DATA GRID
===================================================== */

.upeac-data-grid {
    width: 100%;
}

.data-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    padding: 18px 20px;

    border-bottom: 1px solid #edf0f4;
}

.data-grid-search {
    display: flex;
    align-items: center;

    width: 100%;
    max-width: 360px;
    height: 42px;

    gap: 10px;

    padding: 0 14px;

    border: 1px solid #dce3ec;
    border-radius: 9px;

    background: #ffffff;

    color: #9aa4b2;
}

.data-grid-search-input {
    width: 100%;

    border: 0;
    outline: none;

    background: transparent;

    color: #374151;

    font-size: 13px;
}

.data-grid-actions {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    gap: 10px;
}

.data-grid-responsive {
    width: 100%;

    overflow-x: auto;
}

.data-grid-table {
    width: 100%;
    min-width: 750px;

    border-collapse: collapse;
}

.data-grid-table th {
    padding: 13px 20px;

    background: #f8fafc;

    color: #6b7280;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.4px;

    text-align: left;
    text-transform: uppercase;
}

.data-grid-table td {
    padding: 15px 20px;

    border-top: 1px solid #eef1f5;

    color: #4b5563;

    font-size: 13px;
}

.data-grid-table tbody tr {
    transition: background 0.2s ease;
}

.data-grid-table tbody tr:hover {
    background: #fafcff;
}

.data-grid-empty {
    height: 180px;

    color: #9aa4b2;

    text-align: center !important;
}

.data-grid-empty i {
    display: block;

    margin-bottom: 12px;

    font-size: 30px;
}


/* =====================================================
   ALIGNEMENTS
===================================================== */

.text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}


/* =====================================================
   BADGES
===================================================== */

.data-grid-status {
    display: inline-flex;
    align-items: center;

    padding: 6px 10px;

    border-radius: 20px;

    font-size: 11px;
    font-weight: 600;
}

.data-grid-status.status-success {
    background: #ecfdf3;
    color: #15803d;
}

.data-grid-status.status-pending {
    background: #fefce8;
    color: #a16207;
}

.data-grid-status.status-danger {
    background: #fff1f2;
    color: #be123c;
}

.data-grid-status.status-info {
    background: #eff6ff;
    color: #2563eb;
}


/* =====================================================
   AVATAR DATA GRID
===================================================== */

.data-grid-avatar-cell {
    display: flex;
    align-items: center;

    gap: 10px;
}

.data-grid-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #edf5ff;

    color: #0a5eb8;

    font-size: 11px;
    font-weight: 700;
}


/* =====================================================
   UPEAC FORM BUILDER
===================================================== */

.upeac-form {
    width: 100%;
    min-width: 0;
}


/* =====================================================
   EN-TÊTE DU FORMULAIRE
===================================================== */

.upeac-form-header {
    padding: 24px 28px;

    border-bottom: 1px solid #edf0f4;

    background: #ffffff;
}

.upeac-form-header h2 {
    margin: 0;

    color: #172033;

    font-size: 20px;
    font-weight: 700;
}

.upeac-form-header p {
    margin: 7px 0 0;

    color: #6b7280;

    font-size: 13px;

    line-height: 1.6;
}


/* =====================================================
   CORPS DU FORMULAIRE
===================================================== */

.upeac-form-body {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 22px;

    width: 100%;

    padding: 28px;

    background: #ffffff;
}


/* =====================================================
   COLONNES
===================================================== */

.upeac-form-column-full {
    grid-column: span 2;
}

.upeac-form-column-half {
    grid-column: span 1;
}


/* =====================================================
   GROUPE DE CHAMP
===================================================== */

.upeac-form-group {
    width: 100%;
    min-width: 0;
}

.upeac-form-group > label {
    display: inline-flex;
    align-items: center;

    margin-bottom: 8px;

    color: #374151;

    font-size: 13px;
    font-weight: 600;
}


/* =====================================================
   CHAMPS
===================================================== */

.upeac-form-control {
    width: 100%;
    min-height: 44px;

    padding: 10px 13px;

    border: 1px solid #dce3ec;
    border-radius: 9px;

    outline: none;

    background: #ffffff;

    color: #263244;

    font-family: inherit;
    font-size: 13px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.upeac-form-control::placeholder {
    color: #a0a8b5;

    opacity: 1;
}

.upeac-form-control:focus {
    border-color: #0a5eb8;

    box-shadow:
        0 0 0 3px
        rgba(10, 94, 184, 0.10);
}


/* =====================================================
   CHAMPS READONLY / DISABLED
===================================================== */

.upeac-form-control:disabled {
    cursor: not-allowed;

    background: #f5f7fa;

    color: #9aa4b2;
}

.upeac-form-control[readonly] {
    background: #f8fafc;

    color: #64748b;
}


/* =====================================================
   TEXTAREA
===================================================== */

textarea.upeac-form-control {
    min-height: 110px;

    resize: vertical;

    line-height: 1.5;
}


/* =====================================================
   SELECT
===================================================== */

select.upeac-form-control {
    cursor: pointer;

    appearance: auto;
}


/* =====================================================
   CHAMP FICHIER
===================================================== */

.upeac-file-wrapper {
    width: 100%;
}

.upeac-file-input {
    padding: 8px 12px;

    cursor: pointer;
}

.upeac-file-input::file-selector-button {
    margin-right: 12px;

    padding: 7px 12px;

    border: 0;
    border-radius: 6px;

    background: #edf5ff;

    color: #0a5eb8;

    font-family: inherit;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.upeac-file-input::file-selector-button:hover {
    background: #0a5eb8;

    color: #ffffff;
}


/* =====================================================
   OPTIONS RADIO
===================================================== */

.upeac-form-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;

    min-height: 44px;

    gap: 16px;
}

.upeac-radio-option {
    display: inline-flex;
    align-items: center;

    gap: 8px;

    margin: 0 !important;

    color: #4b5563;

    font-size: 13px;
    font-weight: 500;

    cursor: pointer;
}

.upeac-radio-option input[type="radio"] {
    width: 16px;
    height: 16px;

    margin: 0;

    accent-color: #0a5eb8;

    cursor: pointer;
}


/* =====================================================
   CHECKBOX
===================================================== */

.upeac-checkbox-option {
    display: inline-flex;
    align-items: center;

    min-height: 44px;

    gap: 9px;

    color: #4b5563;

    font-size: 13px;
    font-weight: 500;

    cursor: pointer;
}

.upeac-checkbox-option input[type="checkbox"] {
    width: 17px;
    height: 17px;

    margin: 0;

    accent-color: #0a5eb8;

    cursor: pointer;
}


/* =====================================================
   CHAMPS OBLIGATOIRES
===================================================== */

.required-mark {
    margin-left: 4px;

    color: #dc2626;

    font-size: 14px;
    font-weight: 700;
}


/* =====================================================
   TEXTE D'AIDE
===================================================== */

.upeac-form-help {
    display: block;

    margin-top: 6px;

    color: #8a94a3;

    font-size: 11px;

    line-height: 1.5;
}


/* =====================================================
   ERREURS
===================================================== */

.upeac-form-group.has-error
.upeac-form-control {
    border-color: #dc2626;
}

.upeac-form-group.has-error
.upeac-form-control:focus {
    border-color: #dc2626;

    box-shadow:
        0 0 0 3px
        rgba(220, 38, 38, 0.10);
}

.upeac-form-error {
    display: flex;
    align-items: flex-start;

    gap: 6px;

    margin-top: 7px;

    color: #dc2626;

    font-size: 11px;

    line-height: 1.5;
}

.upeac-form-error i {
    margin-top: 1px;
}


/* =====================================================
   ACTIONS DU FORMULAIRE
===================================================== */

.upeac-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    padding: 20px 28px;

    border-top: 1px solid #edf0f4;

    background: #fafbfc;
}

.upeac-form-actions .btn-primary,
.upeac-form-actions .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;

    gap: 8px;

    padding: 0 18px;

    border-radius: 9px;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
}


/* =====================================================
   FORMULAIRE EN UNE COLONNE
===================================================== */

.upeac-form-body.form-single-column {
    grid-template-columns: 1fr;
}

.upeac-form-body.form-single-column
.upeac-form-column-full {
    grid-column: span 1;
}


/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 1100px) {

    .candidate-space-link span {
        display: none;
    }

    .candidate-space-link {
        display: flex;
        align-items: center;
        justify-content: center;

        width: 42px;
        height: 42px;

        padding: 0;
    }

}


@media (max-width: 768px) {

    .sidebar {
        width:
            var(--sidebar-width);

        transform:
            translateX(-100%);
    }

    .sidebar.mobile-open {
        transform:
            translateX(0);
    }

    .sidebar.collapsed {
        width:
            var(--sidebar-width);
    }

    .main-area,
    .sidebar.collapsed ~ .main-area {
        width: 100%;

        margin-left: 0;

    }

    .topbar {
        padding: 0 16px;
    }

    .breadcrumb-label,
    .user-info,
    .user-chevron {
        display: none;
    }

    .page-content {
        width: 100%;

        padding: 20px;
    }

    .upeac-form-header {
        padding: 20px;
    }

    .upeac-form-body {
        grid-template-columns: 1fr;

        gap: 18px;

        padding: 20px;
    }

    .upeac-form-column-full,
    .upeac-form-column-half {
        grid-column: span 1;
    }

    .upeac-form-actions {
        padding: 18px 20px;
    }

}


@media (max-width: 700px) {

    .data-grid-toolbar {
        flex-direction: column;

        align-items: stretch;
    }

    .data-grid-search {
        max-width: none;
    }

    .data-grid-actions {
        justify-content: flex-end;
    }

}


@media (max-width: 480px) {

    .page-content {
        padding: 16px;
    }

    .upeac-form-header h2 {
        font-size: 18px;
    }

    .upeac-form-options {
        flex-direction: column;

        align-items: flex-start;

        gap: 10px;
    }

    .upeac-form-actions {
        flex-direction: column-reverse;

        align-items: stretch;
    }

    .upeac-form-actions .btn-primary,
    .upeac-form-actions .btn-outline {
        width: 100%;
    }

}