/* ========================================= */
/* 0. FONTS & VARIABLES                      */
/* ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
    --bg-dark: #0B0C10;       /* Основний фон */
    --bg-card: #13141C;       /* Фон елементів */
    --primary: #06b6d4;       /* Основний акцент (Cyan) */
    --primary-glow: rgba(6, 182, 212, 0.5);
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --border-light: rgba(255, 255, 255, 0.1);
    --accent-purple: #7300ff;
}

/* 🔥 ВАЖЛИВО: Глобальний скидання для коректних розмірів */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    margin: 0;
    font-family: 'Inter', sans-serif;
    padding-top: 80px; 
    min-height: 100vh;
    overflow-x: hidden; /* Забороняємо горизонтальний скрол */
    width: 100%;
}

/* ========================================= */
/* 1. DESKTOP NAVBAR                         */
/* ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 1000;
    transition: all 0.3s ease;
    background: transparent;
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background: rgba(11, 12, 16, 0.95);
    backdrop-filter: blur(16px);
    height: 70px;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    gap: 30px;
}

/* --- LOGO --- */
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    flex-shrink: 0;
    width: 220px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 22px;
    box-shadow: 0 0 20px var(--primary-glow);
    color: white;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span { color: var(--primary); }

/* --- CENTER: SEARCH BAR --- */
.center-search-wrapper {
    flex: 1;
    max-width: 700px;
    position: relative;
}

.search-bar-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 6px;
    transition: all 0.3s ease;
    width: 100%;
}

.search-bar-container.focused {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.cat-trigger-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-trigger-btn:hover, .cat-trigger-btn.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.cat-divider {
    width: 1px;
    height: 28px;
    background: var(--border-light);
    margin: 0 8px;
}

.main-search-form {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.search-icon-left {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.main-search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 16px;
    padding: 12px 12px 12px 40px; 
    font-family: 'Inter', sans-serif;
}

.main-search-input::placeholder { color: #6b7280; }

/* --- DROPDOWN PANEL (Base Styles) --- */
.categories-dropdown-panel {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%; 
    min-width: 800px;
    background: rgba(15, 16, 22, 0.98);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.7);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
}

@media (max-width: 1400px) {
    .categories-dropdown-panel {
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
    }
    .categories-dropdown-panel.active {
        transform: translateX(-50%) translateY(0);
    }
}

.categories-dropdown-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0); 
}

@media (min-width: 1401px) {
    .categories-dropdown-panel.active {
        transform: translateY(0);
    }
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

#closeCatBtn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    border-radius: 5px;
    transition: 0.2s;
}
#closeCatBtn:hover { color: white; background: rgba(255,255,255,0.1); }

/* --- RIGHT: ACTIONS & LINKS --- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 30px;
    justify-content: flex-end;
}

.nav-links-simple {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
}

.nav-links-simple a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links-simple a:hover { color: var(--text-main); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px;
    position: relative;
}

.icon-btn:hover { color: var(--text-main); }

.connect-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    padding: 6px 16px 6px 6px;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.connect-btn:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.4);
}

.icon-wrapper {
    width: 32px;
    height: 32px;
    background: rgba(6, 182, 212, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    overflow: hidden;
}

#authText {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* --- OVERLAY --- */
.search-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.search-overlay.active { opacity: 1; visibility: visible; }

/* ========================================= */
/* 2. MOBILE VERSION                         */
/* ========================================= */
.mobile-header, .mobile-menu-overlay { display: none; }

@media (max-width: 1024px) {
    body {
        padding-top: 70px;
    }

    .desktop-nav { display: none; }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px; /* Трохи зменшив паддінг, щоб було більше місця */
        height: 70px;
        background: rgba(11, 12, 16, 0.95); /* Більш непрозорий фон */
        backdrop-filter: blur(10px);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100vw; /* Заборона на ширину більше екрану */
        z-index: 2000;
        border-bottom: 1px solid var(--border-light);
        box-sizing: border-box; /* КРИТИЧНО ВАЖЛИВО: padding входить у width */
    }

    .mobile-logo {
        font-size: 20px;
        font-weight: 700;
        color: white;
        text-decoration: none;
        white-space: nowrap; /* Щоб лого не переносилось */
    }
    .mobile-logo span { color: var(--primary); }
    
    .mobile-actions { 
        display: flex; 
        align-items: center;
        gap: 10px; /* Відступ між елементами */
    }

    .burger-btn {
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        padding: 5px; /* Збільшена зона кліку */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile Drawer */
    .mobile-menu-overlay {
        display: block;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: var(--bg-dark);
        z-index: 2001;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        box-sizing: border-box;
    }
    .mobile-menu-overlay.active { transform: translateX(0); }

    .mobile-menu-content { padding: 24px; }

    .menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 30px;
    }

    .menu-title { font-size: 24px; margin: 0; color: white; }

    .close-menu-btn {
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 24px;
        cursor: pointer;
    }

    /* Mobile Search */
    .mobile-search-form {
        position: relative;
        margin-bottom: 30px;
    }
    .mobile-search-form input {
        width: 100%;
        background: #1A1A1A;
        border: 1px solid #333;
        padding: 14px 20px;
        border-radius: 12px;
        color: white;
        outline: none;
    }
    .mobile-search-form button {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--text-muted);
    }

    /* Mobile Grid */
    .section-title {
        font-size: 14px;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: 15px;
        letter-spacing: 1px;
    }

    .category-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 30px;
    }

    .cat-tile {
        background: rgba(255,255,255,0.03);
        border: 1px solid var(--border-light);
        border-radius: 14px;
        padding: 12px; 
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-decoration: none;
        color: var(--text-muted);
        transition: all 0.2s;
        font-size: 13px; 
        text-align: center;
    }

    .cat-tile .icon-box {
        width: 32px;
        height: 32px;
        background: rgba(6, 182, 212, 0.1);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
        font-size: 14px;
    }

    .cat-tile:active {
        background: rgba(6, 182, 212, 0.1);
        border-color: var(--primary);
        transform: scale(0.98);
    }

    .mobile-bottom-links {
        border-top: 1px solid var(--border-light);
        padding-top: 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .mobile-bottom-links a {
        padding: 12px;
        color: var(--text-muted);
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .mobile-bottom-links a:active {
        background: rgba(255,255,255,0.05);
        color: white;
    }
}