:root {
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --code-bg: #000000;
    --card-bg: #1e293b;
    --card-hover: #243248;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
    -webkit-font-smoothing: antialiased;
}

.app-container { display: flex; width: 100%; height: 100%; }

/* Mobile Topbar (Hidden on desktop) */
.mobile-topbar {
    display: none;
    background-color: var(--sidebar-bg);
    padding: 0.75rem 1.25rem;
    border-bottom: 2px solid var(--accent);
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 99;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mobile-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    background: #fff;
    padding: 2px;
    border-radius: 6px;
}
.mobile-titles {
    display: flex;
    flex-direction: column;
}
.mobile-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--accent);
}
.mobile-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.menu-toggle-btn {
    background: #334155;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.menu-toggle-btn:hover {
    background: var(--accent);
}

.sidebar-overlay {
    display: none;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.4rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0.3rem;
}

/* Sidebar */
.sidebar { 
    width: 320px; 
    min-width: 320px;
    background-color: var(--sidebar-bg); 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid #334155; 
    overflow-y: auto;
}

.school-header {
    padding: 1.25rem 1.5rem;
    background-color: #ffffff; 
    border-bottom: 3px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 15px;
}
.school-logo { width: 55px; height: auto; object-fit: contain; }
.school-info { color: #1e293b; font-size: 0.82rem; line-height: 1.35; display: flex; flex-direction: column; }
.school-info strong { font-size: 0.92rem; color: #0f172a; margin-bottom: 2px; }

.sidebar-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #334155; }
.sidebar-header h2 { color: var(--accent); font-size: 1.3rem; margin-bottom: 0.3rem; }
.sidebar-header p { color: var(--text-muted); font-size: 0.85rem; }

.nav-section { padding: 1.2rem 0 0.5rem 0; }
.section-label { 
    font-size: 0.72rem; 
    text-transform: uppercase; 
    letter-spacing: 1.2px; 
    font-weight: 700; 
    color: #64748b; 
    padding: 0 1.5rem 0.5rem 1.5rem; 
    display: block; 
}

.subnav-section {
    border-top: 1px solid #334155;
    background-color: rgba(15, 23, 42, 0.4);
    padding-top: 1rem;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-nav a { 
    padding: 0.85rem 1.5rem; 
    color: var(--text-muted); 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    gap: 0.85rem; 
    transition: all 0.2s; 
    border-left: 4px solid transparent; 
    font-size: 0.92rem;
}
.sidebar-nav a:hover, .sidebar-nav a.active { 
    color: var(--text-main); 
    background-color: rgba(59, 130, 246, 0.12); 
    border-left-color: var(--accent); 
}

.sub-nav a {
    padding-left: 2rem;
    font-size: 0.88rem;
}
.sub-nav a.active-step {
    color: #60a5fa;
    background-color: rgba(59, 130, 246, 0.15);
    border-left-color: #60a5fa;
    font-weight: 600;
}

.sidebar-footer { 
    margin-top: auto; 
    padding: 1.25rem 1.5rem; 
    border-top: 1px solid #334155; 
    text-align: left; 
    color: var(--text-muted); 
    font-size: 0.82rem; 
    line-height: 1.6; 
    background-color: #172033;
}
.sidebar-footer p strong { color: #cbd5e1; }
.teacher-tag { 
    margin-top: 6px; 
    padding-top: 6px; 
    border-top: 1px dashed #334155; 
    color: #38bdf8 !important; 
    font-weight: 600; 
}

/* Content Area */
.content { 
    flex: 1; 
    padding: 2.5rem 3rem; 
    overflow-y: auto; 
    min-width: 0;
}

.page-header { margin-bottom: 2rem; }
.page-header h1 { 
    font-size: 2.2rem; 
    margin-bottom: 0.5rem; 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    line-height: 1.25;
}
.badge { 
    background-color: rgba(59, 130, 246, 0.2); 
    color: var(--accent); 
    padding: 0.2rem 0.8rem; 
    border-radius: 20px; 
    font-size: 0.85rem; 
    border: 1px solid var(--accent); 
    white-space: nowrap;
}

.banner-container { 
    max-width: 850px; 
    margin: 0 auto 2rem auto; 
    border-radius: 12px; 
    overflow: hidden; 
    border: 1px solid #334155; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); 
}
.banner-image { width: 100%; height: auto; display: block; object-fit: contain; }

/* Portal Info Bar */
.portal-info-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.info-item {
    background-color: var(--card-bg);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.info-item i {
    font-size: 1.6rem;
    color: var(--accent);
    flex-shrink: 0;
}
.info-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.info-value {
    font-size: 0.92rem;
    font-weight: bold;
    color: var(--text-main);
}

.section-title-wrap {
    margin-bottom: 1.5rem;
}
.section-title-wrap h2 {
    font-size: 1.45rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.3rem;
}
.section-title-wrap p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* TP Grid */
.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.tp-card {
    background-color: var(--card-bg);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}
.tp-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.15);
}

.tp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}
.tp-number {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tp-status {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.status-available {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.tp-card-body h3 {
    font-size: 1.25rem;
    margin-bottom: 0.8rem;
    color: var(--text-main);
}
.tp-card-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.tp-tags {
    list-style: none !important;
    margin: 0 0 1.5rem 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.tp-tags li {
    background-color: #0f172a;
    border: 1px solid #334155;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0;
}

.tp-card-footer {
    margin-top: auto;
}
.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Base Cards & Components */
.card { 
    background-color: var(--card-bg); 
    border-radius: 12px; 
    padding: 1.75rem; 
    margin-bottom: 1.75rem; 
    border: 1px solid #334155; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
}
.card h3 { color: var(--accent); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; font-size: 1.2rem; }
.card h4 { color: var(--warning); margin-bottom: 0.8rem; font-size: 1.05rem; margin-top: 1.5rem; border-bottom: 1px solid #334155; padding-bottom: 0.5rem; }

p { line-height: 1.6; margin-bottom: 1rem; color: #cbd5e1; font-size: 0.95rem; }
ul, ol { margin-left: 1.5rem; margin-bottom: 1.5rem; color: #cbd5e1; line-height: 1.6; font-size: 0.95rem; }
li { margin-bottom: 0.5rem; }

pre { 
    background-color: var(--code-bg); 
    padding: 1.25rem; 
    border-radius: 8px; 
    overflow-x: auto; 
    margin-bottom: 1.5rem; 
    border: 1px solid #334155; 
    -webkit-overflow-scrolling: touch;
}
code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; color: #e2e8f0; font-size: 0.9rem; }
.cmd { color: var(--success); }
.context-box { 
    background-color: rgba(59, 130, 246, 0.05); 
    border-left: 4px solid var(--accent); 
    padding: 1.5rem; 
    margin-bottom: 1.75rem; 
    border-radius: 0 8px 8px 0; 
}
.context-box h3 { color: var(--accent); margin-bottom: 0.8rem; font-size: 1.15rem; }

.btn { 
    display: inline-block; 
    background-color: var(--accent); 
    color: white; 
    padding: 0.8rem 1.5rem; 
    border-radius: 8px; 
    text-decoration: none; 
    font-weight: 600; 
    transition: all 0.2s; 
    border: none; 
    cursor: pointer; 
    font-size: 0.95rem;
    text-align: center;
    touch-action: manipulation;
}
.btn:hover { background-color: var(--accent-hover); }
.btn-secondary { background-color: #334155; color: #f8fafc; }
.btn-secondary:hover { background-color: #475569; }
.nav-buttons { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-top: 2.5rem; 
    padding-top: 1.5rem; 
    border-top: 1px solid #334155; 
    gap: 1rem;
}

.btn-disabled { background-color: #334155 !important; color: #94a3b8 !important; cursor: not-allowed !important; pointer-events: none; opacity: 0.7; }

.interactive-terminal { 
    background-color: var(--code-bg); 
    border: 1px solid #334155; 
    border-radius: 8px; 
    padding: 1.25rem; 
    margin-bottom: 1.25rem; 
}
.terminal-prompt { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 10px; 
    flex-wrap: wrap;
}
.terminal-prompt span { color: var(--success); font-family: monospace; font-weight: bold; flex-shrink: 0; }
.terminal-input { 
    flex: 1; 
    min-width: 200px;
    background: transparent; 
    border: 1px solid #334155; 
    border-radius: 4px;
    padding: 6px 10px;
    color: #e2e8f0; 
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; 
    font-size: 0.95rem; 
    outline: none; 
    transition: border-color 0.2s;
}
.terminal-input:focus {
    border-color: var(--accent);
}
.terminal-feedback { 
    margin-top: 10px; 
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; 
    font-size: 0.88rem; 
    display: none; 
    padding: 10px; 
    border-radius: 6px; 
    line-height: 1.4;
}
.feedback-success { color: var(--success); background-color: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); }
.feedback-error { color: var(--error); background-color: rgba(239, 68, 68, 0.1); border: 1px solid var(--error); }
.btn-validate { background-color: #334155; font-size: 0.85rem; padding: 0.6rem 1.2rem; margin-top: 10px; }
.btn-validate:hover { background-color: #475569; }


/* ==========================================================================
   RESPONSIVE DESIGN (Tablettes & Smartphones)
   ========================================================================== */

@media (max-width: 900px) {
    body { 
        height: auto; 
        min-height: 100vh; 
        overflow-y: auto; 
        overflow-x: hidden; 
        display: block;
    }

    .app-container { 
        flex-direction: column; 
        height: auto; 
        min-height: 100vh; 
    }

    .mobile-topbar { 
        display: flex; 
    }

    /* Sidebar transforms into off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 290px;
        min-width: 0;
        max-width: 85vw;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 25px rgba(0,0,0,0.6);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(3px);
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-close-btn {
        display: block;
    }

    .content { 
        padding: 1.25rem 1rem 3rem 1rem; 
        width: 100%;
        overflow-y: visible;
    }

    .page-header h1 {
        font-size: 1.6rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .banner-container {
        margin-bottom: 1.25rem;
    }

    .card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .context-box {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .portal-info-bar {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .info-item {
        padding: 0.75rem 0.9rem;
        gap: 0.75rem;
    }
    .info-item i {
        font-size: 1.3rem;
    }
    .info-value {
        font-size: 0.85rem;
    }

    .interactive-terminal {
        padding: 1rem;
    }
    .terminal-prompt {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .terminal-input {
        width: 100%;
        min-width: 0;
    }
    .btn-validate {
        width: 100%;
    }

    .nav-buttons {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    .nav-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .portal-info-bar {
        grid-template-columns: 1fr;
    }
    .page-header h1 {
        font-size: 1.4rem;
    }
    .card h3 {
        font-size: 1.1rem;
    }
}
