/**
 * Espace Pro — Styles dédiés (BEM strict)
 * Extraits de page-espace-pro.php et refactorisés.
 * Dépend de : tokens.css, style.css
 */

/* ==========================================================================
   LAYOUT GRILLES UTILITAIRES (locales à cette page)
   ========================================================================== */
.ep-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
.ep-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.ep-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }

@media (max-width: 1024px) {
    .ep-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .ep-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .ep-grid-2 { grid-template-columns: 1fr; }
    .ep-grid-3 { grid-template-columns: 1fr; }
    .ep-grid-4 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   BLOC : ESPACE PRO (page racine)
   ========================================================================== */
.espace-pro {
    background-color: #f8fafc;
    overflow: hidden;
}

/* ==========================================================================
   ÉLÉMENT : HERO
   ========================================================================== */
.espace-pro__hero {
    position: relative;
    background: linear-gradient(135deg, var(--primary-green) 0%, #0a4d47 100%);
    padding: 100px 0 140px;
    color: #fff;
    text-align: center;
}

.espace-pro__hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.espace-pro__badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.espace-pro__hero h1 {
    color: #fff !important;
    font-size: clamp(32px, 5vw, 52px);
    margin-bottom: 20px;
}

.espace-pro__hero p,
.espace-pro__hero p * {
    color: #fff !important;
    font-size: 19px;
    opacity: 0.92;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.espace-pro__hero-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    line-height: 0;
    z-index: 1;
}

.espace-pro__hero-wave svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 80px;
}

.espace-pro__hero-wave .shape-fill {
    fill: #f8fafc;
}

/* ==========================================================================
   ÉLÉMENT : SECTION DASHBOARD (décalage négatif pour couvrir la vague)
   ========================================================================== */
.espace-pro__dashboard-section {
    padding-top: 0 !important;
    margin-top: -80px;
    position: relative;
    z-index: 5;
    padding-bottom: 100px;
}

/* ==========================================================================
   ÉLÉMENT : ÉCRAN DE CONNEXION (CHOIX PROFIL)
   ========================================================================== */
.espace-pro__login-wrapper {
    min-height: 60vh;
    background: #f8fafc;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
}

.espace-pro__login-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    padding: 60px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    text-align: center;
    width: 90%;
    max-width: 800px;
    animation: ep-fadeInScale 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.espace-pro__logo-wrapper {
    background: #f8fafc;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.espace-pro__logo-wrapper img {
    max-width: 65px;
    height: auto;
}

.espace-pro__login-card h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.espace-pro__login-card p {
    color: #64748b;
    margin-bottom: 0;
}

/* CHOIX : Grille des profils (Apprenant / Enseignant) */
.espace-pro__choices {
    display: flex;
    gap: 30px;
    margin-top: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.espace-pro__choice-box {
    flex: 1;
    min-width: 280px;
    padding: 30px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    background: #fff;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.espace-pro__choice-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-green);
}

.espace-pro__choice-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.espace-pro__choice-box h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.espace-pro__choice-box p {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 25px;
    line-height: 1.5;
}

.espace-pro__login-hint {
    margin-top: 30px;
    font-size: 13px;
    opacity: 0.6;
}

.espace-pro__error-msg {
    display: none;
    color: #ef4444;
    margin-top: 30px;
    font-weight: 600;
}

/* ==========================================================================
   ÉLÉMENT : BOUTONS MICROSOFT (Connexion)
   ========================================================================== */
.espace-pro__btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff !important;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.espace-pro__btn-microsoft:hover {
    background: #222;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.espace-pro__btn-microsoft img {
    height: 22px;
    margin-right: 12px;
}

/* ==========================================================================
   ÉLÉMENT : DASHBOARD HEADER (Bienvenue utilisateur)
   ========================================================================== */
.espace-pro__dashboard-header {
    display: none;
    margin-bottom: 40px;
    background: #fff;
    padding: 25px 35px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary-green);
}

.espace-pro__dashboard-header h2 {
    margin: 0;
    font-size: 28px;
    color: var(--text-black);
}

.espace-pro__mode-label {
    font-weight: 700 !important;
    color: var(--primary-green);
    margin-right: 12px;
    background: rgba(15, 107, 99, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.espace-pro__user-email {
    opacity: 0.7;
}

.espace-pro__btn-logout {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.espace-pro__btn-logout:hover {
    background: #fca5a5;
    color: #fff;
    border-color: #fca5a5;
}

/* ==========================================================================
   ÉLÉMENT : ÉCRAN DE CHARGEMENT
   ========================================================================== */
.espace-pro__loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
}

.espace-pro__spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border-left-color: var(--primary-green);
    animation: ep-spin 1s linear infinite;
}

.espace-pro__loading-msg {
    margin-top: 25px;
    font-size: 18px;
    color: #475569;
}

/* ==========================================================================
   BLOC : CARTE (card-glass partagée)
   ========================================================================== */
.ep-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.ep-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
    border-color: rgba(15, 107, 99, 0.2);
}

.ep-card__inner {
    padding: 35px 30px;
    width: 100%;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ep-card__header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.ep-card__header--spaced {
    justify-content: space-between;
}

.ep-card__icon {
    background: #f0f7f5;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    font-size: 26px;
}

.ep-card:hover .ep-card__icon {
    background: var(--primary-green);
    color: #fff;
    transform: rotate(5deg) scale(1.05);
}

.ep-card h3 {
    color: var(--text-black);
    font-size: 20px;
    margin: 0;
}

.ep-card__footer {
    margin-top: auto;
    padding-top: 20px;
}

/* ==========================================================================
   ÉLÉMENT : BOUTON CTA CARTE
   ========================================================================== */
.ep-card__btn {
    display: inline-block;
    width: 100%;
    background: #f8fafc;
    color: var(--text-black) !important;
    border: 1px solid #e2e8f0;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
}

.ep-card__btn-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-left: 5px;
}

.ep-card:hover .ep-card__btn {
    background: var(--primary-green);
    color: #fff !important;
    border-color: var(--primary-green);
}

.ep-card:hover .ep-card__btn-arrow {
    transform: translateX(5px);
}

.ep-card__btn--small {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
}

/* ==========================================================================
   BLOC : CENTRE DE CONTRÔLE ENSEIGNANT
   ========================================================================== */
.ep-control-center {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

.ep-control-center__main {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.ep-control-center__sidebar {
    position: relative;
}

.ep-control-center__sidebar-sticky {
    position: sticky;
    top: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

@media (max-width: 991px) {
    .ep-control-center {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   BLOC : LIENS OUTILS RAPIDES (sidebar enseignant)
   ========================================================================== */
.ep-tools__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ep-tools__link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}

.ep-tools__link:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.ep-tools__icon {
    width: 40px;
    height: 40px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.ep-tools__label strong {
    display: block;
    font-size: 14px;
    color: #1e293b;
}

.ep-tools__label span {
    font-size: 11px;
    color: #64748b;
}

/* Support card */
.ep-support-card__inner {
    background: linear-gradient(135deg, rgba(15,107,99,0.04) 0%, #ffffff 100%);
}

.ep-support-card h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.ep-support-card p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 15px;
}

.ep-support-card .ep-card__btn {
    text-align: center;
}

/* ==========================================================================
   BLOC : SESSIONS / COURS (listes dynamiques)
   ========================================================================== */
.ep-status {
    font-size: 15px;
    margin-bottom: 20px;
}
.ep-status--found  { color: #475569; }
.ep-status--empty  { color: #94a3b8; font-style: italic; background: rgba(0,0,0,0.02); padding: 15px; border-radius: 8px; }
.ep-status--warn   { color: #b45309; background: #fffbeb; padding: 15px; border-radius: 8px; border: 1px solid #fef3c7; }

/* Liste de sessions */
.ep-session-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.ep-session-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.ep-session-item:last-child {
    border-bottom: none;
}

.ep-session-item__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-green);
    margin-top: 6px;
    margin-right: 12px;
    flex-shrink: 0;
}

.ep-session-item__dot--teacher { background: var(--action-red, #ef4444); }

.ep-session-item strong {
    display: block;
    color: var(--text-black);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 2px;
}

.ep-session-item small {
    display: block;
    color: #64748b;
    font-size: 12px;
}

/* Liste de cours */
.ep-course-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
}

.ep-course-item:last-child { margin-bottom: 0; }

.ep-course-item__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ep-course-item__title {
    font-size: 14px;
    color: var(--text-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.ep-course-item__progress-pct {
    font-size: 13px;
    color: var(--primary-green);
    flex-shrink: 0;
}

.ep-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.ep-progress-bar__fill {
    height: 100%;
    background: var(--primary-green);
    border-radius: 10px;
}

/* Grille de cours (vue enseignant) */
.ep-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.ep-course-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ep-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ep-course-card__info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ep-course-card__title {
    font-size: 14px;
    color: #1e293b;
    line-height: 1.4;
    max-width: 70%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Actions d'un cours */
.ep-course-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.ep-course-actions__btn {
    flex: 1;
    text-align: center;
    font-size: 11px;
    padding: 6px;
    border-radius: 6px;
    text-decoration: none !important;
    text-transform: uppercase;
    transition: filter 0.2s;
}

.ep-course-actions__btn--open    { background: #f1f5f9; color: #475569; }
.ep-course-actions__btn--manage  { background: var(--primary-green); color: #fff; }
.ep-course-actions__btn:hover    { filter: brightness(0.92); }

/* Badges de rôle */
.ep-badge-admin    { background: #ede9fe; color: #7c3aed; border-radius: 4px; padding: 2px 6px; font-size: 11px; }
.ep-badge-teacher  { background: #fee2e2; color: #ef4444; border-radius: 4px; padding: 2px 6px; font-size: 11px; }
.ep-badge-observer { background: #fef3c7; color: #f59e0b; border-radius: 4px; padding: 2px 6px; font-size: 11px; }
.ep-badge-other    { background: #f1f5f9; color: #64748b; border-radius: 4px; padding: 2px 6px; font-size: 11px; }

/* Bordure unifiée côté gauche */
.ep-course-card--unified { border-left: 3px solid #cbd5e1; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes ep-spin {
    100% { transform: rotate(360deg); }
}

@keyframes ep-fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   RESPONSIVE HERO et DASHBOARD HEADER
   ========================================================================== */
@media (max-width: 768px) {
    .espace-pro__choices { flex-direction: column; align-items: center; }
    .espace-pro__hero h1 { font-size: 36px; }
    .espace-pro__dashboard-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .espace-pro__login-card { padding: 30px 20px; }
}
