/* ============================================
   STYLES.CSS — Стилі для курсу Python
   ============================================ */

:root {
    --primary: #2563eb;
    --secondary: #475569;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #ffffff;
    --text: #1e293b;
    --border: #e2e8f0;
    --sidebar-bg: #f8fafc;
    --code-bg: #f1f5f9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--primary);
}

/* Навігаційні блоки */
.nav-block {
    margin-bottom: 10px;
}

.block-toggle {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s ease;
}

.block-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.block-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.block-title {
    font-size: 0.95rem;
}

.block-progress-mini {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Список модулів */
.nav-modules {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    list-style: none;
    padding-left: 0;
}

.nav-modules.active {
    max-height: 500px;
    margin-top: 10px;
}

.nav-modules li {
    margin-bottom: 5px;
}

.nav-modules a {
    display: block;
    padding: 8px 15px;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-modules a:hover {
    background: var(--code-bg);
    color: var(--primary);
}

.nav-modules a[data-completed="true"]::after {
    content: " ✓";
    color: var(--success);
    font-weight: bold;
}

/* ============================================
   МОБІЛЬНА НАВІГАЦІЯ
   ============================================ */

.nav-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 200;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.nav-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

    .content {
        margin-left: 0 !important;
        padding: 80px 20px 40px !important;
    }
}

/* ============================================
   КОНТЕНТ
   ============================================ */

.content {
    margin-left: 280px;
    padding: 40px 60px;
    max-width: 900px;
}

/* Заголовок модуля */
.module-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border);
}

.module-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.module-number {
    color: var(--primary);
    font-weight: 600;
}

.module-category {
    color: var(--secondary);
}

.module-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text);
}

.module-description {
    color: var(--secondary);
    font-size: 1.05rem;
}

/* Секції */
.section {
    margin-bottom: 40px;
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.section h3 {
    font-size: 1.25rem;
    margin: 25px 0 15px;
    color: var(--text);
}

.section p {
    margin-bottom: 15px;
    line-height: 1.7;
}

.section ul, .section ol {
    margin: 15px 0 15px 25px;
}

.section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Блоки коду */
.code-block {
    position: relative;
    margin: 20px 0;
    background: var(--code-bg);
    border-radius: 8px;
    overflow: hidden;
}

.code-block pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}

.btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: #1d4ed8;
}

.btn-copy.copied {
    background: var(--success);
}

/* ============================================
   РЕФЛЕКСІЯ
   ============================================ */

.reflection {
    margin: 50px 0;
    padding: 30px;
    background: var(--sidebar-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.reflection h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--primary);
}

.progress-indicator {
    margin-bottom: 25px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--secondary);
}

.progress-value {
    font-weight: 600;
    color: var(--primary);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0;
}

/* Чекліст */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.checklist-item:hover {
    background: var(--code-bg);
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checklist-item label {
    flex: 1;
    cursor: pointer;
    line-height: 1.5;
}

.checklist-item input[type="checkbox"]:checked + label {
    text-decoration: line-through;
    opacity: 0.6;
}

/* ============================================
   НАВІГАЦІЯ МІЖ МОДУЛЯМИ
   ============================================ */

.module-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}

.nav-prev, .nav-next {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-prev:hover, .nav-next:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

/* ============================================
   ГОЛОВНА СТОРІНКА (INDEX)
   ============================================ */

.hero {
    text-align: center;
    padding: 60px 0;
    margin-bottom: 50px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.hero p {
    font-size: 1.2rem;
    color: var(--secondary);
}

.overall-progress {
    margin-bottom: 50px;
    padding: 30px;
    background: var(--sidebar-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.overall-progress h2 {
    margin-bottom: 20px;
    color: var(--primary);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.block-card {
    padding: 25px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.block-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.block-card h3 {
    margin-bottom: 15px;
    color: var(--primary);
}

.block-card .block-progress {
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--secondary);
}

.modules-list {
    list-style: none;
}

.modules-list li {
    margin-bottom: 8px;
}

.module-card {
    display: block;
    padding: 12px 15px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
}

.module-card:hover {
    background: var(--code-bg);
    border-color: var(--primary);
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    margin-left: 8px;
}

.status-badge.not-started {
    background: var(--border);
    color: var(--secondary);
}

.status-badge.in-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================
   ДРУК
   ============================================ */

@media print {
    .sidebar,
    .nav-toggle,
    .module-navigation,
    .btn-copy {
        display: none !important;
    }

    .content {
        margin-left: 0;
        padding: 0;
        max-width: 100%;
    }

    .code-block {
        page-break-inside: avoid;
    }
}
