/* ===================== */
/* БАЗА */
/* ===================== */
body { 
    margin: 0; 
    font-family: 'Segoe UI', sans-serif; 
    background: #eef2f7; 
    color: #333; 
    display: flex;
}

/* ===================== */
/* HEADER */
/* ===================== */
header { 
    background: linear-gradient(135deg, #4facfe, #00f2fe); 
    color: white; 
    padding: 30px; 
    text-align: center; 
    width: 100%;
}

/* ===================== */
/* SIDEBAR */
/* ===================== */
.sidebar {
    width: 240px;
    background: #1e2a38;
    color: white;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 20px;
    overflow-y: auto;
}

.sidebar h3 {
    margin-top: 0;
}

.lesson-link {
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: 0.2s;
    font-size: 14px;
}

.lesson-link:hover {
    background: rgba(255,255,255,0.1);
}

.lesson-link.active {
    background: #4facfe;
    color: white;
    font-weight: bold;
}

/* ===================== */
/* MAIN CONTENT */
/* ===================== */
.main {
    flex: 1;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* ===================== */
/* БЛОКИ */
/* ===================== */
.block { 
    background: #f9fafb; 
    border-left: 5px solid #4facfe; 
    padding: 15px; 
    margin: 15px 0; 
    border-radius: 8px; 
    transition: 0.2s;
}

.block:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.task { 
    background: #fff7e6; 
    border-left: 5px solid #ffa502; 
    padding: 12px; 
    margin: 10px 0; 
    border-radius: 8px; 
}

.theory { 
    background: #eef6ff; 
    border-left: 5px solid #2f80ed; 
    padding: 12px; 
    margin: 10px 0; 
    border-radius: 8px; 
}

/* ===================== */
/* КНОПКИ */
/* ===================== */
button { 
    background: #4facfe; 
    color: white; 
    border: none; 
    padding: 10px 15px; 
    border-radius: 8px; 
    cursor: pointer; 
    margin-top: 10px; 
    transition: all 0.2s ease;
}

button:hover { 
    background: #3a8ee6; 
}

button:active {
    transform: scale(0.96);
}

/* ===================== */
/* КОД */
/* ===================== */
.code-wrapper {
    position: relative;
    margin: 10px 0;
}

.copy-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    background: #4facfe;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

pre {
    overflow-x: auto;
    max-width: 100%;
    padding-top: 35px; /* важно для кнопки */
}

pre code {
    white-space: pre;
}

/* ===================== */
/* ПОДСКАЗКИ */
/* ===================== */
.hint {
    background: #e8f4f8;
    border-left: 3px solid #4facfe;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
}

.warning {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
}

/* inline подсказки */
.inline-hint {
    position: relative;
    color: #4facfe;
    cursor: pointer;
}

.hint-box {
    display: none;
    position: absolute;
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    top: 20px;
    left: 0;
    white-space: nowrap;
}

.inline-hint:hover .hint-box {
    display: block;
}

/* ===================== */
/* ЗАГРУЗКА */
/* ===================== */
.loading {
    text-align: center;
    font-size: 20px;
    padding: 50px;
}

/* ===================== */
/* МОБИЛКА */
/* ===================== */
@media (max-width: 800px) {

    body {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main {
        padding: 10px;
    }

    header {
        padding: 20px 10px;
    }

    h1 { font-size: 22px; }
    h3 { font-size: 18px; }

    .container {
        padding: 10px;
    }

    .block {
        margin: 10px 0;
        padding: 12px;
    }

    .theory, .task {
        padding: 10px;
    }

    pre {
        font-size: 13px;
    }

    button {
        width: 100%;
        font-size: 14px;
        padding: 12px;
    }
}
/* ===== FIX COPY BUTTON ===== */

.code-wrapper {
    position: relative;
    margin: 12px 0;
}

.code-wrapper pre {
    margin: 0;
    padding-top: 40px;
    border-radius: 8px;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;

    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);

    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;

    font-size: 12px;
    cursor: pointer;

    z-index: 2;
    transition: 0.2s;
}

.copy-btn:hover {
    background: rgba(0,0,0,0.8);
}

/* 📱 мобилка */
@media (max-width: 600px) {
    .copy-btn {
        top: 6px;
        right: 6px;
        font-size: 11px;
        padding: 5px 8px;
    }

    .code-wrapper pre {
        padding-top: 38px;
    }
}
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;

    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);

    color: #fff;
    border: none;
    border-radius: 8px;

    cursor: pointer;
    z-index: 2;

    transition: 0.2s;
}

.copy-btn:hover {
    background: rgba(0,0,0,0.85);
}

.copy-btn svg {
    width: 18px;
    height: 18px;
}

/* Скрытие ответов */
.hidden {
    display: none;
}

.hidden {
    display: none;
}

pre {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}