/* Top Bar Styles */
.top-bar {
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.8rem 0;
    font-size: 0.9rem;
}

.top-bar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.top-bar-item i {
    color: var(--primary);
    font-size: 0.9rem;
}

.top-bar-item:hover {
    color: var(--primary);
}

/* Header Styles */
header {
    background: #fff;
    color: var(--light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.logo {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.4s;
    z-index: 1001;
}

.logo a {
    text-decoration: none;
}

.logo:hover {
    opacity: .7;
}

/* Navigation */
nav > ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

nav > ul > li {
    position: relative;
}

nav a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
    padding: 0.5rem 0;
    display: block;
    font-size: 0.95rem;
}

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

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

nav > ul > li > a:hover::before {
    width: 100%;
}

/* Dropdown Menu */
nav ul li.menu-item-has-children > a::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: 8px;
    font-size: 0.8em;
    transition: transform 0.3s;
}

nav ul li.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

nav ul ul {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    list-style: none;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 999;
}

nav ul li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

nav ul ul li {
    width: 100%;
}

nav ul ul a {
    padding: 0.8rem 1.5rem;
    color: #333;
    font-size: 0.9rem;
    border-bottom: none;
}

nav ul ul a::before {
    display: none;
}

nav ul ul a:hover {
    background: #f8f8f8;
    color: var(--primary);
}

/* Submenu 2 уровня */
nav ul ul ul {
    left: 100%;
    top: 0;
    margin-left: 1px;
}

/* Header Icons */
.header-icons {
    display: flex;
    gap: 1.5rem;
    font-size: 1.3rem;
    align-items: center;
}

.header-icons a {
    cursor: pointer;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    position: relative;
}

.header-phone {
    display: none;
}

.header-icons a:hover,
.header-icons span:hover {
    transform: scale(1.1);
}

.header-cart {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Burger Menu */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    gap: 5px;
    z-index: 1001;
}

.burger span {
    width: 25px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: all 0.3s;
}

.burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.burger.active span:nth-child(2) {
    opacity: 0;
}

.burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Tablet Styles */
@media (max-width: 1024px) {
    nav > ul {
        gap: 1.5rem;
    }

    nav a {
        font-size: 0.9rem;
    }
}

/* Mobile Styles */
@media (max-width: 968px) {
    .top-bar {
        display: none;
    }

    .header-content {
        padding: 0 20px;
    }

    .logo {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    .burger {
        display: flex;
    }

    .header-phone {
        display: flex;
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: #fff;
        padding: 80px 0 30px;
        transition: right 0.4s ease;
        box-shadow: -5px 0 30px rgba(0,0,0,0.2);
        overflow-y: auto;
        z-index: 1001;
    }

    nav.active {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
    }

    nav a {
        font-size: 1rem;
        display: block;
        padding: 1rem 30px;
        border-bottom: 1px solid #f0f0f0;
        color: #333;
    }

    nav a:hover {
        background: #f8f8f8;
        color: var(--primary);
    }

    nav > ul > li > a::before {
        display: none;
    }

    /* Mobile Dropdown */
    nav ul li.menu-item-has-children > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    nav ul li.menu-item-has-children > a::after {
        margin-left: auto;
        transition: transform 0.3s;
    }

    nav ul li.menu-item-has-children.open > a::after {
        transform: rotate(180deg);
    }

    nav ul ul {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8f8f8;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-radius: 0;
    }

    nav ul li.menu-item-has-children.open > ul {
        max-height: 1000px;
    }

    nav ul ul a {
        padding: 0.8rem 30px 0.8rem 50px;
        font-size: 0.9rem;
        color: #666;
        background: #f8f8f8;
    }

    nav ul ul a:hover {
        background: #f0f0f0;
        color: var(--primary);
    }

    nav ul ul ul {
        background: #f0f0f0;
    }

    nav ul ul ul a {
        padding-left: 70px;
        background: #f0f0f0;
    }

    nav ul ul ul a:hover {
        background: #e8e8e8;
    }

    .header-icons {
        gap: 1.2rem;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.8rem 0;
    }

    .header-content {
        padding: 0 15px;
    }

    .logo {
        font-size: 1.4rem;
        letter-spacing: 1px;
    }

    nav {
        width: 280px;
    }

    nav a {
        padding: 1rem 20px;
        font-size: 0.95rem;
    }

    nav ul ul a {
        padding: 0.8rem 20px 0.8rem 40px;
    }

    nav ul ul ul a {
        padding-left: 60px;
    }

    .header-icons {
        gap: 1rem;
        font-size: 1.1rem;
    }

    .cart-count {
        font-size: 0.6rem;
        min-width: 16px;
        height: 16px;
    }
}


/* Search Modal - Максимальный приоритет */
body .search-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.9) !important;
    z-index: 99999 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    padding: 20px !important;
}

body .search-modal.active {
    display: flex !important;
    opacity: 1 !important;
}

body .search-modal-content {
    width: 90% !important;
    max-width: 700px !important;
    position: relative !important;
    animation: slideDown 0.4s ease !important;
}

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

body .search-modal .search-close {
    position: absolute !important;
    top: -50px !important;
    right: 0 !important;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 2rem !important;
    cursor: pointer !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
}

body .search-modal .search-close:hover {
    transform: rotate(90deg) !important;
    color: #e74c3c !important;
}

body .search-modal .woocommerce-product-search {
    display: flex !important;
    background: #fff !important;
    border-radius: 50px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    align-items: stretch !important;
}

body .search-modal .woocommerce-product-search label {
    display: none !important;
}

body .search-modal .woocommerce-product-search .search-field,
body .search-modal .woocommerce-product-search input[type="search"] {
    flex: 1 !important;
    padding: 1.2rem 2rem !important;
    border: none !important;
    font-size: 1.1rem !important;
    outline: none !important;
    background: #fff !important;
    color: #333 !important;
    box-shadow: none !important;
    height: auto !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    width: auto !important;
    min-height: 60px !important;
}

body .search-modal .woocommerce-product-search .search-field::placeholder,
body .search-modal .woocommerce-product-search input[type="search"]::placeholder {
    color: #999 !important;
}

body .search-modal .woocommerce-product-search button[type="submit"] {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 1.2rem 2.5rem !important;
    font-size: 1.1rem !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    height: auto !important;
    line-height: 1.5 !important;
    min-width: 120px !important;
    transition: background 0.3s ease !important;
    flex-shrink: 0 !important;
}

body .search-modal .woocommerce-product-search button[type="submit"]:hover {
    background: var(--primary-light) !important;
}

body .search-modal .woocommerce-product-search input[type="hidden"] {
    display: none !important;
}

@media (max-width: 968px) {
    body .search-modal-content {
        width: 95% !important;
    }

    body .search-modal .woocommerce-product-search .search-field {
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
        min-height: 50px !important;
    }

    body .search-modal .woocommerce-product-search button[type="submit"] {
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
        min-width: 80px !important;
    }
}

@media (max-width: 480px) {
    body .search-modal .search-close {
        font-size: 1.5rem !important;
        top: -40px !important;
    }

    body .search-modal .woocommerce-product-search .search-field {
        padding: 0.9rem 1.2rem !important;
        font-size: 0.95rem !important;
    }

    body .search-modal .woocommerce-product-search button[type="submit"] {
        padding: 0.9rem 1rem !important;
        font-size: 0.95rem !important;
        min-width: 70px !important;
    }
}


/* Search Results */
.search-results {
    background: #fff;
    border-radius: 12px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f8f8;
}

.search-result-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
}

.search-result-title {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    line-height: 1.4;
}

.search-result-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.search-no-results,
.search-loading {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 1rem;
}

.search-no-results i,
.search-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    color: #ccc;
}

.search-loading i {
    color: var(--primary);
}

/* Scrollbar для результатов поиска */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Mobile адаптация для результатов */
@media (max-width: 968px) {
    .search-results {
        max-height: 300px;
    }

    .search-result-item {
        padding: 12px 15px;
        gap: 12px;
    }

    .search-result-image {
        width: 50px;
        height: 50px;
    }

    .search-result-title {
        font-size: 0.95rem;
    }

    .search-result-price {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .search-results {
        max-height: 250px;
        margin-top: 15px;
    }

    .search-result-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .search-result-image {
        width: 45px;
        height: 45px;
    }

    .search-result-title {
        font-size: 0.9rem;
    }

    .search-result-price {
        font-size: 0.95rem;
    }

    .search-no-results,
    .search-loading {
        padding: 30px 15px;
        font-size: 0.9rem;
    }

    .search-no-results i,
    .search-loading i {
        font-size: 1.5rem;
    }
}

.header-search-btn {
    font-size: 18px;
    background: none;
    border: none;
    outline: none;

    transition-duration: .5s;
}

.header-search-btn:hover {
    scale: 1.1;
}