/* ===== CSS ПЕРЕМЕННЫЕ (CUSTOM PROPERTIES) ===== */
:root {
    /* Светлая тема */
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    --gradient-primary: linear-gradient(135deg, #2563eb, #7c3aed);
    --gradient-secondary: linear-gradient(135deg, #06b6d4, #10b981);
    
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    
    --transition-default: all 0.3s ease;
}

[data-theme="dark"] {
    /* Тёмная тема */
    --primary-color: #60a5fa;
    --secondary-color: #a78bfa;
    --accent-color: #22d3ee;
    --success-color: #34d399;
    
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    
    --border-color: #4b5563;
    --shadow-color: rgba(0, 0, 0, 0.3);
    
    --gradient-primary: linear-gradient(135deg, #60a5fa, #a78bfa);
    --gradient-secondary: linear-gradient(135deg, #22d3ee, #34d399);
    
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --hover-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    line-height: 1.7;
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
    background-color: var(--bg-secondary);
    min-height: 100vh;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 40px;
    background-color: var(--bg-primary);
    box-shadow: var(--card-shadow);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-default);
}

/* Декоративный градиентный бордер для контейнера */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-primary);
    z-index: 1;
}

/* ===== ЗАГОЛОВКИ С ГРАДИЕНТАМИ ===== */
h1, h2, h3, h4, h5 { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 2em 0 1em 0;
    line-height: 1.3;
    position: relative;
}

h1 {
    font-size: 3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--gradient-secondary);
    border-radius: 2px;
}

h2 {
    font-size: 2.2rem;
    color: var(--text-primary);
    background: linear-gradient(90deg, var(--primary-color), transparent);
    padding: 10px 20px;
    border-left: 5px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    margin-left: -25px;
}

h3 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    padding-left: 10px;
    border-left: 3px solid var(--secondary-color);
}

h4 {
    font-size: 1.4rem;
    color: var(--accent-color);
}

/* ===== ТЕКСТ И ССЫЛКИ ===== */
p {
    margin-bottom: 1.5em;
    text-align: justify;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: var(--transition-default);
}

a:hover {
    color: var(--accent-color);
}

/* Подчёркивание ссылок при наведении */
a:not(.theme-toggle):hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    border-radius: 1px;
}

/* ===== ИЗОБРАЖЕНИЯ ===== */
figure {
    margin: 25px auto;
    max-width: 100%;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: var(--transition-default);
}

figure:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

figure img { 
    display: block; 
    margin: auto; 
    max-width: 100%; 
    height: auto;
    border-radius: 8px;
}

figcaption { 
    text-align: center;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* ===== СПИСКИ ===== */
ul, ol { 
    display: block;
    margin: 25px 0;
    padding: 25px 30px 25px 50px;
    background: var(--bg-secondary);
    border-left: 5px solid var(--success-color);
    border-radius: 0 12px 12px 0;
    transition: var(--transition-default);
}

ul:hover, ol:hover {
    border-left-color: var(--accent-color);
}

/* Стили для UL списков (ненумерованные) */
ul {
    list-style-type: none;
}

ul li {
    text-align: left;
    margin-bottom: 12px;
    padding-left: 10px;
    color: var(--text-secondary);
    position: relative;
}

ul li::before {
    content: '•';
    position: absolute;
    left: -25px;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2em;
}

/* Стили для OL списков (нумерованные) */
ol {
    list-style-type: none;
    counter-reset: item;
    padding-left: 40px;
}

ol li {
    counter-increment: item;
    text-align: left;
    margin-bottom: 12px;
    padding-left: 10px;
    color: var(--text-secondary);
    position: relative;
}

ol li::before {
    content: counter(item) '.';
    position: absolute;
    left: -30px;
    color: var(--primary-color);
    font-weight: bold;
    min-width: 25px;
    text-align: right;
}

/* Для вложенных OL списков (уровень 2) */
ol ol {
    counter-reset: subitem;
    margin-left: 15px;
    padding-left: 40px;
    background: var(--bg-tertiary);
}

ol ol li {
    counter-increment: subitem;
}

ol ol li::before {
    content: counter(item) '.' counter(subitem) '.';
    left: -40px;
    color: var(--secondary-color);
}

/* Для вложенных UL списков внутри OL */
ol ul {
    margin-left: 15px;
    padding-left: 40px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--border-color);
}

ol ul li::before {
    content: '◦';
    color: var(--secondary-color);
    left: -25px;
    font-size: 1.1em;
}

/* Для UL списков внутри UL (вложенные ненумерованные) */
ul ul {
    margin-left: 15px;
    padding-left: 40px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--border-color);
}

ul ul li::before {
    content: '○';
    color: var(--secondary-color);
    left: -25px;
    font-size: 1em;
}

/* ===== ТАБЛИЦЫ ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: var(--transition-default);
}

table:hover {
    transform: translateY(-3px);
    box-shadow: var(--hover-shadow);
}

table th, table td { 
    text-align: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

thead {
    background: var(--gradient-primary);
}

th {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

tbody tr {
    background: var(--bg-primary);
    transition: var(--transition-default);
}

tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

tbody tr:hover {
    background: var(--bg-tertiary);
    transform: scale(1.01);
}

caption {
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--text-primary);
    caption-side: top;
    font-size: 1.2rem;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

/* ===== БЛОК ЦИТАТЫ ===== */
blockquote {
    background: var(--bg-secondary);
    border-left: 5px solid var(--primary-color);
    padding: 25px;
    margin: 30px 0;
    font-style: italic;
    border-radius: 0 12px 12px 0;
    position: relative;
    box-shadow: 0 5px 15px var(--shadow-color);
}

blockquote::before {
    content: '"';
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.2;
    font-family: Georgia, serif;
}

blockquote::after {
    content: '"';
    position: absolute;
    bottom: -20px;
    right: 15px;
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.2;
    font-family: Georgia, serif;
}

/* ===== НАВИГАЦИЯ И ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ===== */
.quick-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    display: flex;
    gap: 15px;
    align-items: center;
    transition: var(--transition-default);
}

.theme-toggle {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-default);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.quick-nav a {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 25px;
    transition: var(--transition-default);
}

.quick-nav a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ JS-ФУНКЦИЙ ===== */

/* Анимация для переключения темы */
@keyframes themeSwitch {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.theme-switching {
    animation: themeSwitch 0.5s ease;
}

/* Стили для уведомлений */
.theme-notification {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: var(--gradient-primary) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
    z-index: 9999 !important;
    box-shadow: var(--hover-shadow) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    opacity: 0;
    transition: opacity 0.3s ease !important;
}

/* ===== МЕДИА-ЗАПРОСЫ ДЛЯ АДАПТИВНОСТИ ===== */

/* Планшеты и десктопы */
@media (min-width: 768px) {
    figure {
        float: right;
        max-width: 50%;
        margin: 0 0 20px 30px;
    }
    
    h2 {
        margin-left: 0;
    }
}

/* Мобильные устройства */
@media (max-width: 767px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
        padding: 8px 15px;
        margin-left: -15px;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    .quick-nav {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    ul, ol {
        padding: 20px 25px 20px 40px;
    }
    
    table th, table td {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .quick-nav {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    ul, ol {
        padding: 15px 20px 15px 35px;
    }
}

/* Улучшение таблиц для мобильных */
@media (max-width: 767px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Плавные переходы для всех элементов при смене темы */
* {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}



