/* ===============================
   VARIABLES (style atelier)
=============================== */
:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1f2328;
    --muted: #6c757d;
    --border: #e6e8ec;
    --title: #035e29;
    --riopel-green: #1f8a4c;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* ===============================
   WRAPPER PRINCIPAL (borda verde)
=============================== */
.atelier-wrapper {
    max-width: min(1800px, 98vw);
    margin: 16px auto;
    border: 3px solid var(--riopel-green);
    border-radius: 16px;
    background: #ffffff;
}

/* ===============================
   HEADER
=============================== */
.atelier-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 2px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    max-width: 240px;
    height: auto;
}

.header-center {
    text-align: center;
}

.header-center h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--title);
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

/* ===============================
   CONTENT
=============================== */
.atelier-content {
    padding: 16px 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--title);
    margin-bottom: 16px;
}

.section-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 30px -20px;
}

/* ===============================
   UPLOAD AREA
=============================== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    background: #fafbfc;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-area:hover {
    border-color: var(--riopel-green);
    background: #f0f8f4;
}

.upload-area.dragover {
    border-color: var(--riopel-green);
    background: #e8f5ee;
}

.upload-icon {
    font-size: 48px;
    color: var(--riopel-green);
}

.upload-area p {
    color: var(--muted);
    margin: 0;
}


/* ===============================
   BUTTONS
=============================== */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-riopel {
    background-color: var(--riopel-green);
    color: white;
    border-color: var(--riopel-green);
}

.btn-riopel:hover {
    background-color: #17703e;
    border-color: #17703e;
    color: white;
}

.btn-outline-riopel {
    background-color: transparent;
    color: var(--riopel-green);
    border-color: var(--riopel-green);
}

.btn-outline-riopel:hover {
    background-color: var(--riopel-green);
    color: white;
    border-color: var(--riopel-green);
}

.btn-success {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-pagination {
    background-color: white;
    color: var(--text);
    border-color: var(--border);
}

.btn-pagination:hover:not(:disabled) {
    background-color: #f8f9fa;
    border-color: var(--riopel-green);
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===============================
   FILE INFO
=============================== */
.file-info {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.file-info p {
    margin: 8px 0;
}

.file-info button {
    margin-right: 10px;
    margin-top: 12px;
}

/* ===============================
   PROGRESS BAR
=============================== */
.progress-container {
    margin-top: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
}

.progress-bar-custom {
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--riopel-green), #28a745);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.progress-details {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

#cancelImportBtn {
    width: auto;
    margin: 12px auto 0;
    display: block;
    padding: 6px 16px;
    font-size: 14px;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.mt-2 {
    margin-top: 8px;
}

/* ===============================
   ALERTS
=============================== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-top: 16px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* ===============================
   TABLE SECTION
=============================== */
.section-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: var(--riopel-green);
}

.table-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.table-info p {
    margin: 0;
}

.per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-page label {
    margin: 0;
    font-weight: 600;
}

/* ===============================
   TABLE
=============================== */
.table-container {
    position: relative;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table th {
    background: var(--riopel-green);
    padding: 8px 12px;
    text-align: left;
    font-weight: 700;
    color: white;
    border-bottom: 2px solid var(--border);
    white-space: normal;
    line-height: 1.2;
    vertical-align: middle;
}

/* Wrapper interno do th: centraliza verticalmente e alinha o ícone com o texto */
.th-inner {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

/* Última linha do título (com o ícone inline) */
.th-last-line {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.table th.narrow-col {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.table th.sortable:hover {
    background: #0d6b3a;
    cursor: pointer;
}



.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}



.table .narrow-col {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.table .col-date {
    width: 155px;
    min-width: 155px;
    max-width: 155px;
}

.table .col-forme-juri {
    min-width: 175px;
    width: 175px;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center;
    color: var(--muted);
    padding: 40px !important;
}

/* ===============================
   LOADING OVERLAY
=============================== */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
}

.loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-img {
    width: 64px;
    height: 64px;
}

.loading-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--title);
}

.bar {
    fill: var(--riopel-green);
    transform-origin: center 20px;
    animation: bounce 0.9s ease-in-out infinite;
}

.b1 {
    animation-delay: 0s;
}

.b2 {
    animation-delay: 0.08s;
}

.b3 {
    animation-delay: 0.16s;
}

.b4 {
    animation-delay: 0.24s;
}

.b5 {
    animation-delay: 0.32s;
}

@keyframes bounce {

    0%,
    100% {
        transform: scaleY(0.55);
        opacity: 0.55;
    }

    50% {
        transform: scaleY(1.25);
        opacity: 1;
    }
}

/* ===============================
   PAGINATION
=============================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.page-info input {
    width: 60px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

.page-info input:focus {
    outline: none;
    border-color: var(--riopel-green);
}

/* ===============================
   RESPONSIVE
=============================== */
@media (max-width: 768px) {
    .atelier-wrapper {
        margin: 6px;
        border-radius: 12px;
    }

    .atelier-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .header-left,
    .header-right {
        justify-content: center;
    }

    .header-logo {
        max-width: 160px;
    }

    .header-center h1 {
        font-size: 20px;
    }

    .section-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .controls {
        width: 100%;
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .table-info {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .pagination {
        font-size: 13px;
    }

    .btn-pagination {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ===============================
   FILE CHECKLIST (dual slots)
=============================== */
.file-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fafbfc;
    transition: all 0.25s;
}

.file-slot.slot-ready {
    border-color: #0d6efd;
    background: #f0f5ff;
}

.file-slot.slot-done {
    border-color: #28a745;
    background: #f0fff5;
}

.file-slot-status {
    display: flex;
    align-items: center;
    gap: 14px;
}

.slot-icon {
    font-size: 22px;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.slot-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.slot-info strong {
    font-size: 15px;
    color: var(--text);
}

.slot-detail {
    font-size: 13px;
    color: var(--muted);
}

.slot-detail.text-primary {
    color: #0d6efd !important;
}

.slot-detail.text-success {
    color: #28a745 !important;
}

.slot-detail.text-warning {
    color: #d9a300 !important;
    /* Un jaune sombre plus visible sur fond clair */
}

/* Slot active pulsing effect */
.file-slot.slot-active {
    border-color: #f1c40f;
    background: #fffdf0;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
    animation: slot-pulse 2s infinite;
}

@keyframes slot-pulse {
    0% {
        box-shadow: 0 0 5px rgba(241, 196, 15, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
    }

    100% {
        box-shadow: 0 0 5px rgba(241, 196, 15, 0.2);
    }
}

/* ===============================
   FILTER STATUS
   =============================== */
.filter-status-area {
    background: #eef2f7;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border-left: 4px solid var(--riopel-green);
}

.filter-badge {
    background: white;
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-badge strong {
    color: var(--riopel-green);
}

.btn-remove-filter {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.btn-remove-filter:hover {
    color: #dc3545;
}

/* Upload area compact when a file is ready */
.upload-area p:last-of-type {
    margin-bottom: 0;
}

/* ===============================
   FILTER DROPDOWN PANELS
=============================== */
.filter-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.filter-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.filter-dropdown-btn .filter-chevron {
    font-size: 0.75em;
    transition: transform 0.2s;
}

.filter-dropdown-btn.active {
    background-color: var(--riopel-green);
    color: white;
    border-color: var(--riopel-green);
}

.filter-dropdown-btn.active .filter-chevron {
    transform: rotate(180deg);
}

.filter-dropdown-btn.has-selection {
    background-color: var(--riopel-green);
    color: white;
    border-color: var(--riopel-green);
}

.filter-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 240px;
    overflow: hidden;
}

.filter-dropdown-panel.open {
    display: block;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    background: #f8f9fa;
}

.btn-clear-filter-panel {
    background: none;
    border: none;
    color: var(--riopel-green);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    font-weight: 600;
}

.btn-clear-filter-panel:hover {
    color: #0d6b3a;
    text-decoration: underline;
}

.filter-checkbox-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 0;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
}

.filter-checkbox-item:hover {
    background: #f0f8f4;
}

.filter-checkbox-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--riopel-green);
    cursor: pointer;
    flex-shrink: 0;
}

.filter-checkbox-item label {
    margin: 0;
    cursor: pointer;
    color: var(--text);
    line-height: 1.3;
}

.filter-loading {
    padding: 12px 14px;
    color: var(--muted);
    font-size: 13px;
}

.filter-panel-footer {
    padding: 8px 14px 10px;
    border-top: 1px solid var(--border);
    background: #f8f9fa;
}

/* ─── Classes utilitaires (remplacent les attributs style="" en ligne — OWASP A02, CSP) ─── */
.login-title { color: var(--title); font-weight: 800; }
.d-none-init { display: none; }
.d-inline-block { display: inline; }
.text-size-075em { font-size: 0.75em; }
.text-size-085em { font-size: 0.85em; }
.text-size-09em { font-size: 0.9em; }
.btn-tab-xs { padding: 2px 8px; font-size: 0.75rem; }
.progress-slim {
    height: 10px;
    border-radius: 5px;
    background: #e9ecef;
    overflow: hidden;
}
.progress-slim-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #1f8a4c, #28a745);
    transition: width 0.4s ease;
    border-radius: 5px;
}
.cae-stat-gradient-1 { background: linear-gradient(135deg, #1e3a5f 0%, #2d6a4f 100%); }
.cae-stat-gradient-2 { background: linear-gradient(135deg, #2d3561 0%, #5c2d91 100%); }
.cae-stat-gradient-3 { background: linear-gradient(135deg, #7b4f12 0%, #c77c22 100%); }
.stat-value-sm { font-size: 1.1rem; }
.stat-value-xs { font-size: 1rem; }