/**
 * KB CUSTOM HEADER STYLES
 * Peptide Sciences inspired header design
 * Two-row boxed layout with left/right menu navigation
 */

/* ============================================================================
   HEADER CONTAINER & LAYOUT
   ========================================================================= */

.kb-header {
    position: relative;
    width: 100%;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.kb-header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================================
   TOP HEADER BAR (Logo | Search | Actions)
   ========================================================================= */

.kb-header-top {
    border-bottom: 1px solid #E5E7EB;
    padding: 12px 0;
}

.kb-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* LOGO */
.kb-logo {
    flex-shrink: 0;
}

.kb-logo a {
    display: block;
    text-decoration: none;
}

.kb-logo img {
    display: block;
    max-width: 300px;
    height: 40px;
    object-fit: contain;
}

.kb-text-logo span {
    font-size: 24px;
    font-weight: 700;
    color: #212223;
    text-decoration: none;
}

/* SEARCH BAR */
.kb-search-bar {
    flex: 1;
    max-width: 600px;
}

.kb-search-form {
    position: relative;
    width: 100%;
}

.kb-search-input {
    width: 100%;
    padding: 10px 40px 10px 16px !important;
    border: 1px solid #E5E7EB !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    outline: none !important;
    transition: border-color 0.2s ease;
    background: #ffffff !important;
}

.kb-search-input:focus {
    border-color: #E84B19 !important;
}

.kb-search-submit {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    padding: 0 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6B7280;
    transition: color 0.2s ease;
}

.kb-search-submit:hover {
    color: #E84B19;
}

.kb-search-submit svg {
    display: block;
}

/* HEADER ACTIONS (Account & Cart) */
.kb-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.kb-action-link {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    text-decoration: none !important;
    color: #212223 !important;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.kb-action-link:hover {
    background-color: #F3F4F6;
    color: #E84B19 !important;
}

.kb-action-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.kb-cart-link {
    position: relative;
}

.kb-cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #E84B19;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============================================================================
   NAVIGATION BAR (Left Menu | Right Menu)
   ========================================================================= */

.kb-navigation {
    background: #ffffff;
    border-bottom: 1px solid #E5E7EB;
    min-height: 56.4px;
}

.kb-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56.4px;
}

.kb-nav-left,
.kb-nav-right {
    display: flex;
    align-items: center;
}

/* MENU STYLES */
.kb-menu {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.kb-menu li {
    margin: 0;
    padding: 0;
    position: relative;
}

.kb-menu > li > a {
    display: block;
    padding: 18px 0;
    color: #212223 !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 400;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.kb-menu > li > a:hover,
.kb-menu > li.current-menu-item > a,
.kb-menu > li.current-menu-ancestor > a {
    color: #E84B19 !important;
}

/* DROPDOWN MENUS */
.kb-menu li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    vertical-align: middle;
}

.kb-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    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: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    z-index: 1000;
}

.kb-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kb-menu .sub-menu li {
    width: 100%;
}

.kb-menu .sub-menu li a {
    display: block !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    color: #212223 !important;
    transition: all 0.2s ease;
}

.kb-menu .sub-menu li a:hover {
    background-color: #F3F4F6;
    color: #E84B19 !important;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ========================================================================= */

@media (max-width: 1200px) {
    .kb-header-container {
        padding: 0 16px;
    }

    .kb-search-bar {
        max-width: 400px;
    }

    .kb-menu {
        gap: 24px;
    }
}

@media (max-width: 1024px) {
    .kb-menu {
        gap: 20px;
    }

    .kb-menu > li > a {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .kb-header-row {
        flex-wrap: wrap;
    }

    .kb-logo {
        order: 1;
    }

    .kb-header-actions {
        order: 2;
        gap: 8px;
    }

    .kb-action-link span {
        display: none;
    }

    .kb-action-link {
        padding: 8px;
    }

    .kb-search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 12px;
    }

    /* Hide desktop navigation on mobile */
    .kb-navigation {
        display: none;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ========================================================================= */

.kb-header a:focus {
    outline: 2px solid #E84B19;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #212223;
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* ============================================================================
   STICKY HEADER SUPPORT
   ========================================================================= */

.kb-header.sticky {
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   PRINT STYLES
   ========================================================================= */

@media print {
    .kb-header {
        position: static;
    }

    .kb-header-actions,
    .kb-navigation {
        display: none;
    }
}
