/* ==========================================================================
   1. ПЕРЕМЕННЫЕ И ЦВЕТОВЫЕ ПАЛИТРЫ (ТЕМЫ)
   ========================================================================== */
:root {
    --bg-gradient: linear-gradient(135deg, #020617 0%, #09112e 50%, #02040a 100%);
    --header-bg: rgba(9, 15, 35, 0.85);
    --card-bg: rgba(15, 23, 42, 0.55);
    --inner-bg: rgba(9, 15, 35, 0.6);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --border: rgba(56, 189, 248, 0.15);
    --shadow: rgba(0, 0, 0, 0.7);
    --glass-blur: blur(16px);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #f0fdfa 0%, #e0e7ff 50%, #f8fafc 100%);
    --header-bg: rgba(255, 255, 255, 0.9);
    --card-bg: rgba(255, 255, 255, 0.75);
    --inner-bg: rgba(241, 245, 249, 0.9);
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-white: #0f172a;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.2);
    --border: rgba(37, 99, 235, 0.15);
    --shadow: rgba(99, 102, 241, 0.08);
}

/* ==========================================================================
   2. СБРОС И БАЗОВЫЕ НАСТРОЙКИ
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-gradient);
    background-size: 200% 200%;
    animation: gradientAnimation 12s ease infinite;
    overflow-x: hidden;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex-grow: 1;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--accent-hover);
}

/* Скрытие по умолчанию для SPA */
.page-section {
    display: none;
}
.page-section.active-page {
    display: grid; /* или block в зависимости от скрипта */
}

/* ==========================================================================
   3. ХЕДЕР (ШАПКА) И КНОПКА МЕНЮ
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    padding: 12px 25px;
    box-shadow: 0 4px 30px var(--shadow);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h2 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-white);
    user-select: none;
    line-height: 1.2;
}

.logo span {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 15px;
}

.main-nav a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 15px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    cursor: pointer;
    display: inline-block;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--text-white);
    background: rgba(56, 189, 248, 0.1);
    box-shadow: inset 0 0 8px rgba(56, 189, 248, 0.05);
}

.mobile-menu-toggle {
    display: none;
    background: var(--inner-bg);
    border: 1px solid var(--border);
    color: var(--text-white);
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ==========================================================================
   4. ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
   ========================================================================== */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 32px;
    position: relative;
    width: 62px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #1e293b;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.slider-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    box-sizing: border-box;
    pointer-events: none;
}

.slider-icons svg {
    width: 14px;
    height: 14px;
    z-index: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.icon-sun {
    color: #f59e0b;
    opacity: 0.2;
    transform: scale(0.8);
}

.icon-moon {
    color: #38bdf8;
    opacity: 1;
}

.slider:before {
    background-color: #ffffff;
    bottom: 3px;
    content: "";
    height: 24px;
    left: 3px;
    position: absolute;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

input:checked + .slider {
    background-color: #e2e8f0;
}

input:checked + .slider:before {
    transform: translateX(30px);
    background-color: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

input:checked + .slider .icon-sun {
    opacity: 1;
    transform: scale(1);
}

input:checked + .slider .icon-moon {
    opacity: 0.2;
    transform: scale(0.8);
}

/* ==========================================================================
   5. ОСНОВНОЙ МАКЕТ (LAYOUT)
   ========================================================================== */
.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 25px;
    margin-top: 10px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-sticky {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card, .menu-group, .subcategories-box, .scroll-section, .grid-item {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 8px 32px var(--shadow);
}

.sidebar-left h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 5px;
    color: var(--accent);
    opacity: 0.9;
}

.menu-group {
    padding: 0;
    overflow: hidden;
    margin-bottom: 12px;
}

.menu-group summary {
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid transparent;
    user-select: none;
}

.menu-group[open] summary {
    border-bottom-color: var(--border);
}

.menu-group summary::-webkit-details-marker {
    display: none;
}

.menu-group summary::after {
    content: "▼";
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.menu-group[open] summary::after {
    transform: rotate(-180deg);
}

.menu-group-content {
    padding: 12px 15px;
}

.menu-group ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-group li a {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14.5px;
    transition: all 0.25s ease;
}

.menu-group li a:hover, .menu-group li a.active-link {
    color: var(--text-white);
    background: rgba(56, 189, 248, 0.08);
    padding-left: 18px;
    border-left: 3px solid var(--accent);
}

.mobile-sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1001;
}

.mobile-search-container {
    display: none;
    margin-bottom: 15px;
}

/* ==========================================================================
   6. ОБЛАСТЬ КОНТЕНТА И СЛАЙДЫ
   ========================================================================== */
.content-area {
    min-height: 500px;
}

.step-slide {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-slide.active-slide {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-slide h1 {
    font-size: 32px;
    line-height: 1.25;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-white), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.step-slide h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 25px 0 15px 0;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.3;
}

.step-slide p {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-main);
    opacity: 0.95;
    line-height: 1.7;
}

.step-slide ul, .step-slide ol {
    margin-left: 20px;
    margin-bottom: 24px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-slide li {
    font-size: 15.5px;
}

.step-slide strong {
    color: var(--text-white);
}

.next-step {
    margin-top: 35px;
    border-top: 1px solid var(--border);
    padding-top: 25px;
    display: flex;
    justify-content: flex-end;
}

.next-btn, .submit-btn, .like-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.next-btn:hover, .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
    filter: brightness(1.1);
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    background: var(--inner-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 40px 14px 16px;
    color: var(--text-white);
    font-size: 14.5px;
    outline: none;
    transition: all 0.3s ease;
    min-height: 46px;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.search-box .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.subcategories-box h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.subcategories-box ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subcategories-box a {
    display: block;
    padding: 10px 12px;
    font-size: 14.5px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.subcategories-box a:hover, .subcategories-box a.active-link {
    background: rgba(56, 189, 248, 0.08);
    color: var(--text-white);
}

/* ==========================================================================
   7. ГАЛЕРЕЯ (КАРТОЧКИ ТЕХНОЛОГИЙ)
   ========================================================================== */
.gallery-header {
    margin-bottom: 30px;
    text-align: center;
}

.gallery-header h1 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.gallery-header p {
    color: var(--text-muted);
    font-size: 16px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.grid-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(56, 189, 248, 0.15);
}

.grid-item h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-white);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.grid-item p {
    color: var(--text-muted);
    font-size: 14.5px;
    margin-bottom: 24px;
    flex-grow: 1;
    line-height: 1.6;
}

.like-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: none;
    align-self: flex-start;
}

.like-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    transform: scale(1.03);
}

/* ==========================================================================
   8. СТРАНИЦА КОНТАКТОВ И ФОРМА
   ========================================================================== */
.contacts-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 25px;
}

.contact-info-card p {
    margin-bottom: 12px;
    font-size: 14.5px;
}

.social-list {
    list-style: none;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    padding: 12px 16px;
    background: var(--inner-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
    min-height: 44px;
}

.social-list a:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.05);
    color: var(--accent);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    background: var(--inner-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-white);
    font-family: inherit;
    font-size: 14.5px;
    outline: none;
    transition: all 0.3s ease;
    min-height: 44px;
}

.form-group textarea {
    resize: vertical;
}

.form-group select option {
    background-color: #0f172a;
    color: #ffffff;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.faq-section {
    margin-top: 35px;
}

.faq-section h2 {
    font-size: 22px;
    color: var(--text-white);
    margin-bottom: 20px;
}

.form-success-alert {
    display: none;
    padding: 15px;
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    font-weight: 600;
    margin-top: 15px;
    text-align: center;
    font-size: 14.5px;
    animation: fadeIn 0.3s ease;
}

/* ==========================================================================
   9. ФУТЕР
   ========================================================================== */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: var(--glass-blur);
    padding: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

/* ==========================================================================
   10. АДАПТИВНОСТЬ
   ========================================================================== */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 240px 1fr;
    }
    .sidebar-right {
        grid-column: span 2;
        margin-top: 15px;
    }
    .sidebar-sticky {
        position: static;
    }
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .sidebar-right {
        grid-column: span 1;
        display: none;
    }
    .mobile-search-container {
        display: block;
    }
    .contacts-layout {
        grid-template-columns: 1fr;
    }
    .mobile-menu-toggle {
        display: flex;
    }
    .main-nav {
        display: none;
    }
    .sidebar-left {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        background: #0f172a;
        z-index: 1002;
        padding: 30px 20px;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    [data-theme="light"] .sidebar-left {
        background: #f8fafc;
    }
    .sidebar-left.open {
        left: 0;
    }
    .mobile-sidebar-close {
        display: block;
    }
    .header-container {
        padding: 4px 0;
    }
}

@media (max-width: 480px) {
    .step-slide h1 {
        font-size: 24px;
    }
    .step-slide h2 {
        font-size: 18px;
    }
    .site-header {
        padding: 10px 15px;
    }
    .logo h2 {
        font-size: 20px;
    }
}