/* Шрифты */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap&subset=cyrillic,latin');

:root {
    /* Платформенная индиго-палитра в стиле главной */
    --primary-color: #4f46e5;   /* Indigo-600 */
    --primary-light: #818cf8;   /* Indigo-300/400 */
    --primary-dark: #4338ca;    /* Indigo-700 */
    --secondary-color: #e0e7ff; /* Indigo-100 */
    --accent-color: #6366f1;    /* Indigo-500 */
    --text-color: #333344;
    --light-text: #333344;
    --border-color: rgba(0, 0, 0, 0.06);
    --bg-color: #f9f9fb;
    --bg-gradient-1: #f9f9fb;
    --bg-gradient-2: #f0f0f5;
    
    /* Элементы интерфейса */
    --header-height: 70px;
    --shadow: 0 4px 16px rgba(79, 70, 229, 0.06);
    --shadow-small: 0 2px 8px rgba(79, 70, 229, 0.04);
    --shadow-hover: 0 6px 24px rgba(79, 70, 229, 0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --radius: 10px;
    --border-light: 1px solid rgba(255, 255, 255, 0.06);
    --border-dark: 1px solid rgba(0, 0, 0, 0.05);
    
    /* Полупрозрачные фоны */
    --overlay-light: rgba(79, 70, 229, 0.06);
    --overlay-dark: rgba(79, 70, 229, 0.08);
    --glassmorphism: rgba(249, 249, 251, 0.9);
    --header-bg: rgba(249, 249, 251, 0.98);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    min-height: 100vh;
    transition: all 0.4s ease;
    font-weight: 400;
}

/* Заголовок */
header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--light-text);
    height: var(--header-height);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100;
    box-shadow: var(--shadow-small);
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
    transition: all 0.4s ease;
    border-bottom: 1px solid var(--border-color);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-left: 64px; /* 20 (left) + 28 (burger width) + 16 (gap) */
    color: var(--light-text);
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Кнопки в хедере */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-right: 20px;
}

/* Кнопка выхода */
.exit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--light-text);
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    transition: all 0.3s ease;
}

.exit-btn:hover {
    background: var(--overlay-light);
    transform: translateY(-2px);
}

.exit-btn svg {
    width: 20px;
    height: 20px;
}

/* Кнопка меню */
.menu-toggle {
    position: absolute;
    left: 20px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    z-index: 200;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--light-text);
    border-radius: 4px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

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

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Основной контейнер */
.container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    transition: background 0.4s ease;
    overflow: hidden;
}

/* Боковое меню */
.sidebar {
    width: 260px;
    background: var(--bg-color);
    box-shadow: var(--shadow-small);
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.4s ease, background 0.4s ease;
    z-index: 99;
    border-right: 1px solid var(--border-color);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

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

/* Вкладки */
.tabs {
    display: flex;
    background: var(--bg-color);
    overflow-x: auto;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.tabs.hidden {
    display: none;
}

.tabs::-webkit-scrollbar {
    height: 0;
    display: none;
}

.tab {
    flex: 1;
    padding: 16px;
    color: var(--light-text);
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    min-width: 80px;
    opacity: 0.7;
}

.tab:hover {
    background-color: var(--overlay-light);
    opacity: 0.9;
}

.tab.active {
    opacity: 1;
    font-weight: 600;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

/* Содержимое вкладок */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    display: block;
}

/* Темы */
.topic {
    border-bottom: 1px solid var(--border-color);
}

.topic-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 15px 16px;
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    color: var(--light-text);
    font-weight: 400;
}

.topic-btn:hover {
    background-color: var(--overlay-light);
    padding-left: 18px;
}

.topic-btn::after {
    content: '\002B';
    font-size: 1.2rem;
    transition: var(--transition);
    opacity: 0.7;
}

.topic-btn.active {
    color: #111827; /* Черный, как в курсе по Python */
    font-weight: 600;
}

.topic-btn.active::after {
    content: '\2212';
    color: var(--primary-color);
}

/* Подтемы */
.subtopics {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background-color: var(--overlay-dark);
}

.subtopic {
    display: block;
    padding: 12px 16px 12px 18px;
    text-decoration: none;
    color: var(--light-text);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: 32px;
}

.subtopic:hover {
    background-color: var(--overlay-light);
    color: var(--primary-color);
}

/* Активная подтема в боковом меню: подсветка текста и фона */
.subtopic.active {
    color: var(--primary-color);
    background-color: var(--overlay-light);
    font-weight: 600;
}

/* Основной контент */
.content {
    flex-grow: 1;
    margin-left: 0;
    padding: 25px;
    transition: margin 0.4s ease, background 0.4s ease;
    overflow-x: hidden;
}

.content.sidebar-active {
    margin-left: 260px;
}

.welcome {
    max-width: 800px;
    margin: 20px auto;
    background: rgba(var(--bg-color), 0.6);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    border: 1px solid var(--border-color);
    transition: all 0.4s ease;
}

.welcome h1 {
    color: var(--primary-color);
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
    font-size: 2rem;
    position: relative;
}

.welcome p {
    margin-bottom: 20px;
    color: var(--text-color);
    line-height: 1.7;
    font-size: 1rem;
}

.welcome h2 {
    color: var(--primary-color);
    margin: 30px 0 15px;
    font-size: 1.4rem;
    font-weight: 500;
}

.welcome ul {
    margin: 0 0 20px 20px;
    color: var(--text-color);
}

.welcome ul li {
    margin-bottom: 10px;
}

/* Стилизация прокрутки для всей страницы */
body::-webkit-scrollbar {
    width: 6px;
}

body::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

/* Адаптивный дизайн */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 260px;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .header-title {
        margin-left: 20px;
    }
}

/* Исправление поведения на мобильных: контент не должен сдвигаться вправо при открытом меню */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .content,
    .content.sidebar-active {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .welcome {
        padding: 25px;
    }
    
    .welcome h1 {
        font-size: 1.6rem;
    }
    
    .welcome h2 {
        font-size: 1.2rem;
    }
    
    /* Responsive styling for medium screens */
    .features-section {
        padding: 18px 20px;
    }
    
    .protocol-badges {
        gap: 14px;
    }
    
    .badge {
        padding: 7px 14px;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .header-title {
        font-size: 1.3rem;
        margin-left: 44px; /* больше зазор справа от бургера на узких экранах */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .welcome {
        padding: 20px;
        margin: 10px auto;
    }
    
    .header-buttons {
        gap: 10px;
        margin-right: 10px;
    }
}

/* Универсальные кнопки и блоки навигации между модулями */
.next-module { text-align: center; margin: 20px 0; }
.btn { display: inline-block; padding: 12px 20px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.btn-gradient { background: linear-gradient(90deg, #2188ff, #804eda); color: #fff; }
.btn-dark { background: #30363d; color: #fff; }
.btn.disabled { opacity: 0.7; cursor: not-allowed; pointer-events: none; }

/* Стили для секции с обратной связью */
.feedback-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    color: #4a9eff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.contact-link i {
    margin-right: 8px;
    font-size: 18px;
}

.contact-link:hover {
    color: #6db5ff;
    transform: translateX(5px);
}

/* Стили для элементов с темным фоном */
.resources-section, 
.practice-tips, 
.interactive-resources,
.next-steps,
.visual-guide,
.operators-cheatsheet,
.conclusion {
    color: #e6e6e6; /* Светлый текст для темного фона */
}

/* Стили для важных заметок с темным фоном */
.resources-section p, 
.practice-tips p, 
.interactive-resources p,
.next-steps p,
.visual-guide p,
.operators-cheatsheet p,
.conclusion p {
    color: #e6e6e6;
}

/* Стили для списков в блоках с темным фоном */
.resources-section li, 
.practice-tips li, 
.interactive-resources li,
.next-steps li,
.visual-guide li,
.operators-cheatsheet li {
    color: #e6e6e6;
}

/* Стили для заголовка "Важно понимать разницу" */
.resources-section h4,
.practice-tips h4,
.interactive-resources h4,
.next-steps h4,
.visual-guide h4,
.operators-cheatsheet h4,
.conclusion h4 {
    color: #58a6ff; /* Яркий голубой для заголовков */
}

/* Базовый читаемый цвет для всех h4 на светлом фоне в курсе */
h4 {
    color: #111827;
}

/* Сохраняем цвета в тёмных блоках, перекрывая базовый h4 */
.visual-guide h4 { color: #7ee787; }
.conclusion h4 { color: #d2a8ff; }
.light-theme .conclusion h4 { color: #6f42c1; }

/* Улучшенные стили для таблиц в темных блоках */
.operators-cheatsheet table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    color: #e6e6e6; /* Светлый текст для всей таблицы */
}

.operators-cheatsheet th,
.operators-cheatsheet td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid #4d5566; /* Более контрастная граница */
    color: #e6e6e6; /* Явно задаем цвет текста */
}

.operators-cheatsheet th {
    background-color: #eef2ff; /* Indigo-50/100 */
    color: var(--primary-color);
    font-weight: 600;
}

.operators-cheatsheet td {
    background-color: #2d333b; /* Темный фон для ячеек */
}

/* Стили для светлой темы */
.light-theme .operators-cheatsheet table {
    color: #333344; /* Темный текст для светлой темы */
}

.light-theme .operators-cheatsheet th,
.light-theme .operators-cheatsheet td {
    border: 1px solid #d0d7de;
    color: #333344;
}

.light-theme .operators-cheatsheet th {
    background-color: #eef2ff;
    color: var(--primary-color);
}

.light-theme .operators-cheatsheet td {
    background-color: #f6f8fa;
}

/* Улучшенные стили для визуальных блоков */
.visual-guide {
    background: linear-gradient(to right, #2d3748, #1f2937);
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Базовая стилизация Mermaid-блоков под нашу тему */
.mermaid {
    display: block;
    width: 100%;
    min-width: 280px;
    overflow: auto;
    background: linear-gradient(180deg, #0b1020 0%, #141821 100%);
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(99,102,241,0.25);
    box-shadow: 0 10px 24px rgba(17,24,39,0.45);
}

.light-theme .mermaid {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 18px rgba(17,24,39,0.08);
}

.visual-guide h4 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #ffffff, #e2e8f0, #ffffff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    display: inline-block;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.visual-guide ul {
    margin-left: 20px;
}

.visual-guide li {
    color: #e6e6e6;
    margin-bottom: 12px;
    line-height: 1.5;
}

.visual-guide strong {
    color: var(--primary-light);
    font-weight: 600;
}

.visual-guide p {
    color: #e6e6e6;
    margin-bottom: 10px;
}

/* Стили для блоков кода, как в курсе по Python */
.code-example {
    border-radius: 8px;
    margin: 15px 0;
    max-width: 100%;
    overflow-x: auto;
    background-color: #282c34; /* Фон как в теме atom-one-dark */
    border-left: 4px solid #d2a8ff; /* Фиолетовая полоса слева */
}

.code-example pre {
    margin: 0;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Стили для текста в блоках кода */
.code-example code {
    background: transparent !important;
    border-radius: 0;
    padding: 0;
}

/* Стили для комментариев и других элементов кода */
.code-example code .hljs-comment,
.code-example code .hljs-meta {
    color: #6a9955 !important;
    font-style: italic;
}

.code-example code .hljs-string {
    color: #ce9178 !important;
}

.code-example code .hljs-keyword {
    color: #569cd6 !important;
    font-weight: 600;
}

.code-example code .hljs-built_in {
    color: #4ec9b0 !important;
}

/* Стили для светлой темы */
.light-theme .code-example {
    background-color: #f1f1f1;
    border-left: 4px solid #8a63d2;
}

.light-theme .code-example code {
    color: #333344 !important;
}

.light-theme .code-example code .hljs-comment,
.light-theme .code-example code .hljs-meta {
    color: #008000 !important;
    font-style: italic;
}

.light-theme .code-example code .hljs-string {
    color: #a31515 !important;
}

.light-theme .code-example code .hljs-keyword {
    color: #0000ff !important;
    font-weight: 600;
}

.light-theme .code-example code .hljs-built_in {
    color: #267f99 !important;
}

/* Стили для светлой темы */
.light-theme .visual-guide {
    background: linear-gradient(to right, #eef2ff, #e0e7ff);
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.08);
}

.light-theme .visual-guide h4 { 
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark), var(--primary-color));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    text-shadow: none;
    font-weight: 700;
    font-size: 1.2rem;
    animation: shineIndigo 3s linear infinite;
}

@keyframes shineIndigo {
    to {
        background-position: 200% center;
    }
}

.light-theme .visual-guide li,
.light-theme .visual-guide p { color: #1f2937; }

.light-theme .visual-guide strong { color: var(--primary-color); }

/* Исправление: в светлой теме делаем текст в блоке "Следующие шаги" чёрным */
.light-theme .next-steps,
.light-theme .next-steps p,
.light-theme .next-steps li {
    color: #000;
}

/* Явно делаем текст в блоке "Следующие шаги" чёрным (для всех тем) */
.next-steps,
.next-steps p,
.next-steps li {
    color: #000;
}

/* Явно делаем текст в блоках "Практические советы" чёрным (для всех тем) */
.practice-tips,
.practice-tips p,
.practice-tips li {
    color: #000;
}

/* Улучшенные стили для блока заключения */
.conclusion {
    background-color: #f1f1f1;
    border-radius: 8px;
    padding: 25px 30px;
    margin: 40px auto;
    border-left: 4px solid #8a63d2;
    text-align: center;
    max-width: 800px;
}

.conclusion h3 {
    color: #6f42c1;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 600;
}

.conclusion p {
    color: #333344;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Стили для блока с типами сред передачи данных */
.media-types-container {
    margin: 30px 0;
    padding: 0;
}

.media-types-title {
    font-size: 1.4rem;
    color: #333344;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.media-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
}

.media-type-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 25px;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.media-type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #818cf8);
}

.media-type-card.twisted-pair::before {
    background: linear-gradient(90deg, #4f46e5, #818cf8);
}

.media-type-card.coaxial::before {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.media-type-card.fiber::before {
    background: linear-gradient(90deg, #059669, #34d399);
}

.media-type-card.wireless::before {
    background: linear-gradient(90deg, #db2777, #f472b6);
}

.media-type-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.media-type-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.media-type-icon svg {
    width: 24px;
    height: 24px;
    color: #4f46e5;
}

.media-type-card.twisted-pair .media-type-icon svg {
    color: #4f46e5;
}

.media-type-card.coaxial .media-type-icon svg {
    color: #d97706;
}

.media-type-card.fiber .media-type-icon svg {
    color: #059669;
}

.media-type-card.wireless .media-type-icon svg {
    color: #db2777;
}

.media-type-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 10px 0;
}

.media-type-desc {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 15px;
}

.media-type-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
}

@media (max-width: 768px) {
    .media-types-grid,
    .topology-grid {
        grid-template-columns: 1fr;
    }
}

/* Стили для блока с топологиями сетей */
.topology-container {
    margin: 30px 0;
    padding: 0;
}

.topology-title {
    font-size: 1.4rem;
    color: #333344;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.topology-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
}

.topology-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 25px;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.topology-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background-size: 80px 80px;
    background-repeat: no-repeat;
    background-position: bottom right;
    opacity: 0.1;
    transition: all 0.3s ease;
}

.topology-card.bus::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234f46e5' d='M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z'/%3E%3C/svg%3E");
}

.topology-card.star::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234f46e5' d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
}

.topology-card.ring::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234f46e5' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3E%3C/svg%3E");
}

.topology-card.mesh::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234f46e5' d='M12 7.77L5.61 18h12.78zM12 4L2 20h20L12 4zm0 6.47L15.11 14H8.89L12 10.47z'/%3E%3C/svg%3E");
}

.topology-card.tree::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234f46e5' d='M12 22L3 13H9V1h6v12h6z'/%3E%3C/svg%3E");
}

.topology-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.topology-card:hover::after {
    opacity: 0.15;
    transform: scale(1.2);
}

.topology-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.topology-icon svg {
    width: 24px;
    height: 24px;
    color: #4f46e5;
}

.topology-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 10px 0;
}

.topology-desc {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 15px;
}

.topology-properties {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.property {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.property-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 5px;
}

.property-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    padding: 3px 10px;
    border-radius: 12px;
    background-color: #f3f4f6;
}

.property-value.high {
    background-color: #dcfce7;
    color: #166534;
}

.property-value.medium {
    background-color: #fef3c7;
    color: #92400e;
}

.property-value.low {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* ===== Стили для сетевых схем и теоретических блоков (только для курса Networks) ===== */

/* Контейнер схемы (без инлайн-стилей на страницах) */
.net-diagram {
    display: block;
    width: 100%;
    min-width: 280px;
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 6px 18px rgba(17,24,39,0.06);
    margin: 16px 0;
}

/* Карточки устройств в схеме */
.schema-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.schema-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.schema-card .title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.schema-card .desc {
    color: #111827;
    font-size: 0.95rem;
    line-height: 1.6;
}

.light-theme .schema-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.light-theme .schema-card .title { color: var(--primary-color); }
.light-theme .schema-card .desc { color: #1f2937; }

/* Визуальные «связи» между элементами (упрощённые линии) */
.schema-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f5f7fb;
    color: #111827;
    border: 1px dashed #e5e7eb;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.link-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-light);
}

.light-theme .link-chip { color: #1f2937; background: rgba(99,102,241,0.08); border-color: #c7d2fe; }
.light-theme .link-dot { background: var(--primary-color); }

/* Бейджи протоколов и технологий */
.protocol-badges {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0 10px 0;
    padding: 5px 0;
}

.badge-with-description {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badge-desc {
    font-size: 0.9rem;
    color: #4b5563;
    padding-left: 12px;
    line-height: 1.4;
}

.light-theme .badge-desc {
    color: #4b5563;
}


.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
    box-shadow: var(--shadow-small);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge.success { border-color: rgba(16,185,129,0.6); background: rgba(16,185,129,0.1); color: #065f46; }
.badge.warn { border-color: rgba(245,158,11,0.6); background: rgba(245,158,11,0.1); color: #92400e; }
.badge.danger { border-color: rgba(239,68,68,0.6); background: rgba(239,68,68,0.1); color: #7f1d1d; }
.badge.info { border-color: rgba(59,130,246,0.6); background: rgba(59,130,246,0.1); color: #1e3a8a; }

.light-theme .badge { background: #ffffff; color: #111827; border-color: #e5e7eb; }
.light-theme .badge.success { color: #065f46; border-color: #a7f3d0; background: rgba(16,185,129,0.1); }
.light-theme .badge.warn { color: #92400e; border-color: #fde68a; background: rgba(245,158,11,0.1); }
.light-theme .badge.danger { color: #7f1d1d; border-color: #fecaca; background: rgba(239,68,68,0.1); }
.light-theme .badge.info { color: #1e3a8a; border-color: #bfdbfe; background: rgba(59,130,246,0.1); }

/* Выделенные боксы с теориями/командами */
.note,
.tip,
.warn,
.danger {
    border-radius: 10px;
    padding: 18px 20px 18px 24px;
    margin: 20px 0;
    position: relative;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    overflow: hidden;
    transition: all 0.3s ease;
}

.note:hover,
.tip:hover,
.warn:hover,
.danger:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.note::before,
.tip::before,
.warn::before,
.danger::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 6px;
    background: linear-gradient(to bottom, var(--accent-color), var(--primary-light));
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
    border-radius: 0 3px 3px 0;
    animation: pulseGlowBlue 3s infinite alternate;
}

@keyframes pulseGlowBlue {
    0% {
        box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
    }
    100% {
        box-shadow: 0 0 16px rgba(99, 102, 241, 0.7);
    }
}

.note strong,
.tip strong,
.warn strong,
.danger strong {
    color: var(--primary-color);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.tip { 
    background: linear-gradient(to right, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.03));
    border: 1px solid rgba(16, 185, 129, 0.15);
}
.tip::before { 
    background: linear-gradient(to bottom, #10b981, #34d399);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    animation: pulseGlowGreen 3s infinite alternate;
}
.tip strong { color: #059669; }

@keyframes pulseGlowGreen {
    0% {
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    }
    100% {
        box-shadow: 0 0 16px rgba(16, 185, 129, 0.7);
    }
}

.warn { 
    background: linear-gradient(to right, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.03));
    border: 1px solid rgba(245, 158, 11, 0.15);
}
.warn::before { 
    background: linear-gradient(to bottom, #f59e0b, #fbbf24);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    animation: pulseGlowYellow 3s infinite alternate;
}
.warn strong { color: #d97706; }

@keyframes pulseGlowYellow {
    0% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    }
    100% {
        box-shadow: 0 0 16px rgba(245, 158, 11, 0.7);
    }
}

.danger { 
    background: linear-gradient(to right, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.03));
    border: 1px solid rgba(239, 68, 68, 0.15);
}
.danger::before { 
    background: linear-gradient(to bottom, #ef4444, #f87171);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    animation: pulseGlowRed 3s infinite alternate;
}
.danger strong { color: #dc2626; }

@keyframes pulseGlowRed {
    0% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    }
    100% {
        box-shadow: 0 0 16px rgba(239, 68, 68, 0.7);
    }
}

.light-theme .note,
.light-theme .tip,
.light-theme .warn,
.light-theme .danger {
    background: linear-gradient(to right, rgba(99, 102, 241, 0.05), rgba(99, 102, 241, 0.02));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.light-theme .note::before {
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-light));
}

.light-theme .tip {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.02));
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.light-theme .warn {
    background: linear-gradient(to right, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.02));
    border: 1px solid rgba(245, 158, 11, 0.1);
}

.light-theme .danger {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.02));
    border: 1px solid rgba(239, 68, 68, 0.1);
}

/* Спецификационные таблицы */
.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.95rem;
}

.spec-table th,
.spec-table td {
    border: 1px solid #e5e7eb;
    padding: 12px 14px;
    vertical-align: top;
    color: #111827;
}

/* Минималистичный светлый стиль таблиц (без темных фонов) */
.spec-table th {
    background: #f8fafc;
    color: #111827;
    font-weight: 600;
}

.spec-table tr:nth-child(even) td { background: #fbfdff; }
.spec-table tr:nth-child(odd) td { background: #ffffff; }

.light-theme .spec-table th,
.light-theme .spec-table td { color: #111827; border-color: #e5e7eb; }
.light-theme .spec-table th { background: #eef2ff; color: var(--primary-dark); }
.light-theme .spec-table tr:nth-child(even) td { background: #f8fafc; }
.light-theme .spec-table tr:nth-child(odd) td { background: #ffffff; }

/* Блоки с командами/CLI */
.cli-block {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    overflow: auto;
    margin: 12px 0;
    color: #111827;
}

/* Заголовки и секции уроков */
.topic-section h2,
.topic-section h3,
.topic-section h4 { color: #111827; }
.topic-section h3 { margin-top: 14px; }
.topic-section p { margin-bottom: 10px; }
.topic-section ul, .topic-section ol { margin: 0 0 10px 20px; }

/* Легенды для схем */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #111827;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.legend-swatch.copper { background: #b45309; }
.legend-swatch.fiber { background: #0ea5e9; }
.legend-swatch.wireless { background: #10b981; }
.legend-swatch.control { background: #6366f1; }

.light-theme .legend-item { color: #111827; }
.light-theme .legend-swatch { border-color: #e5e7eb; }

/* ===== Overrides: Теоретический контент и улучшение читаемости ===== */
/* Чёрные заголовки внутри теоретических блоков, как в курсе Python */
.topic-section .lesson-content h2,
.topic-section .lesson-content h3,
.topic-section .lesson-content h4 {
    color: #111827;
}

/* Более комфортная типографика для теории */
.topic-section .lesson-content p,
.topic-section .lesson-content li {
    line-height: 1.75;
    font-size: 1rem;
}

/* Улучшенное отображение для заголовков в контенте */
.topic-section .lesson-content h3,
.topic-section .lesson-content h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Улучшенное взаимодействие с бейджами */
.badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Стилизация секции с возможностями сетей */
.features-section {
    background: linear-gradient(to right, rgba(79, 70, 229, 0.05), rgba(79, 70, 229, 0.02));
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-small);
}

.features-section h4 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 1.1rem;
}

.light-theme .features-section {
    background: linear-gradient(to right, rgba(79, 70, 229, 0.05), rgba(79, 70, 229, 0.01));
}

/* Улучшение таблиц: крупнее шрифт и отступы */
.spec-table {
    font-size: 0.98rem;
}

.spec-table th,
.spec-table td {
    padding: 12px 14px;
}

/* Светлая тема: более мягкие тона */
.light-theme .spec-table th,
.light-theme .spec-table td {
    color: #111827;
    border-color: #e5e7eb;
}

.light-theme .spec-table th {
    background: #f8fafc;
    color: #111827;
}

.light-theme .spec-table tr:nth-child(even) td { background: #fbfdff; }
.light-theme .spec-table tr:nth-child(odd) td { background: #ffffff; }

/* Обёртка для таблиц: прокрутка и визуальный контейнер */
.spec-table-wrapper {
    margin: 12px 0;
    padding: 12px;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: var(--shadow-small);
    border: 1px solid rgba(229, 231, 235, 0.9);
    background: #ffffff;
}

.light-theme .spec-table-wrapper {
    background: #ffffff;
    border-color: #e5e7eb;
}

@media (max-width: 576px) {
    .spec-table th, .spec-table td {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    /* Responsive styling for features section */
    .features-section {
        padding: 16px;
        margin: 16px 0;
    }
    
    .features-section h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .protocol-badges {
        gap: 14px;
    }
    
    .badge {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .badge-desc {
        font-size: 0.85rem;
        padding-left: 8px;
    }
}
