:root {
    --primary-color: #faa61f;
    --primary-dark: #e8951c;
    --primary-light: #fbb44a;
    --success-color: #00d4aa;
    --danger-color: #ff6b6b;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --text-muted: #6c757d;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.1);
    --shadow-xl: 0 10px 30px rgba(0,0,0,0.12);
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --transition: all 0.25s ease;
}

* { box-sizing: border-box; }

@font-face { font-family: 'Abel'; src: url('../font/Abel.ttf'); }
@font-face { font-family: 'Cairo'; src: url('../font/Cairo.ttf'); }

body {
     background: 
            radial-gradient(circle at 20% 50%, rgba(250, 166, 31, 0.3) 0%, transparent 50%),
            radial-gradient(circle at 80% 20%, rgba(251, 180, 74, 0.3) 0%, transparent 50%),
            radial-gradient(circle at 40% 80%, rgba(250, 166, 31, 0.2) 0%, transparent 50%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
    font-family: 'Abel', 'Cairo', sans-serif;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
}

/* ===== CONTAINER ===== */
.container-fluid { padding: 16px; }

.form-container {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin: 0 auto;
    /*max-width: 90%;*/
    border-top: 3px solid var(--primary-color);
}

/* ===== HEADER ===== */
.form-header {
    background: url('../img/inscription.jpg') center/cover;
    color: var(--text-light);
    padding: 40px;
    text-align: center;
    position: relative;
    min-height: 150px;
}

.form-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #294f8ddb;
}

.form-header h2 {
    margin: 0;
    font-weight: 700;
    font-size: 1.6rem;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.form-header h2 i { font-size: 1.8rem; }

.form-header p {
    margin: 10px 0 0;
    font-size: 1rem;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ===== PROGRESS / STEPS ===== */
.progress-container {
    background: var(--bg-white);
    padding: 20px 30px 16px;
    border-bottom: 1px solid #eee;
}

.steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0 20px;
}

.steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 40px);
    height: 3px;
    background: #e9ecef;
    border-radius: 2px;
    z-index: 1;
    transition: var(--transition);
}

.steps.step-1-complete::before {
    background: linear-gradient(90deg, var(--primary-color) 50%, #e9ecef 50%);
}

.steps.step-2-complete::before {
    background: var(--primary-color);
}

.circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e9ecef;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    position: relative;
    z-index: 2;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.circle.active {
    background: var(--primary-color);
    color: var(--text-light);
    transform: scale(1.08);
    box-shadow: 0 0 14px rgba(250, 166, 31, 0.4);
}

.circle.completed {
    background: var(--success-color);
    color: transparent;
    box-shadow: 0 0 12px rgba(0, 212, 170, 0.3);
}

.circle.completed::after {
    content: '\2713';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-light);
    font-size: 18px;
    font-weight: 900;
}

.step-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0 20px;
}

.step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    transition: var(--transition);
}

.step-label.active { color: var(--primary-color); }
.step-label.completed { color: var(--success-color); }

/* ===== FORM CONTENT ===== */
.form-content {
    padding: 32px 40px;
    background: var(--bg-white);
}

.step { display: none; }

.step.active {
    display: block;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.step-title {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    position: relative;
}

.step-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

.subtitle-fr {
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== INPUTS ===== */
.form-group { margin-bottom: 20px; }

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    font-size: 14px;
    display: block;
}

.form-control, .form-select {
    border: 1.5px solid #d1d5db;
    border-radius: var(--border-radius);
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 400;
    background: var(--bg-white);
    width: 100%;
    transition: border-color 0.2s ease;
    box-shadow: none;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(250, 166, 31, 0.12);
}

.form-control.is-valid, .form-select.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--danger-color);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.form-floating { position: relative; margin-bottom: 20px; }

/* ===== FILE UPLOAD ===== */
.file-upload-container { margin-bottom: 20px; }
.file-upload-input { position: absolute; opacity: 0; width: 0; height: 0; }

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    padding: 24px;
    border: 1.5px dashed #d1d5db;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    background: var(--bg-light);
    transition: border-color 0.2s ease;
}

.file-upload-label:hover { border-color: var(--primary-color); }
.file-upload-label.dragover { border-color: var(--primary-color); background: rgba(250, 166, 31, 0.04); }

.file-upload-icon {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.file-upload-text { font-size: 15px; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; }
.file-upload-subtext { font-size: 12px; color: var(--text-muted); }

.file-upload-info {
    margin-top: 14px;
    padding: 14px;
    background: rgba(250, 166, 31, 0.05);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.file-preview {
    margin-top: 14px;
    padding: 14px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    display: none;
}

.file-preview.show { display: block; animation: slideIn 0.3s ease; }

.file-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-preview-name { font-weight: 600; color: var(--text-dark); word-break: break-all; max-width: 75%; font-size: 14px; }
.file-preview-size { font-size: 11px; color: var(--text-muted); }

.file-preview-view {
    background: #4facfe;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    margin-right: 6px;
    transition: var(--transition);
}

.file-preview-remove {
    background: var(--danger-color);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    transition: var(--transition);
}

.file-upload-container.valid .file-upload-label { border-color: var(--success-color); }
.file-upload-container.valid .file-upload-icon { color: var(--success-color); }

/* ===== NAVIGATION / BUTTONS ===== */
.form-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    gap: 10px;
    flex-wrap: wrap;
}

.form-navigation > div { text-align: center; }

.nextprev {
    background: var(--primary-color);
    border: none;
    border-radius: 30px;
    padding: 12px 28px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-light);
    transition: var(--transition);
    cursor: pointer;
    margin: 0 4px;
    min-width: 120px;
}

.nextprev:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(250, 166, 31, 0.35);
}

.nextprev:active { transform: translateY(0); }

.nextprev:disabled {
    background: #b0b8c5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== ALERTS ===== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    border-left: 3px solid;
    padding: 12px 16px;
    font-size: 14px;
}

.alert-info {
    background: rgba(250, 166, 31, 0.08);
    color: var(--text-dark);
    border-color: var(--primary-color);
}

.alert-danger {
    background: rgba(255, 107, 107, 0.08);
    color: var(--text-dark);
    border-color: var(--danger-color);
}

/* ===== SUCCESS ===== */
.success-message {
    text-align: center;
    padding: 50px 24px;
    background: rgba(0, 212, 170, 0.05);
    border-radius: var(--border-radius);
    margin: 16px 0;
}

.success-message i {
    font-size: 64px;
    color: var(--success-color);
    margin-bottom: 20px;
    display: block;
}

/* ===== MODAL ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 18px 24px;
}

.modal-title { font-weight: 700; font-size: 16px; }

/* ===== CUSTOM ALERT OVERLAY ===== */
.custom-alert-overlay,
.loading-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.custom-alert-overlay.show,
.loading-alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-alert {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 440px;
    width: 90%;
    overflow: hidden;
    transform: scale(0.85);
    transition: transform 0.25s ease;
}

.custom-alert-overlay.show .custom-alert { transform: scale(1); }

.custom-alert-header {
    background: #faa61f;
    color: white;
    padding: 18px;
    text-align: center;
}

.custom-alert-header i { font-size: 2.4rem; margin-bottom: 8px; display: block; }
.custom-alert-header h4 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.custom-alert-body { padding: 20px; text-align: center; }
.custom-alert-body p { margin: 8px 0; font-size: 1rem; color: #333; }

.custom-alert-footer {
    padding: 16px;
    display: flex;
    gap: 8px;
    justify-content: center;
    background: #f8f9fa;
}

.custom-alert-footer .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.custom-alert-footer .btn-success { background: var(--success-color); color: white; }
.custom-alert-footer .btn-secondary { background: #6c757d; color: white; }

.loading-alert {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 32px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    transform: scale(0.85);
    transition: transform 0.25s ease;
}

.loading-alert-overlay.show .loading-alert { transform: scale(1); }
.loading-alert h5 { margin: 0 0 8px; color: #333; font-size: 1.1rem; }
.loading-alert p { margin: 0; color: #666; font-size: 0.9rem; }

/* ===== UTILITIES ===== */
.hide { display: none !important; }
.required { color: var(--danger-color); font-weight: 700; }

.form-check-label { font-weight: 500; color: var(--text-dark); cursor: pointer; font-size: 14px; }

.loading {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/*::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 3px; }
*/
/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-content { padding: 24px 16px; }
    .form-header { padding: 30px 16px; min-height: 130px; }
    .form-header h2 { font-size: 1.3rem; flex-direction: column; gap: 6px; }
    .circle { width: 36px; height: 36px; font-size: 13px; }
    .progress-container { padding: 16px 20px 12px; }
    .nextprev { width: 100%; max-width: 260px; }
    .form-navigation { flex-direction: column; }
    .custom-alert-footer { flex-direction: column; }
    .custom-alert-footer .btn { width: 100%; justify-content: center; }
}

@media (max-width: 576px) {
    .form-header h2 { font-size: 1.15rem; }
    .form-content { padding: 18px 12px; }
    .steps { padding: 0 10px; }
    .step-labels { padding: 0 10px; font-size: 11px; }
    .circle { width: 32px; height: 32px; font-size: 12px; }
    .file-upload-label { min-height: 100px; padding: 18px; }
    .file-upload-icon { font-size: 28px; }
    .nextprev { max-width: 100%; border-radius: 10px; }
    .step-title { font-size: 15px; }
}
/* Carte formation fermée */
.filiere-card.fermee {
    position: relative;
    opacity: 0.6;
    filter: grayscale(60%);
    pointer-events: none;
    cursor: not-allowed;
}

.filiere-card.fermee::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.45);
    border-radius: inherit;
    z-index: 1;
}

.filiere-card.fermee .badge-ferme {
    display: flex !important;
}

.badge-ferme {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 10px;
    border-radius: 20px;
    z-index: 2;
    gap: 5px;
    align-items: center;
}
.badge-ouvert {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #54b4d3;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
        z-index: 2;
    gap: 5px;
}

/* Animation clignotement du badge Prolongation */
@keyframes clignote {
    0%   { opacity: 1; }
    50%  { opacity: 0.3; }
    100% { opacity: 1; }
}

.badge-prolongation {
    animation: clignote 1.2s ease-in-out infinite;
}

/* Espacement badge fermé / ouvert / icône sur mobile */
@media (max-width: 576px) {
    .filiere-card.fermee {
        padding-top: 48px; /* pousse le contenu sous le badge */
    }
    .filiere-card:not(.fermee) {
        padding-top: 48px; /* pousse le contenu sous le badge ouvert */
    }
    .badge-ferme.badge-ferme {
        white-space: normal;   /* autorise le retour à la ligne */
        line-height: 1.3;
        text-align: center;
    }
    .badge-ouvert.badge-ouvert {
        white-space: normal;   /* autorise le retour à la ligne */
        line-height: 1.3;
        text-align: center;
    }
}
.tooltip .tooltip-inner {
  font-family: 'Cairo', sans-serif;
  font-size: 10.5px;
  background-color: #1a1a1a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.tooltip .tooltip-arrow::before {
  border-top-color: #1a1a1a;
  border-bottom-color: #1a1a1a;
  border-left-color: #1a1a1a;
  border-right-color: #1a1a1a;
}

.file-preview-box {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 8px;
}

.file-preview-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.file-preview-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.file-preview-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid #dee2e6;
}

.file-preview-name {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-remove {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.file-preview-remove:hover {
    background-color: #f8d7da;
}