/**
 * Kelles Theme - Enhanced Header Styles
 * Matching the design language used in dashboard, shop, and category pages
 */

/* Body spacing for fixed navbar and topbar */
body.has-fixed-navbar {
    /* Add padding to account for the combined height of topbar + navbar */
    padding-top: 110px; /* Adjusted to match exact combined heights */
}

/* Top Header Styles */
.top-header {
    background: var(--kelles-dark, #202124) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    transition: var(--kelles-transition, all 0.3s ease);
    /* Position the top header fixed at the top of the page */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    height: auto; /* Allow natural height */
    display: flex;
    align-items: center;
}

.top-header a {
    transition: var(--kelles-transition, all 0.3s ease);
}

.top-header a:hover {
    opacity: 0.85;
}

/* Contact Info Styles */
.contact-info a {
    display: inline-flex;
    align-items: center;
    padding: 2px 0;
}

.contact-info a i {
    font-size: 14px;
    margin-right: 5px;
}

/* WhatsApp CTA Button */
.whatsapp-cta {
    background-color: #25D366 !important;
    border-color: #25D366 !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 16px;
    box-shadow: var(--kelles-shadow, 0 4px 6px rgba(37, 211, 102, 0.25));
    transition: var(--kelles-transition, all 0.3s ease);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.whatsapp-cta:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
    z-index: -1;
}

.whatsapp-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(37, 211, 102, 0.35);
}

.whatsapp-cta:hover:before {
    transform: translateX(0);
}

.whatsapp-cta i {
    font-size: 16px;
    margin-right: 4px;
}

/* Social Media Icons */
.social-links {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.social-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    transition: var(--kelles-transition, all 0.3s ease);
    position: relative;
    overflow: hidden;
    margin: 0 2px;
    color: white;
    text-decoration: none;
}

.social-icon:hover {
    transform: translateY(-2px);
    background-color: var(--kelles-primary, #4285f4);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.social-icon i {
    font-size: 14px;
    position: relative;
    z-index: 1;
    color: white !important;
}

/* Facebook */
.social-icon:nth-child(1):hover {
    background-color: #1877F2;
    box-shadow: 0 4px 8px rgba(24, 119, 242, 0.4);
}

/* Instagram */
.social-icon:nth-child(2):hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    box-shadow: 0 4px 8px rgba(220, 39, 67, 0.4);
}

/* Twitter */
.social-icon:nth-child(3):hover {
    background-color: #1DA1F2;
    box-shadow: 0 4px 8px rgba(29, 161, 242, 0.4);
}

/* LinkedIn */
.social-icon:nth-child(4):hover {
    background-color: #0A66C2;
    box-shadow: 0 4px 8px rgba(10, 102, 194, 0.4);
}

/* YouTube */
.social-icon:nth-child(5):hover {
    background-color: #FF0000;
    box-shadow: 0 4px 8px rgba(255, 0, 0, 0.4);
}

/* Pinterest */
.social-icon:nth-child(6):hover {
    background-color: #E60023;
    box-shadow: 0 4px 8px rgba(230, 0, 35, 0.4);
}

/* Main Header Enhancements */
.h__top {
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.site-logo img {
    max-height: 60px;
    transition: var(--kelles-transition, all 0.3s ease);
}

/* Header Action Items (Cart, Wishlist, User) */
.header-action {
    gap: 15px;
}

.header-action-item {
    margin-left: 5px;
}

.header-action-item a {
    color: var(--kelles-dark, #202124);
    font-size: 22px;
    position: relative;
    display: inline-block;
    padding: 5px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.03);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--kelles-transition, all 0.3s ease);
}

.header-action-item a:hover {
    color: var(--kelles-primary, #4285f4);
    transform: translateY(-2px);
    background-color: rgba(66, 133, 244, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.badge.cart-badge,
.badge.wishlist-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: var(--kelles-transition, all 0.3s ease);
}

/* Special styles for each action item */
.header-action-item:nth-child(1) a:hover { /* Search */
    color: #fbbc05;
    background-color: rgba(251, 188, 5, 0.1);
}

.header-action-item:nth-child(2) a:hover { /* Cart */
    color: #4285f4;
    background-color: rgba(66, 133, 244, 0.1);
}

.header-action-item:nth-child(3) a:hover { /* Wishlist */
    color: #ea4335;
    background-color: rgba(234, 67, 53, 0.1);
}

.header-action-item:nth-child(4) a:hover { /* User */
    color: #34a853;
    background-color: rgba(52, 168, 83, 0.1);
}

/* Search Dropdown Styling */
.search-dropdown {
    width: 300px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    animation: dropdownFadeIn 0.3s ease;
    padding: 15px;
    margin-top: 10px;
}

.search-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 18px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid rgba(0,0,0,0.05);
    border-left: 1px solid rgba(0,0,0,0.05);
}

.search-dropdown .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    transition: all 0.3s ease;
    box-shadow: none;
    border-color: #e0e0e0;
}

.search-dropdown .form-control:focus {
    border-color: var(--kelles-primary, #4285f4);
    box-shadow: 0 0 0 0.1rem rgba(66, 133, 244, 0.15);
}

.search-dropdown .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: var(--kelles-primary, #4285f4);
    border-color: var(--kelles-primary, #4285f4);
}

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

/* Navbar Enhancements */
.navbar {
    background-color: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: var(--kelles-transition, all 0.3s ease);
    padding: 0.75rem 0;
}

/* Sticky Navbar */
.sticky-navbar {
    position: fixed;
    /* Top position is set via JavaScript for accuracy */
    left: 0;
    right: 0;
    z-index: 999; /* One less than topbar */
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    width: 100%;
    background-color: #fff; /* Ensure background is opaque */
}

.sticky-navbar.is-sticky {
    animation: none; /* Remove animation since navbar is always sticky */
}

/* Logo styling */
.navbar-brand {
    padding: 0;
}

.navbar-logo {
    max-height: 50px;
    transition: var(--kelles-transition, all 0.3s ease);
}

.is-sticky .navbar-logo {
    max-height: 40px;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Navbar Nav Links */
.navbar-nav {
    padding: 0;
}

.navbar-nav .nav-item {
    position: relative;
    margin: 0 2px;
}

.navbar-nav .nav-link {
    color: var(--kelles-dark, #202124);
    font-weight: 500;
    padding: 1rem 1.2rem;
    position: relative;
    transition: var(--kelles-transition, all 0.3s ease);
    display: flex;
    align-items: center;
}

.nav-icon {
    margin-right: 5px;
    font-size: 1.1em;
}

.navbar-nav .nav-link:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--kelles-primary, #4285f4);
    transition: var(--kelles-transition, all 0.3s ease);
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--kelles-primary, #4285f4);
}

.navbar-nav .nav-link:hover:after,
.navbar-nav .nav-link.active:after {
    width: 70%;
}

/* Dropdown Menu */
.dropdown-menu {
    border: none;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 8px;
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    background-color: #ffffff !important;
    min-width: 200px;
}

/* User Dropdown Menu Specific Styles */
.dropdown-menu[aria-labelledby="userDropdown"] {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 0;
    margin-top: 8px;
    min-width: 200px;
    overflow: hidden;
}

/* User Dropdown Items */
.dropdown-menu[aria-labelledby="userDropdown"] .dropdown-item {
    padding: 12px 16px;
    border-radius: 0;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    background-color: transparent;
    color: #333;
    text-decoration: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
}

.dropdown-menu[aria-labelledby="userDropdown"] .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #495057;
    transform: none;
}

.dropdown-menu[aria-labelledby="userDropdown"] .dropdown-item:focus {
    background-color: #f8f9fa !important;
    color: #495057;
    outline: none;
}

/* User Dropdown Icons */
.dropdown-menu[aria-labelledby="userDropdown"] .dropdown-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

/* User Dropdown Dividers */
.dropdown-menu[aria-labelledby="userDropdown"] .dropdown-divider {
    margin: 0;
    border-top: 1px solid #e9ecef;
}

/* Logout Button Specific Styling */
.dropdown-menu[aria-labelledby="userDropdown"] button.dropdown-item {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
}

.dropdown-menu[aria-labelledby="userDropdown"] button.dropdown-item:hover {
    background-color: #f8f9fa !important;
}

.dropdown-menu-animate {
    transform-origin: top center;
    animation: dropdownAnimation 0.3s ease forwards;
}

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

.dropdown-item {
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: rgba(66, 133, 244, 0.1);
    transform: translateX(5px);
}

.dropdown-item-icon {
    display: inline-flex;
    width: 24px;
    margin-right: 8px;
    color: var(--kelles-primary, #4285f4);
}

/* Navbar Search */
.navbar-search {
    max-width: 240px;
}

.navbar-search .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    border-color: #f0f0f0;
    font-size: 13px;
}

.navbar-search .form-control:focus {
    background-color: #fff;
    box-shadow: none;
    border-color: var(--kelles-primary, #4285f4);
}

.navbar-search .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: var(--kelles-primary, #4285f4);
    border-color: var(--kelles-primary, #4285f4);
    padding-left: 12px;
    padding-right: 12px;
}

/* Additional Dropdown Fixes */
.dropdown-menu.show {
    display: block !important;
    opacity: 1;
    visibility: visible;
}

/* Ensure dropdown positioning */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0.125rem 0 0;
    font-size: 1rem;
    color: #212529;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
}

.dropdown-menu-end {
    --bs-position: end;
    right: 0;
    left: auto;
}

/* Fix for Bootstrap popper positioning */
.dropdown-menu[data-bs-popper] {
    margin-top: 0.125rem;
    margin-left: 0;
}

/* Ensure proper background coverage for all dropdown items */
.dropdown-menu li {
    background-color: transparent;
}

.dropdown-menu li a,
.dropdown-menu li button {
    display: block;
    width: 100%;
    padding: 0.375rem 1rem;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.dropdown-menu li a:hover,
.dropdown-menu li a:focus,
.dropdown-menu li button:hover,
.dropdown-menu li button:focus {
    color: #1e2125;
    background-color: #e9ecef;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .top-header {
        font-size: 11px;
    }
    
    .whatsapp-cta {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .social-icon {
        width: 20px;
        height: 20px;
    }
    
    .social-icon i {
        font-size: 12px;
    }
    
    /* Mobile dropdown adjustments */
    .dropdown-menu[aria-labelledby="userDropdown"] {
        min-width: 180px;
        font-size: 0.8rem;
    }
    
    .dropdown-menu[aria-labelledby="userDropdown"] .dropdown-item {
        padding: 10px 12px;
    }
}
