/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #ffffff;
    --text-muted: #cccccc;
    --border-color: #404040;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition);
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    padding: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    flex: 1;
    text-align: center;
}

header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
    font-weight: 700;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Navigation */
.main-nav {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.nav-menu a.active {
    background: rgba(255,255,255,0.3);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 25px;
    width: 280px;
    font-size: 0.95rem;
    outline: none;
    background: rgba(255,255,255,0.9);
    color: var(--text-color);
    transition: var(--transition);
}

.search-input:focus {
    width: 320px;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

.search-clear:hover {
    background: rgba(0,0,0,0.1);
}

/* Progress bar */
.progress-container {
    height: 3px;
    background: rgba(255,255,255,0.2);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fff, rgba(255,255,255,0.8));
    width: 0%;
    transition: width 0.3s ease;
}

/* Breadcrumbs */
.breadcrumbs {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
}

.breadcrumb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb-home {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.2rem;
    transition: var(--transition);
}

.breadcrumb-home:hover {
    transform: scale(1.1);
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-weight: bold;
}

#breadcrumb-current {
    color: var(--text-color);
    font-weight: 500;
}

/* Main content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 20px;
    display: flex;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    flex: 0 0 320px;
    position: sticky;
    top: 120px;
    height: fit-content;
}

.sidebar-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Quick access */
.quick-access {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition);
    border: 2px solid transparent;
}

.quick-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.quick-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--accent-color);
}

.link-icon {
    font-size: 1.5rem;
}

.link-text {
    flex: 1;
    font-weight: 500;
}

.link-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.2rem;
}

/* Table of contents */
.table-of-contents {
    max-height: 400px;
    overflow-y: auto;
}

.table-of-contents ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.table-of-contents li {
    margin-bottom: 0.25rem;
}

.table-of-contents a {
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.9rem;
    line-height: 1.4;
}

.table-of-contents a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
    padding-left: 1rem;
}

.table-of-contents .active {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
}

/* Home page styles */
.home-main {
    min-height: calc(100vh - 80px);
    padding: 0 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Responsive for home page */
/* MOBILE-FIRST DESIGN - полностью адаптировано под телефоны */

/* Мобильная нижняя панель навигации */
.mobile-nav-bar {
    display: none; /* По умолчанию скрыта, показывается только на мобильных */
}

/* Desktop and large screens - beautiful homepage */
@media (min-width: 1025px) {
    body {
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        min-height: 100vh;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
    }

    /* Beautiful hero section for desktop */
    .hero-section {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 24px;
        padding: 4rem 3rem;
        margin-bottom: 3rem;
        box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
        position: relative;
        overflow: hidden;
        color: white;
    }

    .hero-section::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
        animation: hero-float 8s ease-in-out infinite;
    }

    @keyframes hero-float {
        0%, 100% {
            transform: translate(-50%, -50%) rotate(0deg) scale(1);
        }
        50% {
            transform: translate(-50%, -50%) rotate(180deg) scale(1.1);
        }
    }

    .hero-content {
        position: relative;
        z-index: 2;
        text-align: center;
        max-width: 800px;
        margin: 0 auto;
    }

    .hero-content h2 {
        font-size: 3rem;
        font-weight: 800;
        line-height: 1.2;
        margin-bottom: 1.5rem;
        text-shadow: 0 4px 8px rgba(0,0,0,0.3);
        background: linear-gradient(45deg, #ffffff, #f0f8ff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .hero-content p {
        font-size: 1.3rem;
        margin-bottom: 2.5rem;
        opacity: 0.95;
        font-weight: 300;
    }

    /* Desktop hero actions */
    .hero-actions {
        display: flex !important;
        gap: 2rem;
        justify-content: center;
        margin-top: 2rem;
    }

    .hero-actions .btn-primary {
        flex: none;
        width: 200px;
        padding: 1rem 2rem;
        font-size: 1.1rem;
        font-weight: 600;
        border-radius: 16px;
        background: rgba(255,255,255,0.15);
        backdrop-filter: blur(20px);
        border: 2px solid rgba(255,255,255,0.3);
        color: white;
        text-shadow: 0 2px 4px rgba(0,0,0,0.3);
        box-shadow: 0 8px 32px rgba(0,0,0,0.2);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .hero-actions .btn-primary:hover {
        background: rgba(255,255,255,0.25);
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 16px 48px rgba(0,0,0,0.3);
    }

    .hero-actions .btn-primary br {
        display: none;
    }

    /* Desktop statistics */
    .hero-stats {
        display: flex !important;
        justify-content: center;
        gap: 3rem;
        margin-top: 3rem;
        flex-wrap: wrap;
    }

    .stat-item {
        text-align: center;
        background: rgba(255,255,255,0.1);
        backdrop-filter: blur(20px);
        border-radius: 16px;
        padding: 1.5rem 2rem;
        border: 1px solid rgba(255,255,255,0.2);
        box-shadow: 0 8px 32px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }

    .stat-item:hover {
        transform: translateY(-2px);
        background: rgba(255,255,255,0.15);
    }

    .stat-number {
        font-size: 2.5rem;
        font-weight: 800;
        display: block;
        margin-bottom: 0.5rem;
        text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    .stat-label {
        font-size: 1rem;
        opacity: 0.9;
        font-weight: 300;
    }

    /* Desktop sections grid */
    .sections-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2rem;
        margin-top: 3rem;
    }

    .section-card {
        background: white;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        border: 1px solid rgba(255,255,255,0.8);
        overflow: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    .section-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 6px;
        background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
        background-size: 300% 100%;
        animation: gradient-shift 3s ease-in-out infinite;
    }

    @keyframes gradient-shift {
        0%, 100% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
    }

    .section-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    }

    .card-header {
        padding: 2rem 2rem 1rem;
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

    .card-icon {
        font-size: 3rem;
        width: 80px;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 20px;
        color: white;
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    }

    .card-header h3 {
        font-size: 1.8rem;
        font-weight: 700;
        margin: 0;
        color: #2c3e50;
    }

    .card-content {
        padding: 0 2rem 2rem;
    }

    .card-content h4 {
        font-size: 1.2rem;
        color: #34495e;
        margin-bottom: 1rem;
        line-height: 1.4;
        font-weight: 500;
    }

    .card-topics {
        margin-bottom: 1.5rem;
    }

    .card-topics li {
        margin-bottom: 0.5rem;
        padding-left: 1.5rem;
        position: relative;
        color: #555;
        font-size: 0.95rem;
    }

    .card-topics li::before {
        content: "▸";
        color: #667eea;
        font-weight: bold;
        position: absolute;
        left: 0;
        font-size: 1.2rem;
    }

    .card-stats {
        display: flex;
        justify-content: space-between;
        padding: 1rem 2rem;
        background: #f8f9fa;
        border-top: 1px solid #e9ecef;
        font-size: 0.9rem;
    }

    .card-stats span {
        background: #667eea;
        color: white;
        padding: 0.3rem 0.8rem;
        border-radius: 20px;
        font-weight: 600;
        font-size: 0.85rem;
    }

    .card-footer {
        padding: 0 2rem 2rem;
    }

    .btn-primary {
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1.1rem;
        font-weight: 600;
        border-radius: 12px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
        position: relative;
        overflow: hidden;
    }

    .btn-primary::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
        transition: left 0.6s;
    }

    .btn-primary:hover::before {
        left: 100%;
    }

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }

    /* Hide mobile navigation on desktop */
    .mobile-nav-bar {
        display: none !important;
    }

    /* Desktop navigation */
    .main-nav {
        position: fixed;
        top: 2rem;
        right: 2rem;
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(20px);
        border-radius: 16px;
        padding: 1rem;
        box-shadow: 0 8px 32px rgba(0,0,0,0.1);
        z-index: 100;
    }

    .nav-container {
        display: flex;
        gap: 1rem;
    }

    .nav-menu {
        display: flex;
        gap: 1rem;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav-menu a {
        padding: 0.75rem 1.25rem;
        border-radius: 12px;
        text-decoration: none;
        color: #2c3e50;
        font-weight: 500;
        transition: all 0.3s ease;
    }

    .nav-menu a:hover,
    .nav-menu a.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        transform: translateY(-2px);
    }
}

@media (max-width: 768px) {
    .mobile-nav-bar {
        display: block;
    }

    .mobile-nav-bar .nav-container {
        padding: 0;
    }

    .mobile-nav-bar .nav-menu {
        margin: 0;
        padding: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    .mobile-nav-bar .nav-menu li {
        margin: 0;
    }

    .mobile-nav-bar .nav-menu a {
        padding: 0.4rem 0.15rem;
        font-size: 0.65rem;
        line-height: 1.1;
        min-height: 55px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #666;
        border-radius: 0;
        transition: all 0.2s ease;
        position: relative;
    }

    .mobile-nav-bar .nav-menu a::before {
        content: attr(data-icon);
        font-size: 1.1rem;
        margin-bottom: 0.2rem;
        display: block;
    }

    .mobile-nav-bar .nav-menu a span {
        font-size: 0.65rem;
        text-align: center;
    }

    .mobile-nav-bar .nav-menu a:hover,
    .mobile-nav-bar .nav-menu a.active {
        color: #667eea;
        background: rgba(102, 126, 234, 0.1);
    }

    .mobile-nav-bar .nav-menu a:active {
        background: rgba(102, 126, 234, 0.2);
        transform: scale(0.95);
    }
}

/* Базовые стили для мобильных (применяются ко всем размерам) */
:root {
    /* Мобильные переменные */
    --mobile-padding: 1rem;
    --mobile-margin: 0.5rem;
    --mobile-border-radius: 12px;
    --mobile-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --mobile-font-size: 16px;
    --mobile-line-height: 1.5;
}

/* Базовый сброс для мобильных */
* {
    box-sizing: border-box;
}

body {
    font-size: var(--mobile-font-size);
    line-height: var(--mobile-line-height);
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Мобильная навигация - полная переработка */
.main-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color, white);
    border-top: 1px solid var(--border-color, #e0e0e0);
    padding: 0.5rem var(--mobile-padding);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 0.25rem;
}

.nav-menu {
    display: flex;
    width: 100%;
    justify-content: space-around;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    flex: 1;
}

.nav-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    text-decoration: none;
    color: var(--text-color, #333);
    font-size: 0.75rem;
    border-radius: var(--mobile-border-radius);
    transition: all 0.2s ease;
    min-height: 60px;
    text-align: center;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: var(--primary-color, #3498db);
    color: white;
}

.nav-menu a::before {
    content: attr(data-icon);
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    display: block;
}

/* Скрываем старую навигацию на мобильных */
@media (max-width: 768px) {
    .nav-container .search-container {
        display: none;
    }

    .nav-menu:not(.mobile-nav) {
        display: none;
    }

    .mobile-nav {
        display: flex !important;
    }
}

/* Полная мобильная переработка */

/* Мобильный header - компактный и не мешающий */
@media (max-width: 768px) {
    header {
        position: relative; /* Не фиксированный на мобильных */
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(0,0,0,0.1);
        padding: 0.5rem var(--mobile-padding);
        margin-bottom: 1rem;
        border-radius: 0 0 var(--mobile-border-radius) var(--mobile-border-radius);
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0;
    }

    .header-content {
        flex: 1;
    }

    .header-content h1 {
        font-size: 1.1rem;
        margin: 0;
        font-weight: 600;
        color: #2c3e50;
    }

    .header-controls {
        display: flex;
        gap: 0.25rem;
        align-items: center;
    }

    .theme-toggle,
    .back-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(102, 126, 234, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.2s ease;
        color: #667eea;
    }

    .theme-toggle:hover,
    .back-btn:hover {
        background: rgba(102, 126, 234, 0.2);
        transform: scale(1.05);
    }

    /* Убираем отступ для фиксированного header */
    body {
        padding-top: 0; /* Убираем отступ сверху */
        padding-bottom: 80px; /* Только для нижней навигации */
    }

    /* Компактный breadcrumbs */
    .breadcrumbs {
        padding: 0.5rem var(--mobile-padding);
        margin-bottom: 1rem;
        font-size: 0.8rem;
    }

    .breadcrumb-container {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .breadcrumb-home {
        font-size: 1rem;
    }

    .breadcrumb-separator {
        color: #666;
        font-size: 0.8rem;
    }

    .breadcrumb-current {
        color: #666;
        font-weight: 500;
    }

    /* Container adjustments */
    .container {
        max-width: 100%;
        padding: 0 var(--mobile-padding);
    }

    .home-main {
        padding: 0;
    }

    .hero-section {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sections-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 2rem 0;
    }
}

/* Extra wide screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1600px;
    }

    .content-section {
        padding: 2rem;
    }

    .topic-content-simple {
        padding: 2.5rem 1.5rem;
    }
}

/* Enhanced mobile responsiveness */

/* Large tablets and small laptops (769px - 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 1.5rem;
    }

    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .sections-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .section-card {
        padding: 1.5rem;
    }

    .sidebar {
        position: static;
        width: 100%;
        margin-bottom: 2rem;
    }

    .content {
        margin-left: 0;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .search-container {
        width: 100%;
    }
}

/* Tablets (481px - 768px) */
@media (max-width: 768px) {
    :root {
        --radius: 8px;
        --shadow: 0 2px 8px rgba(0,0,0,0.1);
        --border-color: #e0e0e0;
    }

    body {
        font-size: 16px;
        line-height: 1.6;
    }

    .header-top {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .header-content h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .header-controls {
        margin-top: 1rem;
    }

    /* Полная переработка главной страницы для мобильных */

    .hero-section {
        padding: var(--mobile-padding);
        text-align: center;
        margin-bottom: 2rem;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border-radius: 0 0 var(--mobile-border-radius) var(--mobile-border-radius);
        margin: 0 calc(-1 * var(--mobile-padding)) 2rem;
        position: relative;
        overflow: hidden;
    }

    .hero-section::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
        animation: float 6s ease-in-out infinite;
    }

    @keyframes float {
        0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
        50% { transform: translate(-50%, -50%) rotate(180deg); }
    }

    .hero-content {
        position: relative;
        z-index: 2;
    }

    .hero-content h2 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1rem;
        font-weight: 700;
        text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    .hero-content p {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
        opacity: 0.9;
    }

    /* Мобильные быстрые действия */
    .hero-actions {
        display: flex;
        gap: 0.75rem;
        margin-top: 1.5rem;
        justify-content: center;
    }

    .hero-actions .btn-primary {
        flex: 1;
        max-width: 140px;
        padding: 0.875rem 0.5rem;
        font-size: 0.85rem;
        border-radius: var(--mobile-border-radius);
        background: rgba(255,255,255,0.2);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.3);
        color: white;
        text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    }

    .hero-actions .btn-primary:hover {
        background: rgba(255,255,255,0.3);
        transform: translateY(-2px);
    }

    /* Скрываем старую статистику на мобильных */
    .hero-stats {
        display: none;
    }

    /* Полностью переработанная сетка разделов для мобильных */
    .sections-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0;
    }

    .section-card {
        background: white;
        border-radius: var(--mobile-border-radius);
        padding: 1.5rem;
        box-shadow: var(--mobile-shadow);
        border: 1px solid rgba(0,0,0,0.05);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }

    .section-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, #667eea, #764ba2);
        transform: scaleX(0);
        transition: transform 0.3s ease;
    }

    .section-card:hover::before {
        transform: scaleX(1);
    }

    .section-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    }

    .card-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .card-icon {
        font-size: 2.5rem;
        width: 60px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: var(--mobile-border-radius);
        color: white;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }

    .card-header h3 {
        font-size: 1.25rem;
        margin: 0;
        font-weight: 600;
        color: #2c3e50;
    }

    .card-content h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        color: #666;
        line-height: 1.4;
        font-weight: 500;
    }

    .card-topics {
        margin-bottom: 1rem;
    }

    .card-topics li {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
        padding-left: 1rem;
        position: relative;
        color: #555;
    }

    .card-topics li::before {
        content: "•";
        color: #667eea;
        font-weight: bold;
        position: absolute;
        left: 0;
        font-size: 1.2rem;
    }

    .card-stats {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.85rem;
        color: #888;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #f0f0f0;
    }

    .card-stats span {
        background: #f8f9fa;
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
        font-weight: 500;
    }

    .card-footer {
        margin-top: 1.25rem;
    }

    .btn-primary {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: var(--mobile-border-radius);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        position: relative;
        overflow: hidden;
    }

    .btn-primary::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        transition: left 0.5s;
    }

    .btn-primary:hover::before {
        left: 100%;
    }

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    }

    .btn-primary:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    .card-header h3 {
        font-size: 1.3rem;
    }

    .card-content h4 {
        font-size: 1.1rem;
    }

    .content-section {
        padding: 1rem;
    }

    .content-section h2 {
        font-size: 1.5rem;
    }

    .progress-summary {
        padding: 1rem;
    }

    .summary-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .sidebar {
        position: static;
        width: 100%;
        padding: 1rem;
    }

    .sidebar-section {
        margin-bottom: 1.5rem;
    }

    .sidebar-title {
        font-size: 1.2rem;
    }

    .quick-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-btn {
        width: 100%;
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }

    .topic-section {
        margin-bottom: 2rem;
    }

    .topic-header-simple {
        padding: 1rem;
    }

    .topic-number-simple {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
    }

    .topic-header-simple h3 {
        font-size: 1.2rem;
    }

    .topic-content-simple {
        padding: 1rem 0.5rem;
    }

    .formula {
        font-size: 1.1rem;
        padding: 0.5rem;
    }

    .example {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }

    /* Tables responsiveness */
    .example table {
        font-size: 0.9rem;
    }

    .example th,
    .example td {
        padding: 0.5rem;
    }

    /* Simple explanations mobile */
    .simple-explanations-section {
        padding: 1rem;
    }

    .simple-explanation {
        padding: 1rem;
        margin: 0.8rem 0;
    }

    .simple-explanation h4 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    /* Navigation improvements */
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        padding: 0.8rem 1rem;
        width: 100%;
        text-align: center;
    }

    .search-container {
        width: 100%;
        margin-top: 1rem;
    }

    .search-input {
        width: 100%;
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
}

/* Mobile phones (481px and below) */
@media (max-width: 480px) {
    :root {
        --radius: 6px;
    }

    body {
        font-size: 15px;
        line-height: 1.5;
    }

    .container {
        padding: 0 0.5rem;
    }

    header {
        padding: 0.5rem 0;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .theme-toggle,
    .back-btn {
        padding: 0.6rem;
        font-size: 1.2rem;
    }

    .hero-section {
        padding: 1rem 0.5rem;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-stats {
        gap: 0.8rem;
    }

    .stat-item {
        flex: 1;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    .sections-grid {
        padding: 1rem 0;
    }

    .section-card {
        padding: 1rem;
    }

    .card-icon {
        font-size: 2rem;
    }

    .card-header h3 {
        font-size: 1.2rem;
    }

    .card-content h4 {
        font-size: 1rem;
    }

    .card-topics li {
        font-size: 0.9rem;
    }

    .card-stats {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.9rem;
    }

    .card-footer {
        padding-top: 1rem;
    }

    .btn-primary {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }

    .nav-container {
        padding: 0.5rem;
    }

    .main-nav {
        padding: 0.5rem 0;
    }

    .progress-container {
        height: 3px;
    }

    .breadcrumbs {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .content-section {
        padding: 0.8rem;
    }

    .content-section h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .progress-summary h3 {
        font-size: 1.2rem;
    }

    .stat-number-large {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    .sidebar {
        padding: 0.8rem;
    }

    .sidebar-title {
        font-size: 1.1rem;
    }

    .quick-actions {
        gap: 0.8rem;
    }

    .action-btn {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .table-of-contents {
        font-size: 0.9rem;
    }

    .topic-section {
        margin-bottom: 1.5rem;
    }

    .topic-header-simple {
        padding: 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .topic-number-simple {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 0.9rem;
        align-self: flex-start;
    }

    .topic-header-simple h3 {
        font-size: 1.1rem;
        line-height: 1.3;
        margin: 0;
    }

    .topic-content-simple {
        padding: 0.8rem 0.3rem;
    }

    .topic-content-simple h4 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .topic-content-simple p {
        margin-bottom: 1rem;
        line-height: 1.6;
    }

    .formula {
        font-size: 1rem;
        padding: 0.8rem 0.5rem;
        margin: 0.5rem 0;
        overflow-x: auto;
        white-space: nowrap;
    }

    .example {
        padding: 0.8rem 0.5rem;
        margin: 0.8rem 0;
        font-size: 0.95rem;
    }

    .simple-explanations-section {
        padding: 0.8rem;
    }

    .simple-explanation-header h3 {
        font-size: 1.3rem;
    }

    .simple-explanation {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }

    .simple-explanation h4 {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }

    .simple-explanation p,
    .simple-explanation ul,
    .simple-explanation ol {
        font-size: 0.95rem;
    }

    .analogy,
    .key-point {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }

    .analogy h4,
    .key-point h4 {
        font-size: 1rem;
    }

    /* Touch-friendly buttons */
    button,
    .btn-primary,
    .action-btn {
        min-height: 44px;
        padding: 0.8rem 1rem;
    }

    /* Better touch targets */
    .completion-checkbox {
        width: 24px;
        height: 24px;
        margin-right: 0.8rem;
    }

    .topic-toggle {
        width: 40px;
        height: 40px;
    }

    /* Improved scrolling */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Better text readability */
    p, li {
        text-align: justify;
        hyphens: auto;
        word-wrap: break-word;
    }

    /* Hide less important elements on very small screens */
    .hero-stats .stat-item:nth-child(3) {
        display: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    button,
    a,
    .completion-checkbox,
    .action-btn,
    .btn-primary {
        min-height: 44px;
        min-width: 44px;
    }

    /* Prevent text selection on touch */
    .topic-header-simple h3,
    .sidebar-title {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Better scrolling on iOS */
    .content,
    .sidebar {
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile device classes */
.mobile-device {
    /* Optimize for mobile performance */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mobile-device button,
.mobile-device a,
.mobile-device input,
.mobile-device textarea,
.mobile-device select {
    -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.touch-device .completion-checkbox,
.touch-device .action-btn {
    /* Larger touch targets */
    transform: scale(1.1);
}

.touch-device .formula {
    /* Better scrolling for formulas on touch */
    cursor: grab;
}

.touch-device .formula:active {
    cursor: grabbing;
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .section-card,
    .topic-section,
    .sidebar-section {
        border-width: 0.5px;
    }

    /* Better font rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 1rem 0.5rem;
    }

    .hero-content h2 {
        font-size: 1.4rem;
    }

    .sections-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
    }
}

/* Print optimizations for mobile */
@media print {
    .mobile-device .sidebar,
    .mobile-device .nav-menu,
    .mobile-device .search-container {
        display: none !important;
    }

    .mobile-device .content-section {
        margin: 0;
        padding: 0.5rem;
    }
}

/* Enhanced typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text-color);
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child {
    margin-top: 0;
}

.topic-content-simple h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

p {
    line-height: 1.7;
    margin-bottom: 1em;
    text-align: justify;
    hyphens: auto;
}

ul, ol {
    line-height: 1.6;
    margin: 1em 0;
    padding-left: 1.5em;
}

li {
    margin-bottom: 0.5em;
    padding-left: 0.5em;
}

strong, b {
    font-weight: 600;
    color: var(--text-color);
}

/* Better list styling */
.topic-content-simple ul {
    list-style-type: disc;
}

.topic-content-simple ol {
    list-style-type: decimal;
}

.topic-content-simple li {
    margin-bottom: 0.75em;
    padding-left: 0.5em;
}

/* Enhanced code and pre formatting */
code {
    background: #f4f4f4;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #c7254e;
}

pre {
    background: #f8f8f8;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    border: 1px solid #e1e1e1;
    margin: 1em 0;
}

/* Better link styling */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Better blockquote styling */
blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-muted);
}

/* Better table styling for content */
.topic-content-simple table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topic-content-simple th,
.topic-content-simple td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    text-align: left;
}

.topic-content-simple th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.topic-content-simple tr:nth-child(even) {
    background: #f8f9fa;
}

/* Better image styling */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Better horizontal rule */
hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 2rem 0;
}

/* Hero section */
.hero-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 4rem 0;
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 500px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.stat-item {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.math-symbols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Sections grid */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    padding: 4rem 0;
}

.section-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 2px solid transparent;
}

.section-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem 2rem 1rem;
}

.card-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    color: white;
}

.card-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.card-content {
    padding: 0 2rem 1rem;
}

.card-content h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.card-topics {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-bottom: 1.5rem;
}

.card-topics li {
    padding: 0.25rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    position: relative;
    padding-left: 1rem;
}

.card-topics li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.card-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.topic-count, .question-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.card-footer {
    padding: 1rem 2rem 2rem;
}

.btn-primary {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Exam info */
.exam-info {
    padding: 4rem 0;
    background: var(--bg-color);
}

.exam-card {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem;
    text-align: center;
}

.exam-card h3 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.exam-details {
    display: grid;
    gap: 1rem;
}

.exam-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    transition: var(--transition);
}

.exam-item:hover {
    background: var(--primary-color);
    color: white;
}

.exam-label {
    font-weight: 600;
}

.exam-value {
    text-align: right;
    opacity: 0.9;
}

/* Page navigation */
.page-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3rem 0;
    border-top: 2px solid var(--border-color);
    margin-top: 3rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    font-weight: 600;
}

.nav-btn:hover:not(.disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn.home-btn {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-btn.home-btn:hover {
    background: var(--secondary-color);
}

.nav-icon {
    font-size: 1.2rem;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* Section progress */
.section-progress {
    text-align: center;
    margin-bottom: 1rem;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.progress-circle {
    display: inline-block;
}

/* Footer */
.home-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Content */
.content {
    flex: 1;
}

.content-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    transition: var(--transition);
    max-width: none;
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
}

/* Новый дизайн тем - без карточек, просто разделы */
.topic-section {
    margin-bottom: 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.topic-header-simple {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topic-number-simple {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.topic-header-simple h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
}

.topic-content-simple {
    padding: 2rem 1rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
}

.topic-content-simple h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    margin-top: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.topic-content-simple h4:first-child {
    margin-top: 0;
}

/* Progress tracking styles */
.topic-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.progress-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

.progress-circle {
    position: relative;
    width: 60px;
    height: 60px;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-circle circle {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.progress-circle circle:first-child {
    stroke: rgba(255,255,255,0.3);
}

.progress-circle circle:last-child {
    stroke: white;
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    transition: stroke-dashoffset 0.5s ease;
}

/* Topic completion checkbox */
.topic-completion {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}

.topic-completion:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.topic-completion.completed {
    border-color: var(--success-color, #10b981);
    background: rgba(16, 185, 129, 0.1);
}

.completion-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    pointer-events: auto !important;
}

.topic-completion.completed .completion-checkbox {
    background: var(--success-color, #10b981);
    border-color: var(--success-color, #10b981);
}

.completion-checkbox::after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.topic-completion.completed .completion-checkbox::after {
    opacity: 1;
}

.completion-label {
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    flex: 1;
    pointer-events: auto !important;
    user-select: none;
}

.topic-completion.completed .completion-label {
    color: var(--success-color, #10b981);
    text-decoration: line-through;
    opacity: 0.8;
}

.completion-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.topic-completion.completed .completion-date {
    color: var(--success-color, #10b981);
}

/* Completed topic styling */
.topic-section.completed {
    opacity: 0.8;
}

.topic-section.completed .topic-header-simple {
    background: linear-gradient(135deg, var(--success-color, #10b981), var(--success-color, #10b981));
}

.topic-section.completed .topic-number-simple {
    background: rgba(255,255,255,0.3);
}

/* Progress summary */
.progress-summary {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.progress-summary h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.stat-card.completed {
    border-color: var(--success-color, #10b981);
    background: rgba(16, 185, 129, 0.05);
}

.stat-number-large {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.stat-card.completed .stat-number-large {
    color: var(--success-color, #10b981);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.example {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 0.5rem;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
}

.example p {
    margin: 0.5rem 0;
}

.example strong {
    color: var(--primary-color);
}

/* Разделители между темами */
.topic-section:not(:last-child)::after {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    margin: 2rem 0;
    opacity: 0.3;
}

/* Новые стили для sidebar */
.section-info {
    margin-top: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-icon {
    font-size: 1.1rem;
}

.theory-content {
    line-height: 1.8;
    color: var(--text-color);
}

.theory-content p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.theory-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.theory-content li {
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 0.5rem;
}

.theory-content li::marker {
    color: var(--primary-color);
    font-weight: bold;
}

.formula {
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-family: 'Times New Roman', serif;
    font-size: 1.1rem;
    text-align: center;
    border-radius: 0 8px 8px 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
    overflow-x: auto;
}

.formula::before {
    content: "📐";
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.formula sup, .formula sub {
    font-size: 0.8em;
}

/* Enhanced formula display */
.formula {
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.formula::-webkit-scrollbar {
    height: 4px;
}

.formula::-webkit-scrollbar-track {
    background: transparent;
}

.formula::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* Mobile navigation overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-top {
        padding: 1rem 0;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: var(--card-bg);
        flex-direction: column;
        gap: 0;
        padding: 5rem 0 0 0;
        box-shadow: -5px 0 20px rgba(0,0,0,0.2);
        transition: var(--transition);
        z-index: 1000;
    }

    .nav-menu.show {
        right: 0;
    }

    .nav-menu a {
        padding: 1.5rem 2rem;
        border-bottom: 1px solid var(--border-color);
        color: var(--text-color);
        font-weight: 500;
    }

    .nav-menu a:hover {
        background: var(--primary-color);
        color: white;
    }

    .search-container {
        width: 100%;
        margin-top: 1rem;
    }

    .search-input {
        width: 100%;
    }

    .search-input:focus {
        width: 100%;
    }

    main {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .sidebar {
        position: static;
        flex: none;
    }

    .sidebar-content {
        border-radius: 0;
    }

    .welcome-card {
        padding: 2rem 1rem;
    }

    .welcome-card h2 {
        font-size: 1.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .content-section {
        padding: 1rem;
        border-radius: 0;
        margin-bottom: 1rem;
    }

    .topic-header {
        padding: 1rem;
    }

    .topic-content {
        padding: 1rem;
    }

    .topic-number {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .topic-header h3 {
        font-size: 1rem;
    }

    .formula {
        padding: 1rem;
        font-size: 1rem;
        margin: 1rem 0;
    }

    .breadcrumb-container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem 0;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 1rem;
    }

    main {
        padding: 1rem 10px;
    }

    section {
        padding: 0.8rem;
    }

    article h3 {
        font-size: 1.1rem;
    }
}

/* Simple explanations styles */
.simple-explanations-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #3498db;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.simple-explanation-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3498db;
}

.simple-explanation-header h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.simple-explanation-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin: 0;
}

.simple-explanation {
    background: rgba(255, 255, 255, 0.8);
    border-left: 4px solid #3498db;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.simple-explanation h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.simple-explanation ul, .simple-explanation ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.simple-explanation li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.analogy {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #f39c12;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.15);
}

.analogy h4 {
    color: #d68910;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.key-point {
    background: linear-gradient(135deg, #d5f4e6 0%, #a8e6cf 100%);
    border-left: 4px solid #27ae60;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.15);
}

.key-point h4 {
    color: #229954;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: bold;
}

/* Print styles */
@media print {
    header {
        background: white !important;
        color: black !important;
    }

    .nav-container,
    .menu-toggle,
    .search-input,
    .table-of-contents {
        display: none !important;
    }

    main {
        padding: 0 !important;
    }

    section {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* Scroll animations */
article {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

article.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Simple explanations styles */
.simple-explanation {
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
}

.key-point {
    background: #e8f4f8;
    border-left: 4px solid #27ae60;
    padding: 1rem;
    margin: 1rem 0;
    font-weight: bold;
}

.analogy {
    background: #fff3cd;
    border-left: 4px solid #f39c12;
    padding: 1rem;
    margin: 1rem 0;
}

.step-by-step {
    background: #f0f8ff;
    border-left: 4px solid #9b59b6;
    padding: 1rem;
    margin: 1rem 0;
}

.step-by-step ol {
    padding-left: 1.5rem;
}

.step-by-step li {
    margin: 0.5rem 0;
}

/* Highlight search results */
.highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
}
