/*
 * KP.ru Header Styles for WordPress Integration
 * Version: 1.0
 *
 * Этот файл содержит все стили для хедера в стиле KP.ru
 * Подключите этот файл к вашей WordPress теме
 */

/* Import Roboto Font */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* KP.ru Header Styles */
.kp-header {
    font-family: 'Roboto', sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: white;
    transition: box-shadow 0.2s ease;
    border-bottom: 1px solid #e5e7eb;
}

.kp-header.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.kp-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.kp-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 102px;
}

/* Logo Styles */
.kp-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.kp-logo:hover {
    text-decoration: none;
    color: inherit;
}

.kp-logo-icon {
    width: 32px;
    height: 32px;
    margin-right: 8px;
    flex-shrink: 0;
}

.kp-logo-text {
    display: flex;
    flex-direction: column;
}

.kp-logo-text-main {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
    letter-spacing: -0.02em;
}

.kp-logo-text-sub {
    font-size: 12px;
    color: #6b7280;
    line-height: 1;
    margin-top: 2px;
}

/* Navigation Styles */
.kp-nav {
    display: none;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .kp-nav {
        display: flex;
    }
}

.kp-nav-item {
    position: relative;
}

.kp-nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.kp-nav-link:hover {
    color: #1f2937;
    text-decoration: none;
    background-color: #f3f4f6;
}

.kp-nav-link.sale {
    color: #dc2626;
}

.kp-nav-link.sale:hover {
    color: #b91c1c;
}

/* Dropdown Styles */
.kp-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    width: 256px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.kp-nav-item:hover .kp-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kp-dropdown-link {
    display: block;
    padding: 8px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.kp-dropdown-link:hover {
    background-color: #f9fafb;
    color: #1f2937;
    text-decoration: none;
}

/* Search Styles */
.kp-search {
    display: none;
    align-items: center;
}

@media (min-width: 1024px) {
    .kp-search {
        display: flex;
    }
}

.kp-search-wrapper {
    position: relative;
}

.kp-search-input {
    width: 256px;
    padding: 8px 16px 8px 40px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    transition: all 0.2s ease;
}

.kp-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.kp-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
}

/* Mobile Controls */
.kp-mobile-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .kp-mobile-controls {
        display: none;
    }
}

.kp-mobile-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.kp-mobile-btn:hover {
    background-color: #f9fafb;
    color: #374151;
}

/* Mobile Menu */
.kp-mobile-menu {
    display: none;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0;
}

.kp-mobile-menu.active {
    display: block;
}

.kp-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kp-mobile-nav-item {
    display: block;
}

.kp-mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.kp-mobile-nav-link:hover {
    background-color: #f9fafb;
    text-decoration: none;
    color: #1f2937;
}

.kp-mobile-nav-link.sale {
    color: #dc2626;
}

.kp-mobile-nav-link.sale:hover {
    color: #b91c1c;
}

.kp-mobile-dropdown {
    padding-left: 1rem;
    margin-top: 8px;
    display: none;
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 8px 0;
}

.kp-mobile-dropdown.active {
    display: block;
}

.kp-mobile-dropdown-link {
    display: block;
    padding: 8px 16px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    margin: 2px 8px;
    transition: background-color 0.2s ease;
}

.kp-mobile-dropdown-link:hover {
    background-color: white;
    color: #374151;
    text-decoration: none;
}

/* Content padding to account for fixed header */
body {
    padding-top: 102px !important;
}

/* WordPress admin bar adjustments */
body.admin-bar {
    padding-top: 134px !important; /* 102px header + 32px admin bar */
}

body.admin-bar .kp-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar {
        padding-top: 148px !important; /* 102px header + 46px admin bar on mobile */
    }

    body.admin-bar .kp-header {
        top: 46px;
    }
}

/* Chevron icon animations */
.chevron-down {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.chevron-down.rotated {
    transform: rotate(180deg);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .kp-header-container {
        padding: 0 0.75rem;
    }

    .kp-logo-text-main {
        font-size: 16px;
    }

    .kp-logo-text-sub {
        font-size: 11px;
    }

    .kp-logo-icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .kp-header-content {
        height: 102px;
    }

    body {
        padding-top: 102px !important;
    }

    body.admin-bar {
        padding-top: 148px !important;
    }

    .kp-logo-text-main {
        font-size: 14px;
    }

    .kp-logo-text-sub {
        font-size: 10px;
    }

    .kp-logo-icon {
        width: 24px;
        height: 24px;
        margin-right: 6px;
    }
}

/* Theme compatibility fixes */
.kp-header * {
    box-sizing: border-box;
}

/* Ensure proper z-index hierarchy */
.kp-header {
    z-index: 9999;
}

/* Fix for potential conflicts with theme styles */
.kp-header,
.kp-header * {
    font-family: 'Roboto', sans-serif !important;
}

.kp-header a {
    text-decoration: none;
}

.kp-header a:hover {
    text-decoration: none;
}

/* Animation for dropdown reveal */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kp-dropdown {
    animation: fadeInUp 0.2s ease-out;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Print styles */
@media print {
    .kp-header {
        display: none;
    }

    body {
        padding-top: 0 !important;
    }
}
