/* ============================================================
   ISERP — Formation Drawer (aperçu flottant des formations)
   v8.30
   ============================================================ */

/* ── OVERLAY & MODAL (grande boîte centrée, fermable) ──
   Note : #fdr-overlay et #fdr-panel sont ajoutés comme FRÈRES dans le DOM
   (formation-drawer.js les appendChild séparément à <body>), pas parent/enfant.
   Le centrage ne peut donc pas passer par le flex de l'overlay : #fdr-panel
   se centre lui-même en position fixed. */
#fdr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    transition: opacity 0.25s ease;
    opacity: 0;
}
#fdr-overlay.open { display: block; opacity: 1; }

#fdr-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 980px;
    max-width: calc(100% - 4rem);
    max-height: 92vh;
    background: #ffffff;
    z-index: 901;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%) scale(.95);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.25s;
    overflow: hidden;
}
#fdr-panel.open { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; }

/* ── HEADER ── */
.fdr-header {
    padding: 0;
    flex-shrink: 0;
    position: relative;
}
.fdr-banner {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    background-size: cover;
    background-position: center;
}
.fdr-banner-overlay {
    position: absolute;
    inset: 0;
    height: 160px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
}
.fdr-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.fdr-close:hover { background: rgba(255,255,255,0.3); }

.fdr-header-meta {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 8px;
}
.fdr-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
}
.fdr-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: white;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.fdr-subtitle {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
    margin-top: 4px;
}

/* ── BODY ── */
.fdr-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── SECTION CARD ── */
.fdr-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.1rem;
}
.fdr-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.fdr-section-body {
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.6;
}

/* ── INFO GRID ── */
.fdr-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.fdr-info-cell {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
}
.fdr-info-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 3px;
}
.fdr-info-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

/* ── COURS LIST ── */
.fdr-cours-group {
    margin-bottom: 0.75rem;
}
.fdr-ue-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 6px;
}
.fdr-cours-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    transition: background 0.15s;
    cursor: default;
}
.fdr-cours-item:hover { background: #f1f5f9; }
.fdr-cours-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--cycle-color, #3b82f6);
    flex-shrink: 0;
}
.fdr-cours-name {
    font-size: 0.83rem;
    color: #334155;
    font-weight: 500;
    flex: 1;
}
.fdr-cours-stars {
    font-size: 0.7rem;
    color: #f59e0b;
}

/* ── FOOTER ── */
.fdr-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}
.fdr-price {
    flex: 1;
}
.fdr-price-label {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fdr-price-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--cycle-color, #3b82f6);
    line-height: 1.2;
}
.fdr-btn-inscrit {
    padding: 12px 28px;
    background: var(--cycle-color, #3b82f6);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: filter 0.2s, transform 0.15s;
    white-space: nowrap;
}
.fdr-btn-inscrit:hover { filter: brightness(1.1); transform: scale(1.02); }

/* ── LOADING ── */
.fdr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 12px;
    color: #94a3b8;
    font-size: 0.875rem;
}
.fdr-spinner {
    width: 32px; height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--cycle-color, #3b82f6);
    border-radius: 50%;
    animation: fdr-spin 0.7s linear infinite;
}
@keyframes fdr-spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
    #fdr-panel {
        top: auto; bottom: 0; left: 0;
        width: 100%; max-width: 100%; max-height: 92vh;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
    }
    #fdr-panel.open { transform: translateY(0); }
    .fdr-info-grid { grid-template-columns: 1fr; }
}
