/* Category Navigation Styles */
.category-nav-wrapper {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 72px; /* Header height - должен точно совпадать с высотой header */
    z-index: 150;
    display: none; /* Hidden on mobile by default */
    transition: box-shadow 0.3s;
    margin-top: 0; /* Убираем любые отступы сверху */
}

.category-nav-wrapper.scrolled {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (min-width: 768px) {
    .category-nav-wrapper {
        display: block;
    }
}

/* Removed nav-quick-links media query */

.category-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    padding: 0 20px;
}

.category-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
}

/* Categories Button */
.categories-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    transition: all 0.2s;
    position: relative;
}

.categories-btn:hover {
    color: #2563eb;
}

.categories-btn.active {
    color: #2563eb;
}

.categories-btn svg {
    width: 18px;
    height: 18px;
}

.categories-btn .chevron {
    transition: transform 0.2s;
}

.categories-btn.active .chevron {
    transform: rotate(180deg);
}

/* Hover zone to prevent menu from closing */
.categories-hover-zone {
    display: inline-block;
    position: relative;
}

.categories-hover-zone::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
    pointer-events: none;
}

/* Country Switcher */
.country-switcher-wrapper {
    position: relative;
    margin-left: auto;
    margin-right: 12px;
}

.country-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    transition: all 0.2s;
}

.country-btn:hover {
    color: #2563eb;
}

.country-btn.active {
    color: #2563eb;
}

.country-btn .country-flag {
    font-size: 18px;
    line-height: 1;
}

.country-btn .country-name-btn {
    font-weight: 500;
    font-size: 13px;
}

.country-btn .chevron {
    transition: transform 0.2s;
    width: 14px;
    height: 14px;
}

.country-btn.active .chevron {
    transform: rotate(180deg);
}

.country-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 250;
    max-height: 450px;
    overflow-y: auto;
}

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

.country-dropdown-header {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: #111827;
    text-decoration: none;
    transition: background 0.2s;
}

.country-option:hover {
    background: #f3f4f6;
}

.country-option.active {
    color: #2563eb;
    font-weight: 500;
    background: #eff6ff;
}

.country-option .country-flag {
    font-size: 18px;
    line-height: 1;
}

.country-option .country-name {
    flex: 1;
}

/* Language Switcher */
.language-switcher-wrapper {
    position: relative;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    transition: all 0.2s;
}

.language-btn:hover {
    color: #2563eb;
}

.language-btn.active {
    color: #2563eb;
}

.language-btn svg {
    width: 18px;
    height: 18px;
}

.language-btn .chevron {
    transition: transform 0.2s;
}

.language-btn.active .chevron {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 250;
    overflow: hidden;
}

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

.language-option {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: #111827;
    text-decoration: none;
    transition: background 0.2s;
}

.language-option:hover {
    background: #f3f4f6;
}

.language-option.active {
    color: #2563eb;
    font-weight: 500;
    background: #eff6ff;
}

/* Mega Menu */
.category-mega-menu {
    position: absolute;
    top: calc(100% - 1px);
    left: -20px;
    right: -20px;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: opacity 0.15s ease, visibility 0s linear 0s;
    z-index: 200;
    margin-top: 0;
}

.category-mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.15s ease, visibility 0s linear 0s;
}

/* Улучшаем плавность открытия мега-меню */
.categories-hover-zone {
    padding-bottom: 10px;
}

.mega-menu-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 0 0;
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 500px;
    max-height: 85vh;
    overflow: hidden;
}

/* Left Sidebar Categories */
.mega-menu-sidebar {
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    padding: 4px 0;
    overflow-y: auto;
    max-height: calc(85vh - 20px);
    overscroll-behavior: contain;
}

.mega-menu-sidebar::-webkit-scrollbar {
    width: 4px;
}

.mega-menu-sidebar::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.mega-menu-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.mega-menu-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.sidebar-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 18px;
    color: #374151;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    position: relative;
}

.sidebar-category:hover,
.sidebar-category.active {
    background: #e5e7eb;
    color: #111827;
}

.sidebar-category-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-category-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

.sidebar-category svg {
    width: 16px;
    height: 16px;
    color: #9ca3af;
}

/* Right Content Area */
.mega-menu-main {
    padding: 16px 24px;
    display: none;
    overflow-y: auto;
    max-height: 85vh;
}

.mega-menu-main.active {
    display: block;
}

.mega-menu-category-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.mega-menu-subcategories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
    align-items: start;
}

.mega-menu-subcategories::-webkit-scrollbar {
    width: 6px;
}

.mega-menu-subcategories::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.mega-menu-subcategories::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.mega-menu-subcategories::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.mega-menu-subcat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.mega-menu-subcat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: #2563eb;
    transition: height 0.2s;
}

.mega-menu-subcat:hover {
    background: #f3f4f6;
    color: #2563eb;
    padding-left: 10px;
}

.mega-menu-subcat:hover::before {
    height: 50%;
}

.mega-menu-subcat-name {
    font-weight: 500;
}

.mega-menu-subcat-count {
    color: #9ca3af;
    font-size: 12px;
}

/* Category images in mega menu */
.mega-menu-subcat-with-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 8px;
    min-height: 140px;
}

.mega-menu-subcat-with-image .mega-menu-subcat-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mega-menu-subcat-with-image .mega-menu-subcat-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.mega-menu-subcat-with-image .mega-menu-subcat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mega-menu-subcat-with-image .mega-menu-subcat-name {
    font-size: 15px;
    font-weight: 500;
}

.mega-menu-subcat-with-image:hover {
    background: #f9fafb;
    border-radius: 8px;
}

.mega-menu-subcat-with-image:hover .mega-menu-subcat-image {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Featured Products Section */
.mega-menu-featured {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Hot Badge */
.hot-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    margin-left: 4px;
    animation: pulse 2s infinite;
}

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

.new-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 4px;
    background: #10b981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    margin-left: 4px;
}

.mega-menu-featured-title {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 16px;
}

.mega-menu-featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.mega-menu-featured-item {
    text-align: center;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
}

.mega-menu-featured-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Overlay */
.category-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 99;
}

.category-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* RTL Support */
.rtl-content .category-nav {
    direction: rtl;
}

.rtl-content .categories-btn svg,
.rtl-content .sidebar-category svg {
    transform: scaleX(-1);
}

.rtl-content .categories-btn.active .chevron {
    transform: rotate(180deg) scaleX(-1);
}

.rtl-content .mega-menu-content {
    grid-template-columns: 1fr 300px;
}

.rtl-content .mega-menu-sidebar {
    border-right: none;
    border-left: 1px solid #e5e7eb;
}

.rtl-content .sidebar-category-left {
    flex-direction: row-reverse;
}

.rtl-content .mega-menu-subcat-with-image {
    text-align: center;
}

/* Loading state */
.category-nav-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #2563eb;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .mega-menu-content {
        max-width: 100%;
    }
}

/* Smooth transitions */
* {
    -webkit-tap-highlight-color: transparent;
}


/* About link in nav */
.nav-about-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.nav-about-link:hover {
    background: #f3f4f6;
    color: #1a3a5c;
}
@media (max-width: 768px) {
    .nav-about-link { display: none; } /* shown in mobile menu instead */
}
