:root {
    --bs-primary-rgb: 13, 75, 126;
}

.btn-primary {
    --bs-btn-bg: #0d4b7e;
    --bs-btn-border-color: #0d4b7e;
    --bs-btn-hover-bg: #022a4b;
    --bs-btn-hover-border-color: #022a4b;
}


/* Dossiers - Étapes */

.etape-card-horizontal {
    transition: all 0.3s ease;
}

.etape-card-horizontal:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateX(5px);
}

.avatar-lg {
    width: 4.5rem;
    height: 4.5rem;
}

.progress {
    border-radius: 0.5rem;
}


/* Type Emprunteur Toggle */

.type-emprunteur-toggle {
    display: inline-flex;
    background-color: #f0f0f0;
    border-radius: 50rem;
    padding: 4px;
    gap: 0;
}

.type-emprunteur-toggle .btn {
    border-radius: 50rem;
    padding: 0.65rem 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    background-color: transparent;
    color: #6c757d;
    min-width: 150px;
}

.type-emprunteur-toggle .btn:hover {
    color: #495057;
}

.type-emprunteur-toggle .btn-check:checked+.btn {
    background-color: #0d4b7e;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}


/* DPE Selector */

.dpe-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dpe-selector .btn {
    min-width: 60px;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 12px 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.btn-dpe-a {
    background-color: #319834;
    color: white;
}

.btn-dpe-b {
    background-color: #46b44d;
    color: white;
}

.btn-dpe-c {
    background-color: #cddb2a;
    color: #333;
}

.btn-dpe-d {
    background-color: #f7ec0a;
    color: #333;
}

.btn-dpe-e {
    background-color: #f5a623;
    color: white;
}

.btn-dpe-f {
    background-color: #ed6b23;
    color: white;
}

.btn-dpe-g {
    background-color: #e3261b;
    color: white;
}

.btn-dpe-a:hover,
.btn-dpe-b:hover,
.btn-dpe-c:hover,
.btn-dpe-d:hover,
.btn-dpe-e:hover,
.btn-dpe-f:hover,
.btn-dpe-g:hover {
    opacity: 0.9;
}

.dpe-selector .btn-check:checked+.btn-dpe-a {
    background-color: #319834;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}

.dpe-selector .btn-check:checked+.btn-dpe-b {
    background-color: #46b44d;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}

.dpe-selector .btn-check:checked+.btn-dpe-c {
    background-color: #cddb2a;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}

.dpe-selector .btn-check:checked+.btn-dpe-d {
    background-color: #f7ec0a;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}

.dpe-selector .btn-check:checked+.btn-dpe-e {
    background-color: #f5a623;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}

.dpe-selector .btn-check:checked+.btn-dpe-f {
    background-color: #ed6b23;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}

.dpe-selector .btn-check:checked+.btn-dpe-g {
    background-color: #e3261b;
    border-color: #0d4b7e;
    box-shadow: 0 0 0 4px rgba(13, 75, 126, 0.2);
    transform: scale(1.05);
}


/* Frise chronologique des étapes */

.timeline-progression {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timeline-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0;
    margin: 0;
    list-style: none;
}

.timeline-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 4px;
    background-color: #dee2e6;
    z-index: 1;
}

.timeline-step {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.timeline-step-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timeline-step-link:hover .timeline-step-circle {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(13, 75, 126, 0.3);
}

.timeline-step-link:hover .timeline-step-label {
    transform: translateY(-2px);
}

.timeline-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #dee2e6;
    border: 4px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: #6c757d;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: relative;
}

.timeline-step-label {
    position: absolute;
    top: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: #6c757d;
    max-width: 100px;
    line-height: 1.2;
    transition: all 0.3s ease;
}

.timeline-step.completed .timeline-step-circle {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #fff;
}

.timeline-step.completed .timeline-step-label {
    color: #28a745;
}

.timeline-step.completed .timeline-step-circle::after {
    content: '✓';
    font-size: 1.2rem;
}

.timeline-step.active .timeline-step-circle {
    background: linear-gradient(135deg, #0d4b7e 0%, #1a73e8 100%);
    color: white;
    border-color: #fff;
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 12px rgba(13, 75, 126, 0.4);
    animation: pulse 2s infinite;
}

.timeline-step.active .timeline-step-label {
    color: #0d4b7e;
    font-weight: 700;
    font-size: 0.8rem;
}

.timeline-step.pending .timeline-step-circle {
    background-color: #f8f9fa;
    color: #adb5bd;
    border-color: #dee2e6;
}

.timeline-step.pending .timeline-step-label {
    color: #adb5bd;
}

@keyframes pulse {
    0%,
    100% {
        box-shadow: 0 4px 12px rgba(13, 75, 126, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(13, 75, 126, 0.6);
    }
}

.timeline-progress-bar {
    position: absolute;
    top: 20px;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    z-index: 1;
    transition: width 0.6s ease;
}

.timeline-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3.5rem;
    padding-top: 1rem;
    border-top: 2px solid #dee2e6;
}

.timeline-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-info-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.timeline-info-badge.completed {
    background-color: #d4edda;
    color: #155724;
}

.timeline-info-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

.timeline-info-badge.percentage {
    background: linear-gradient(135deg, #0d4b7e 0%, #1a73e8 100%);
    color: white;
}

@media (max-width: 1200px) {
    .timeline-step-label {
        font-size: 0.7rem;
        max-width: 80px;
    }
}

@media (max-width: 768px) {
    .timeline-progression {
        padding: 1.5rem 1rem;
    }
    .timeline-step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    .timeline-step.active .timeline-step-circle {
        width: 38px;
        height: 38px;
    }
    .timeline-step-label {
        font-size: 0.65rem;
        max-width: 60px;
        top: 42px;
    }
    .timeline-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}


/* Grille des étapes - Étape 0 */

.etapes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.etape-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    position: relative;
    cursor: pointer;
}

.etape-item:hover {
    border-color: #0d4b7e;
    box-shadow: 0 4px 12px rgba(13, 75, 126, 0.15);
    transform: translateY(-2px);
}

.etape-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
}

.etape-item.disabled:hover {
    border-color: #e9ecef;
    box-shadow: none;
    transform: none;
}

.etape-number {
    position: absolute;
    top: 8px;
    left: 10px;
    width: 24px;
    height: 24px;
    background: #0d4b7e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.etape-item.disabled .etape-number {
    background: #adb5bd;
}

.etape-icon {
    font-size: 2rem;
    color: #495057;
    margin-bottom: 0.5rem;
    transition: all 0.25s ease;
}

.etape-item:hover .etape-icon {
    color: #0d4b7e;
    transform: scale(1.1);
}

.etape-item.disabled .etape-icon {
    color: #adb5bd;
}

.etape-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    text-align: center;
    line-height: 1.2;
}

.etape-item:hover .etape-name {
    color: #0d4b7e;
}

.etape-item.disabled .etape-name {
    color: #adb5bd;
}

@media (max-width: 992px) {
    .etapes-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 576px) {
    .etapes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .etape-item {
        padding: 1rem 0.75rem;
    }
    .etape-icon {
        font-size: 1.75rem;
    }
}


/* Table dossiers - Index */

.emprunteurs-cell {
    min-width: 200px;
}

.emprunteur-item {
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.emprunteur-item:last-child {
    border-bottom: none;
}

.emprunteur-item i {
    color: #0d4b7e;
}

.toggle-emprunteurs {
    font-size: 0.85rem;
    color: #0d4b7e;
    text-decoration: none;
    margin-top: 0.25rem;
}

.toggle-emprunteurs:hover {
    text-decoration: underline;
}

.emprunteurs-restants {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 2px solid #e9ecef;
}

.startbar .startbar-menu .navbar-nav .nav-item .nav-link[data-bs-toggle=collapse][aria-expanded=true]::before,
.startbar .startbar-menu .navbar-nav .nav-item .nav-link.active::before,
.startbar .startbar-menu .navbar-nav .nav-item .nav-link:hover::before {
    border-color: #0b3c64 !important;
    background-color: #0b3c64 !important;
}

.startbar .startbar-menu .navbar-nav .nav-item .nav-link[data-bs-toggle=collapse][aria-expanded=true] {
    background-color: rgb(11 60 100 / 7%);
}

.startbar .startbar-menu .navbar-nav .nav-item .nav-link[data-bs-toggle=collapse][aria-expanded=true] i,
.startbar .startbar-menu .navbar-nav .nav-item .nav-link[data-bs-toggle=collapse][aria-expanded=true] span {
    color: #0b3c64;
}

/* Etape 6 - Simulations */
.etape-6-header {
    background-color: rgba(128, 0, 128, 0.1);
}

.simulation-card .card-header {
    background-color: rgba(0, 123, 255, 0.05);
}

.palier-input {
    max-width: 120px;
    margin: 0 auto;
    text-align: center;
}

.btn-warning-pulse {
    animation: pulse-warning 1.5s infinite;
}

@keyframes pulse-warning {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Etape 7 - Présentations - Layout scindé */
.presentation-list-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 6px;
    padding: 12px 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.presentation-list-item:hover {
    border-color: #0d4b7e;
    background-color: rgba(13, 75, 126, 0.04);
}

.presentation-list-item.active {
    border-color: #0d4b7e;
    border-left: 4px solid #0d4b7e;
    background-color: rgba(13, 75, 126, 0.07);
}

.detail-presentation-card {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    min-height: 300px;
}

/* ================================================
   Étape 8 - Documents
   ================================================ */

/* Dropzone drag & drop */
.doc-dropzone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    background-color: #fafbfc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.doc-dropzone:hover,
.doc-dropzone-hover {
    border-color: #0d4b7e;
    background-color: rgba(13, 75, 126, 0.05);
}

.doc-dropzone-hover {
    border-style: solid;
}

/* Document type item (page client) */
.doc-type-item {
    transition: background-color 0.2s ease;
}

.doc-type-item:hover {
    background-color: rgba(13, 75, 126, 0.03);
}

/* Badges statuts documents */
.doc-status-badge {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
}

/* Spin animation pour icônes de chargement */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Select affectation dans le tableau documents */
.select-affecter {
    min-width: 160px;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
}

/* Page publique documents */
.btn-upload-type {
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upload-type:hover {
    transform: translateY(-1px);
}

/* Preview modal */
#modalPreviewBody iframe,
#modalPreviewBody img {
    max-width: 100%;
    border-radius: 6px;
}

/* ================================================
   Finder-style Document Manager (Mandataire)
   ================================================ */

.finder-card {
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.finder-container {
    min-height: 500px;
}

/* Sidebar gauche */
.finder-sidebar {
    border-right: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.finder-sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f1f3f5;
}

.finder-list .finder-item {
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    padding: 10px 16px;
    background-color: transparent;
    color: #333;
    transition: background-color 0.15s ease;
}

.finder-list .finder-item:hover {
    background-color: #e9ecef;
}

.finder-list .finder-item.active {
    background-color: #0d4b7e;
    color: #fff;
    border-color: #0d4b7e;
}

.finder-list .finder-item.active small {
    color: rgba(255, 255, 255, 0.7) !important;
}

.finder-list .finder-item.active .finder-badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}

.finder-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(13, 75, 126, 0.1);
    color: #0d4b7e;
    flex-shrink: 0;
}

.finder-item.active .finder-avatar {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.finder-badge {
    font-size: 0.7rem;
    min-width: 22px;
}

/* Contenu droit */
.finder-content {
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.finder-content-header {
    padding: 12px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #fafbfc;
}

.finder-docs-area {
    flex: 1;
    padding: 0;
    overflow-y: auto;
}

.finder-table tbody tr {
    transition: background-color 0.15s ease;
}

.finder-table tbody tr:hover {
    background-color: rgba(13, 75, 126, 0.03);
}

.finder-row-accepted {
    border-left: 3px solid #198754;
}

.finder-row-rejected {
    border-left: 3px solid #dc3545;
}

/* Modal pièces demandées */
.pieces-item {
    transition: background-color 0.15s ease;
}

.pieces-item:hover {
    background-color: #f8f9fa;
}

.pieces-item .form-check-input:checked {
    background-color: #0d4b7e;
    border-color: #0d4b7e;
}

/* ============================
   Mandat & DocuSign
   ============================ */

.docusign-badge {
    font-size: 0.8rem;
    padding: 0.35em 0.65em;
    letter-spacing: 0.3px;
}

.signataire-row {
    animation: fadeInRow 0.2s ease;
}

@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.signataire-row .badge {
    min-width: 100px;
    text-align: center;
}

#bloc-statut-docusign .table th,
#bloc-statut-docusign .table td {
    font-size: 0.85rem;
    vertical-align: middle;
}

#table-signataires-statut .badge {
    font-size: 0.75rem;
}

/* ============================
   Dashboard - Avatars
   ============================ */

.avatar-md {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

.avatar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}