/* ===== БАЗОВЫЕ СБРОСЫ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', 'Comic Neue', 'Nunito', system-ui, sans-serif;
    background: #e8f0f5;
}

/* ===== ОБЩАЯ ОБЁРТКА ===== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ===== ШАПКА ===== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 28px;
    background: #2c5a3b;
    color: white;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon { font-size: 1.8rem; }
.logo-text { font-size: 1.4rem; font-weight: 700; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 0.95rem;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover { background: rgba(255,255,255,0.25); }

.btn-fullscreen {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fullscreen:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

/* ===== MAIN LAYOUT ===== */
.main-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ===== ТОП-НАВИГАЦИЯ ===== */
.top-nav {
    display: flex;
    gap: 8px;
    padding: 12px 28px;
    background: #f8fafc;
    border-bottom: 2px solid #e8edf2;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 30px;
    background: transparent;
    color: #475569;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: #e2e8f0;
}

.nav-btn.active {
    background: #4c9f70;
    color: white;
    box-shadow: 0 4px 12px rgba(76,159,112,0.3);
}

.nav-btn.locked {
    color: #94a3b8;
    cursor: not-allowed;
}

.nav-btn.locked:hover {
    background: transparent;
}

/* ===== CONTENT WRAPPER (боковая панель + IFrame) ===== */
.content-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    background: #f1f5f9;
}

/* ===== БОКОВАЯ ПАНЕЛЬ ===== */
.sidebar {
    width: 300px;
    min-width: 300px;
    background: #ffffff;
    border-right: 1px solid #e8edf2;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    min-width: 48px;
    width: 48px;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .material-item {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e8edf2;
    flex-shrink: 0;
}

.sidebar-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #64748b;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: #e2e8f0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* ===== СПИСОК МАТЕРИАЛОВ ===== */
.material-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    border-bottom: 1px solid #f1f5f9;
}

.material-item:hover {
    background: #f1f5f9;
}

.material-item.active {
    background: #e8f5e9;
    border-left-color: #4c9f70;
}

.material-icon {
    font-size: 1.5rem;
    width: 36px;
    text-align: center;
}

.material-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
}

.material-item.locked .material-name {
    color: #94a3b8;
}

/* ===== КОНТЕНТ (IFRAME) ===== */
.content {
    flex: 1;
    padding: 16px;
    background: #f1f5f9;
    min-width: 0;
}

.game-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
    background: white;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.game-frame:fullscreen {
    border-radius: 0;
}

/* ===== ПОДВАЛ ===== */
.main-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 28px;
    background: #f8fafc;
    border-top: 1px solid #e8edf2;
    font-size: 0.75rem;
    color: #94a3b8;
    flex-shrink: 0;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 220px;
        min-width: 220px;
    }
    .sidebar.collapsed {
        min-width: 40px;
        width: 40px;
    }
    .nav-btn { padding: 8px 14px; font-size: 0.85rem; }
    .content { padding: 10px; }
}

@media (min-width: 1200px) {
    .sidebar { width: 340px; min-width: 340px; }
    .nav-btn { padding: 12px 28px; font-size: 1.1rem; }
}