/**
 * Спільна шапка, навігація та splash — одне джерело для всіх сторінок.
 * Підключати після themes.css, перед page-specific CSS.
 */

/* ── Header & navigation ── */
.main-header {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--border-accent);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

body.page-radio-map .main-header {
    z-index: 2000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    animation: sl-fadeInUp 1s ease-out 0.9s both;
}

.main-logo {
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent-primary) 35%, transparent));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.main-logo:hover {
    filter: drop-shadow(0 0 20px color-mix(in srgb, var(--accent-primary) 60%, transparent));
    transform: scale(1.05);
}

.main-header h1 {
    margin: 0;
    font-size: 1.8rem;
    background: var(--text-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.main-navigation {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-btn {
    width: 35px;
    height: 35px;
    position: relative;
    cursor: pointer;
    transition: all 0.5s ease-in-out;
    z-index: 1001;
    background: none;
    border: none;
    padding: 0;
}

.menu-btn .line {
    width: 25px;
    height: 3px;
    background: var(--accent-primary);
    display: block;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    border-radius: 2px;
    box-shadow: 0 2px 5px color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

.menu-btn.active .line--1 {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-btn.active .line--2 {
    opacity: 0;
}

.menu-btn.active .line--3 {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nav-links {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    min-width: 250px;
    border-radius: 15px;
    box-shadow: var(--shadow-card);
    border: 2px solid var(--border-accent);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    padding: 15px 0;
    margin-top: 10px;
    z-index: 1002;
}

body.page-radio-map .nav-links {
    z-index: 2003;
}

.nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-links .link {
    display: block;
    padding: 12px 25px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.nav-links .link:hover {
    background: var(--nav-link-hover);
    border-left-color: var(--accent-primary);
    color: var(--text-accent);
    transform: translateX(5px);
}

.nav-links .link.active {
    background: var(--panel-bg-soft, var(--bg-button));
    border-left-color: var(--accent-primary);
    color: var(--text-accent);
}

@media (max-width: 768px) {
    .header-container {
        justify-content: space-between;
        gap: 15px;
        padding: 15px;
    }

    .main-header h1 {
        font-size: 1.5rem;
    }

    .nav-links {
        min-width: 220px;
        right: -10px;
    }

    .nav-links .link {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
    }

    .main-navigation {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .nav-links {
        right: 0;
        left: 0;
        margin: 10px 20px 0;
        min-width: auto;
    }
}

/* ── Splash screen ── */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-splash);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    color: var(--text-primary);
    animation: sl-fadeInUp 0.8s ease;
}

.logo-animation {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.splash-logo {
    animation: sl-logoFloat 3s ease-in-out infinite, sl-logoRotate 8s linear infinite;
    filter: drop-shadow(0 0 30px color-mix(in srgb, var(--accent-primary) 55%, transparent));
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    border: 2px solid color-mix(in srgb, var(--accent-primary) 40%, transparent);
    border-radius: 50%;
    animation: sl-pulse 2s ease-out infinite;
}

.pulse-ring-delay {
    animation-delay: 1s;
}

.splash-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 20px 0;
    background: var(--text-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: sl-dotBounce 1.4s ease-in-out infinite both;
    box-shadow: 0 0 15px color-mix(in srgb, var(--accent-primary) 45%, transparent);
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes sl-fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes sl-logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

@keyframes sl-logoRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes sl-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

@keyframes sl-dotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .splash-logo {
        width: 100px;
        height: 100px;
    }

    .pulse-ring {
        width: 140px;
        height: 140px;
    }

    .splash-title {
        font-size: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-logo,
    .pulse-ring,
    .logo-container,
    .splash-content,
    .loading-dots span {
        animation: none !important;
    }
}

/* Підказка для режиму file:// */
.file-protocol-hint {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-secondary, #1a1a2e) 92%, #000);
    border: 1px solid var(--accent-primary, #00d4ff);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-primary, #e2e8f0);
}

.file-protocol-hint p {
    margin: 0;
    flex: 1;
}

.file-protocol-hint code {
    font-size: 0.8125rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--accent-primary, #00d4ff) 15%, transparent);
}

.file-protocol-hint-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.file-protocol-hint-close:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--text-primary, #fff) 10%, transparent);
}

/* Спільний футер (версія, дата, зворотний зв'язок) */
.site-footer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    padding: 28px 20px;
    margin-top: 40px;
    background: color-mix(in srgb, var(--bg-secondary, #1e1e2e) 88%, transparent);
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
}

.site-footer-inner p {
    margin: 6px 0;
}

.site-footer-contact a {
    color: var(--accent-primary, #00d4ff);
    text-decoration: none;
    font-weight: 600;
}

.site-footer-contact a:hover {
    text-decoration: underline;
}

.site-footer-meta {
    font-size: 0.85rem;
    opacity: 0.9;
}

.page-radio-map-footer {
    margin-top: 0;
    padding: 14px 16px;
    font-size: 0.82rem;
    position: relative;
    z-index: 1;
}

.license-user-bar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted, #94a3b8);
}

.license-user-bar button {
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: inherit;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.8rem;
}

.license-user-bar button:hover {
    border-color: #03DAC6;
    color: #03DAC6;
}

.license-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.85rem;
    background: #78350f;
    color: #fef3c7;
}

html.license-pending body {
    visibility: hidden;
}
