/* ========================================
   CSS ПЕРЕМЕННЫЕ ДЛЯ ТЕМ
======================================== */

:root[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: rgba(15, 15, 15, 0.95);
    --bg-card: rgba(220, 38, 38, 0.06);
    --bg-card-hover: rgba(220, 38, 38, 0.12);
    --text-primary: #e8e8e8;
    --text-secondary: #b8b8b8;
    --accent-primary: #dc2626;
    --accent-secondary: #b91c1c;
    --border-color: rgba(220, 38, 38, 0.2);
    --shadow-color: rgba(220, 38, 38, 0.15);
    --gradient-start: rgba(220, 38, 38, 0.08);
    --gradient-end: rgba(185, 28, 28, 0.08);
}

:root[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-card: rgba(220, 38, 38, 0.04);
    --bg-card-hover: rgba(220, 38, 38, 0.08);
    --text-primary: #2a2a2a;
    --text-secondary: #5a5a5a;
    --accent-primary: #dc2626;
    --accent-secondary: #b91c1c;
    --border-color: rgba(220, 38, 38, 0.15);
    --shadow-color: rgba(220, 38, 38, 0.1);
    --gradient-start: rgba(220, 38, 38, 0.05);
    --gradient-end: rgba(185, 28, 28, 0.05);
}

/* ========================================
   БАЗОВЫЕ СТИЛИ
======================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    width: 100%;
    position: relative;
    transition: background 0.5s ease, color 0.5s ease;
}

/* ========================================
   PARALLAX ФОН
======================================== */

.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.parallax-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    will-change: transform;
}

.parallax-layer-1 {
    background: radial-gradient(circle at 20% 50%, var(--gradient-start) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite;
}

.parallax-layer-2 {
    background: radial-gradient(circle at 80% 80%, var(--gradient-end) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite reverse;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* ========================================
   ШАПКА САЙТА
======================================== */

header {
    background: var(--bg-secondary);
    padding: 20px 0;
    box-shadow: 0 4px 20px var(--shadow-color);
    border-bottom: 2px solid var(--accent-primary);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

header.hidden {
    transform: translateY(-100%);
}

header:hover {
    box-shadow: 0 6px 30px var(--shadow-color);
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

/* ========================================
   ЛОГОТИП С SVG СЕРДЦЕМ
======================================== */

.logo {
    font-size: 28px;
    font-weight: bold;
    color: var(--accent-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.heart-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px var(--accent-primary));
    transition: all 0.3s ease;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { 
        transform: scale(1); 
    }
    10%, 30% { 
        transform: scale(1.1); 
    }
    20%, 40% { 
        transform: scale(1); 
    }
}

.logo:hover .heart-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px var(--accent-primary));
}

.logo:hover {
    transform: scale(1.05);
}

/* ========================================
   НАВИГАЦИЯ
======================================== */

nav ul {
    display: flex;
    gap: 40px;
    list-style: none;
}

nav ul li a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    transition: all 0.3s ease;
    position: relative;
    padding: 5px 0;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

nav ul li a:hover {
    color: var(--accent-primary);
}

nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}

nav ul li a.active {
    color: var(--accent-primary);
}

/* ========================================
   МИНИМАЛИСТИЧНЫЙ ПЕРЕКЛЮЧАТЕЛЬ ТЕМ
======================================== */

.theme-toggle-header {
    display: flex;
    gap: 6px;
    align-items: center;
    background: transparent;
    padding: 0;
}

.theme-toggle-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

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

.theme-toggle-btn.active svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

/* Анимация иконок */
.sun-icon {
    animation: rotate-sun 20s linear infinite;
}

@keyframes rotate-sun {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.moon-icon {
    animation: moon-glow 3s ease-in-out infinite;
}

@keyframes moon-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* ========================================
   HERO СЕКЦИЯ КАРТЫ
======================================== */

.map-hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 140px 40px 80px;
    position: relative;
    width: 100%;
}

.map-hero::before {
    content: '🗺️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 400px;
    opacity: 0.03;
    animation: map-rotate 20s linear infinite;
    pointer-events: none;
}

@keyframes map-rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.map-hero-content {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    width: 100%;
}

.map-icon {
    font-size: 120px;
    margin-bottom: 30px;
    animation: map-float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 30px var(--accent-primary));
}

@keyframes map-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.map-hero h1 {
    font-size: 56px;
    margin-bottom: 20px;
    color: var(--accent-primary);
    text-shadow: 0 0 30px var(--shadow-color);
}

.map-subtitle {
    font-size: 22px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========================================
   ОСНОВНОЙ КОНТЕНТ
======================================== */

.map-section {
    padding: 80px 40px;
    position: relative;
    z-index: 1;
}

.map-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   КАРТА BLUEMAP
======================================== */

.map-frame-wrapper {
    position: relative;
    width: 100%;
    height: 700px;
    border: 3px solid transparent;
    border-radius: 20px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 10px 40px var(--shadow-color);
    background-image: 
        linear-gradient(var(--bg-card), var(--bg-card)),
        linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    background-origin: padding-box, border-box;
    background-clip: padding-box, border-box;
}

.map-frame-wrapper:fullscreen {
    border-radius: 0;
    border: none;
}

.bluemap-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.map-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinner-rotate 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spinner-rotate {
    to { transform: rotate(360deg); }
}

.map-loading p {
    font-size: 18px;
    color: var(--text-secondary);
    animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-error {
    text-align: center;
}

.error-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.loading-error p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.loading-error .btn {
    margin-top: 20px;
}

/* ========================================
   КНОПКИ УПРАВЛЕНИЯ КАРТОЙ
======================================== */

.map-controls {
    position: absolute;
    bottom: 15px;
    right: 45px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

.map-control-btn {
    padding: 12px 16px;
    background: var(--bg-secondary);
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.map-control-btn:hover {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 6px 20px var(--shadow-color);
}

.map-control-btn:active {
    transform: scale(0.98);
}

.map-control-btn .icon {
    font-size: 18px;
}

/* ========================================
   КНОПКА "НАВЕРХ"
======================================== */

.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 5px 20px var(--shadow-color);
    transition: all 0.3s ease;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--accent-secondary);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.scroll-to-top .arrow-up {
    display: block;
}

/* ========================================
   КНОПКИ
======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 40px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px var(--shadow-color);
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px var(--shadow-color);
}

/* ========================================
   ФУТЕР
======================================== */

footer {
    background: var(--bg-secondary);
    padding: 60px 40px 30px;
    text-align: center;
    border-top: 2px solid var(--accent-primary);
    position: relative;
    z-index: 1;
    width: 100%;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 20px;
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-weight: bold;
}

.heart-icon-footer {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 5px var(--accent-primary));
    animation: heartbeat 1.5s ease-in-out infinite;
}

.footer-copyright,
.footer-disclaimer {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 15px;
}

.footer-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-info a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer-info a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* ========================================
   СКРОЛЛБАР
======================================== */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
}

/* ========================================
   ВЫДЕЛЕНИЕ ТЕКСТА
======================================== */

::selection {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ========================================
   АДАПТИВ: ПЛАНШЕТЫ
======================================== */

@media (max-width: 1024px) {
    nav {
        padding: 0 30px;
    }

    .logo {
        font-size: 26px;
    }
    
    .heart-icon {
        width: 26px;
        height: 26px;
    }

    .map-hero h1 {
        font-size: 48px;
    }

    .map-subtitle {
        font-size: 20px;
    }

    .map-icon {
        font-size: 100px;
    }

    .map-frame-wrapper {
        height: 600px;
    }
    
    .theme-toggle-btn {
        width: 34px;
        height: 34px;
    }
    
    .theme-toggle-btn svg {
        width: 17px;
        height: 17px;
    }
}

/* ========================================
   АДАПТИВ: МОБИЛЬНЫЕ
======================================== */

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
        position: relative;
    }

    .logo {
        font-size: 24px;
    }
    
    .heart-icon {
        width: 24px;
        height: 24px;
    }

    nav ul {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    nav ul li a {
        font-size: 15px;
    }
    
    /* Переключатель в правом верхнем углу на мобильных */
    .theme-toggle-header {
        position: absolute;
        top: 15px;
        right: 15px;
        gap: 5px;
    }
    
    .theme-toggle-btn {
        width: 32px;
        height: 32px;
    }
    
    .theme-toggle-btn svg {
        width: 16px;
        height: 16px;
    }

    .map-hero {
        padding: 120px 20px 60px;
        min-height: 50vh;
    }

    .map-icon {
        font-size: 80px;
    }

    .map-hero h1 {
        font-size: 36px;
    }

    .map-subtitle {
        font-size: 18px;
    }

    .map-section {
        padding: 60px 20px;
    }

    .map-frame-wrapper {
        height: 500px;
        border-radius: 15px;
    }

    .map-controls {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }

    .map-control-btn {
        padding: 10px 14px;
        font-size: 13px    }

    .btn {
        width: 100%;
        padding: 16px 30px;
        font-size: 16px;
    }

    .scroll-to-top {
        width: 45px;
        height: 45px;
        font-size: 20px;
        bottom: 20px;
    }
}

/* ========================================
   АДАПТИВ: МАЛЕНЬКИЕ МОБИЛЬНЫЕ
======================================== */

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .heart-icon {
        width: 20px;
        height: 20px;
    }

    nav ul li a {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .theme-toggle-header {
        top: 12px;
        right: 12px;
    }
    
    .theme-toggle-btn {
        width: 28px;
        height: 28px;
    }
    
    .theme-toggle-btn svg {
        width: 14px;
        height: 14px;
    }

    .map-hero {
        padding: 100px 15px 50px;
    }

    .map-icon {
        font-size: 60px;
    }

    .map-hero h1 {
        font-size: 28px;
    }

    .map-subtitle {
        font-size: 16px;
    }

    .map-frame-wrapper {
        height: 400px;
        border-radius: 12px;
        border-width: 2px;
    }

    .map-controls {
        bottom: 5px;
        right: 5px;
    }

    .map-control-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .map-control-btn .icon {
        font-size: 14px;
    }

    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }

    .map-loading p {
        font-size: 16px;
    }

    .error-icon {
        font-size: 50px;
    }

    .loading-error p {
        font-size: 16px;
    }

    .scroll-to-top {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    footer {
        padding: 40px 20px 20px;
    }

    .footer-logo {
        font-size: 18px;
    }
    
    .heart-icon-footer {
        width: 18px;
        height: 18px;
    }

    .footer-copyright,
    .footer-disclaimer {
        font-size: 13px;
    }

    .footer-info p {
        font-size: 12px;
    }
}

/* ========================================
   БОЛЬШИЕ ЭКРАНЫ
======================================== */

@media (min-width: 1600px) {
    .map-hero-content,
    .map-container {
        max-width: 1600px;
    }

    .map-hero h1 {
        font-size: 64px;
    }

    .map-icon {
        font-size: 140px;
    }

    .map-frame-wrapper {
        height: 800px;
    }
}

/* ========================================
   УТИЛИТЫ
======================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a:focus,
button:focus {
    outline: 3px solid var(--accent-primary);
    outline-offset: 4px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

.hidden {
    display: none !important;
}

/* ========================================
   ACCESSIBILITY
======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   ДОПОЛНИТЕЛЬНЫЕ ЭФФЕКТЫ
======================================== */

.map-frame-wrapper:hover {
    box-shadow: 0 15px 50px var(--shadow-color), 0 0 30px var(--accent-primary);
}

.map-frame-wrapper:focus-within {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-primary), 0 15px 50px var(--shadow-color);
}

.map-hero {
    animation: heroFadeIn 1s ease-out;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-to-top::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.scroll-to-top:hover::before {
    width: 100%;
    height: 100%;
}

/* ========================================
   ПЛАВНЫЕ ПЕРЕХОДЫ
======================================== */

body,
header,
nav,
footer,
.map-control-btn,
.theme-toggle-btn,
.btn {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-btn,
.theme-toggle-btn svg,
.heart-icon,
.heart-icon-footer {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}