/* ═══════════════════════════════════════════════════════════
   sim-nav.css — Navbar + Gate Modal partagés
   Chargé via <link rel="stylesheet" href="shared/sim-nav.css">
   ═══════════════════════════════════════════════════════════ */

/* ── Typographie ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables thème Edunia ──────────────────────────────── */
:root {
    --bg: #0b0f1a;
    --surface: #131928;
    --surface-2: #1a2235;
    --border: #1e2a42;
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --accent: #38bdf8;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #78889a;
    --radius: 12px;
}

/* ── Reset + Base ────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}
.header-meta { justify-self: end; }
.logo { text-decoration: none; display: flex; align-items: center; line-height: 0; }
.logo img { height: 26px; }
.header-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.85em;
    color: var(--text-dim);
}
.header-pdf-btn {
    display: none; font-size: 0.82em; font-weight: 600;
    color: var(--accent); text-decoration: none;
    padding: 5px 12px; border-radius: 8px;
    background: var(--accent-alpha, rgba(99,102,241,0.12));
    transition: opacity 0.2s; white-space: nowrap;
}
.header-pdf-btn:hover { opacity: 0.75; }

/* ── Phase Tracker ───────────────────────────────────────── */
.phase-tracker { display: flex; align-items: center; gap: 0; }
.phase-step { display: flex; align-items: center; cursor: pointer; }
.phase-circle {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78em; font-weight: 700;
    border: 2px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    transition: all 0.3s;
    position: relative;
}
.phase-circle.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #1a1a1a;
    animation: pulse-phase 2s infinite;
}
.phase-circle.completed {
    border-color: var(--success);
    background: var(--success);
    color: #1a1a1a;
}
.phase-circle.locked { color: var(--text-muted); }
/* Étape actuellement consultée (même si déjà complétée) — ring sans écart visible */
.phase-circle.completed.current {
    box-shadow: 0 0 0 2px var(--bg, #0b0f1a), 0 0 0 4px var(--primary);
    transition: background 0.3s, border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.phase-line { width: 20px; height: 2px; background: var(--border); transition: background 0.3s; }
.phase-line.done { background: var(--success); }
@keyframes pulse-phase {
    0%, 100% { box-shadow: 0 0 0 0 rgba(129,140,248,0.4); }
    50%       { box-shadow: 0 0 0 6px rgba(129,140,248,0); }
}

/* ── Gate Modal ──────────────────────────────────────────── */
.gate-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: gate-fade-in 0.2s ease;
}
@keyframes gate-fade-in { from { opacity: 0; } to { opacity: 1; } }
.gate-modal {
    background: var(--card-bg, #1a1f36); border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 16px; padding: 32px 28px; max-width: 360px; width: 90%;
    text-align: center; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.gate-modal-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; color: var(--text-muted, #64748b);
    font-size: 22px; cursor: pointer; line-height: 1; padding: 4px;
}
.gate-modal-close:hover { color: #e2e8f0; }
.gate-modal-icon { font-size: 2.2em; margin-bottom: 12px; }
.gate-modal-title { font-weight: 700; font-size: 1.15em; color: #e2e8f0; margin-bottom: 8px; }
.gate-modal-desc { color: #94a3b8; font-size: 0.88em; line-height: 1.5; margin-bottom: 20px; }
.gate-modal-cta {
    display: inline-block; padding: 10px 24px; border-radius: 10px;
    background: #6366f1; color: #fff; font-weight: 600; font-size: 0.9em;
    text-decoration: none; transition: background 0.2s;
}
.gate-modal-cta:hover { background: #4f46e5; }
.gate-modal-secondary {
    display: inline; color: #94a3b8;
    font-size: 0.82em; text-decoration: none; transition: color 0.2s;
}
.gate-modal-secondary:hover { color: #e2e8f0; }

/* ── Signup Banner (non-bloquant, bas de page) ─────────── */
.signup-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    display: flex; align-items: center; justify-content: center; gap: 18px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.97), rgba(49, 46, 129, 0.95));
    border-top: 1px solid rgba(129, 140, 248, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: banner-slide-up 0.4s ease-out;
}
@keyframes banner-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.signup-banner-text {
    color: rgba(255,255,255,0.85); font-size: 0.84em; line-height: 1.45;
}
.signup-banner-cta {
    display: inline-block; white-space: nowrap;
    padding: 10px 22px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: 0.84em; font-weight: 700;
    text-decoration: none; transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}
.signup-banner-cta:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}
.signup-banner-close {
    background: none; border: none; color: rgba(255,255,255,0.35);
    font-size: 1.2em; cursor: pointer; padding: 4px 8px;
    transition: color 0.2s;
}
.signup-banner-close:hover { color: #fff; }

/* ── Gate overlay phases premium (anon / free sur sim premium) ──
 * Centralisé ici pour garantir le même comportement partout.
 * Les sims peuvent appeler window.edunia.applyPhaseGate(maxPhase) pour activer.
 */
.edunia-phase-locked { position: relative !important; overflow: hidden; }
.edunia-phase-locked > *:not(.edunia-phase-teaser) {
    pointer-events: none !important;
    opacity: 0.35 !important;
    filter: blur(2px);
    user-select: none !important;
}
/* Masque les anciens teasers locaux (inline) au profit de notre overlay */
.edunia-phase-locked > .upgrade-teaser { display: none !important; }
.edunia-phase-teaser {
    position: absolute !important; inset: 0 !important; z-index: 100 !important;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 28px 24px;
    background: rgba(11, 15, 26, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: var(--radius, 12px);
    text-align: center; pointer-events: auto;
}
.edunia-phase-teaser .teaser-icon {
    font-size: 2em; line-height: 1;
}
.edunia-phase-teaser .teaser-title {
    font-size: 1.05em; font-weight: 700; color: #e2e8f0;
}
.edunia-phase-teaser .teaser-desc {
    font-size: 0.85em; line-height: 1.5; color: #94a3b8; max-width: 300px;
}
.edunia-phase-teaser .teaser-cta {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: 0.88em; font-weight: 700;
    text-decoration: none; transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
    margin-top: 6px;
}
.edunia-phase-teaser .teaser-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
}
.edunia-phase-teaser .teaser-secondary {
    font-size: 0.78em; color: #94a3b8; text-decoration: none;
    transition: color 0.15s;
}
.edunia-phase-teaser .teaser-secondary:hover { color: #e2e8f0; }

/* Masque phase-circle des phases verrouillées (tracker en haut) */
.phase-circle.edunia-gate-locked {
    opacity: 0.4;
    cursor: pointer;
    position: relative;
}
.phase-circle.edunia-gate-locked::after {
    content: '🔒'; position: absolute; top: -6px; right: -6px;
    font-size: 10px; line-height: 1;
}

/* ── Related simulations footer ─────────────────────────── */
.sim-related-footer {
    max-width: 1400px; margin: 48px auto 32px; padding: 0 24px;
}
.sim-related-footer h3 {
    font-size: 1em; font-weight: 700; color: var(--text);
    margin-bottom: 16px; opacity: 0.8;
}
.sim-related-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.sim-related-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 10px;
    background: var(--surface); border: 1px solid rgba(255,255,255,0.06);
    text-decoration: none; color: var(--text);
    transition: border-color 0.2s, transform 0.2s;
}
.sim-related-card:hover {
    border-color: var(--primary); transform: translateY(-1px);
}
.sim-related-card img {
    width: 64px; height: 40px; object-fit: cover; border-radius: 6px;
    background: rgba(0,0,0,0.3);
}
.sim-related-card span { font-size: 0.8em; font-weight: 500; line-height: 1.3; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .header-content { grid-template-columns: 1fr; justify-items: center; gap: 10px; }
    .header-meta { justify-self: center; }
    .phase-tracker { flex-wrap: wrap; }
    .signup-banner { flex-direction: column; gap: 8px; padding: 10px 16px; text-align: center; }
    .signup-banner-text { font-size: 0.75em; }
    .sim-related-grid { grid-template-columns: 1fr 1fr; }
}

/* ── AI panel disabled (revision/homework mode) ──────── */
body[data-ai-disabled] .ai-panel { display: none !important; }
