/**
 * Header Design Improvements
 * Fixes alignment, spacing, and styling issues in the header
 */

/* User Account Button Styling - icon with name */
.header-right_area .user-account-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    padding: 0 10px;
    min-width: auto;
}

/* Show user name text next to icon */
.header-right_area .user-account-btn .user-name-text {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
    line-height: 1.2;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
}

/* Ensure icons are properly aligned and visible */
.header-bottom_area.header-bottom_area-2 .header-right_area > ul > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    color: #cda557 !important; /* Gold for branding and visibility on dark */
}

/* Sticky state: Switch to dark icons on white background */
.header-sticky.sticky .header-right_area > ul > li > a {
    color: #333333 !important;
}

/* Remove vertical dividers between icons */
.header-right_area > ul > li {
    border: none !important;
    margin: 0;
    padding: 0;
}

/* User account button - horizontal layout for icon + name */
.header-bottom_area.header-bottom_area-2 .header-right_area > ul > li > a.user-account-btn {
    flex-direction: row;
}

.header-bottom_area.header-bottom_area-2 .header-right_area > ul > li > a > i {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 0;
}

/* User account icon specific styling */
.header-right_area .user-account-btn > i,
.header-right_area .auth-login-btn > i {
    font-size: 24px;
    line-height: 1;
}

/* Badge positioning improvements - positioned right above icons */
.header-right_area .wishlist-count,
.header-right_area .cart-count,
.header-right_area .minicart-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff6b6b;
    color: #ffffff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    min-width: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    pointer-events: none;
}

/* Ensure parent links are positioned relatively for absolute badge positioning */
.header-right_area .wishlist-btn,
.header-right_area .minicart-btn {
    position: relative;
}

/* Responsive badge positioning */
@media (max-width: 1199px) {
    .header-right_area .wishlist-count,
    .header-right_area .cart-count,
    .header-right_area .minicart-count {
        top: 18px;
        right: 8px;
    }
}

@media (max-width: 767px) {
    .header-right_area .wishlist-count,
    .header-right_area .cart-count,
    .header-right_area .minicart-count {
        top: 22px;
        right: 8px;
    }
}

/* Hide badges when count is 0 */
.wishlist-count:empty,
.cart-count:empty,
.minicart-count:empty,
.wishlist-count[style*="display: none"],
.cart-count[style*="display: none"],
.minicart-count[style*="display: none"] {
    display: none !important;
}

/* Show badges when count is greater than 0 */
.wishlist-count:not(:empty):not([style*="display: none"]),
.cart-count:not(:empty):not([style*="display: none"]),
.minicart-count:not(:empty):not([style*="display: none"]) {
    display: inline-flex !important;
}

/* Icon hover effects - consistent across all icons */
.header-bottom_area.header-bottom_area-2 .header-right_area > ul > li > a:hover {
    color: #cda557 !important;
    transition: color 0.3s ease;
}

.header-bottom_area.header-bottom_area-2 .header-right_area > ul > li > a:hover > i {
    color: #cda557;
}

/* Spacing between icons */
.header-bottom_area.header-bottom_area-2 .header-right_area > ul > li {
    margin: 0;
    padding: 0;
}

/* Ensure proper vertical alignment for all toolbar items */
.header-right_area > ul {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-right_area > ul > li {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Dropdown menu styling for user account - hidden by default */
.header-right_area .dropdown-holder .hm-dropdown {
    position: absolute;
    background: #ffffff;
    min-width: 150px;
    padding: 10px 0;
    right: 0;
    left: auto;
    transform-origin: 0 0 0;
    transform: scaleY(0);
    box-shadow: 0 1px 2px 2px rgba(0, 0, 0, 0.2);
    z-index: 99;
    transition: all 0.3s ease-in-out;
}

/* Show dropdown on hover */
.header-right_area .dropdown-holder:hover .hm-dropdown {
    transform: scaleY(1);
}

.header-right_area .dropdown-holder .hm-dropdown li a {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    border-bottom: none;
}

.header-right_area .dropdown-holder .hm-dropdown li a i {
    margin-right: 8px;
    font-size: 16px;
}

.header-right_area .dropdown-holder .hm-dropdown li a:hover {
    background-color: #f8f8f8;
    color: #cda557;
}

/* Remove border from last dropdown item */
.header-right_area .dropdown-holder .hm-dropdown li:last-child a {
    border-bottom: none;
    padding-bottom: 10px;
}

/* User icon with name - adjust width to accommodate name */
.header-right_area .user-account-btn {
    width: auto;
    min-width: 70px;
    height: 85px;
    line-height: 85px;
    padding: 0 15px;
}

@media only screen and (min-width: 992px) and (max-width: 1199px) {
    .header-right_area .user-account-btn {
        min-width: 50px;
        padding: 0 10px;
    }
    
    .header-right_area .user-account-btn .user-name-text {
        max-width: 80px;
        font-size: 12px;
        margin-left: 6px;
    }
}

@media (max-width: 479px) {
    .header-right_area .user-account-btn {
        min-width: 50px;
        padding: 0 8px;
    }
    
    .header-right_area .user-account-btn .user-name-text {
        max-width: 60px;
        font-size: 11px;
        margin-left: 5px;
    }
}

/* Responsive adjustments */
@media (max-width: 1199px) {
    .header-bottom_area.header-bottom_area-2 .header-right_area > ul > li > a {
        width: 50px;
    }
    
    .header-right_area .user-account-btn {
        width: auto;
        min-width: 50px;
    }
}

@media (max-width: 767px) {
    .header-right_area .user-account-btn .user-name-text {
        max-width: 50px;
        font-size: 11px;
    }
    
    .header-right_area .user-account-btn {
        min-width: 50px;
        padding: 0 5px;
    }
}

/* Shop categories dropdown in main navbar */
.header-bottom_area .main-menu_area > nav > ul > li .hm-dropdown.shop-category-dropdown {
    width: 280px;
    max-height: 420px;
    overflow-y: auto;
    padding: 12px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.header-bottom_area .main-menu_area > nav > ul > li .hm-dropdown.shop-category-dropdown > li > a {
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
}

.header-bottom_area .main-menu_area > nav > ul > li .hm-dropdown.shop-category-dropdown > li > a > i {
    right: 16px;
}

.header-bottom_area .main-menu_area > nav > ul > li .hm-dropdown.shop-category-dropdown > li.shop-all-link {
    margin-top: 6px;
    border-top: 1px solid #ededed;
    padding-top: 6px;
}

.header-bottom_area .main-menu_area > nav > ul > li .hm-dropdown.shop-category-dropdown > li.shop-all-link > a {
    font-weight: 700;
    color: #be8658;
}

/* Restore and center menu for desktop-tablet view */
@media (min-width: 992px) {
    .main-menu_area {
        display: flex !important;
        justify-content: center !important;
    }
    
    .main-menu_area > nav > ul {
        display: flex !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        justify-content: center !important;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .main-menu_area > nav > ul > li > a {
        color: #cda557 !important; /* Gold branding color */
        font-weight: 700;
        text-transform: uppercase;
        padding: 15px 12px !important; /* Slightly tighter padding to fit on one row */
        transition: all 0.3s ease;
        white-space: nowrap !important;
    }
    
    /* Sticky state: Switch to dark links on white background */
    .header-sticky.sticky .main-menu_area > nav > ul > li > a {
        color: #333333 !important;
    }
    
    .main-menu_area > nav > ul > li > a:hover {
        color: #be8658 !important; /* Slightly darker gold on hover */
    }

    /* Toolbar Dropdown specific styling (Right Side) */
    .header-right_area .dropdown-holder {
        position: relative;
    }

    .header-right_area .dropdown-holder:hover .toolbar-dropdown {
        visibility: visible !important;
        opacity: 1 !important;
        top: 100% !important;
    }

    .toolbar-dropdown {
        right: 0 !important;
        left: auto !important;
        min-width: 160px !important;
        text-align: left;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        z-index: 1000;
        top: 120% !important; /* Start slightly lower for transition */
    }
}

@media (max-width: 575px) {
    .header-right_area .user-account-btn .user-name-text {
        display: none;
    }
    
    .header-right_area .user-account-btn {
        width: 50px;
        padding: 0;
    }
}

/* Mobile Header Optimizations */
@media (max-width: 991px) {
    .header-main_area-2 .header-bottom_area {
        padding: 10px 0 !important;
        background-color: #ffffff !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }
    
    .header-logo {
        padding: 5px 0 !important;
        text-align: left !important;
    }
    
    .header-logo img {
        max-height: 45px !important;
        width: auto !important;
    }
    
    .header-right_area > ul {
        justify-content: flex-end;
        gap: 8px;
    }
    
    .header-right_area .toolbar-btn {
        width: 35px !important;
        height: 35px !important;
        font-size: 22px !important;
        color: #333 !important;
        display: flex !important;
        padding: 0 !important;
    }
    
    .header-right_area .wishlist-count,
    .header-right_area .cart-count,
    .header-right_area .minicart-count {
        top: 2px !important;
        right: 2px !important;
        width: 16px !important;
        height: 16px !important;
        font-size: 9px !important;
    }
}

@media (max-width: 575px) {
    .header-logo img {
        max-height: 35px !important;
    }
    
    .header-right_area .toolbar-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 20px !important;
    }
    
    .header-bottom_area .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* Ensure sticky header remains compact */
.header-sticky.sticky {
    padding: 8px 0 !important;
}

/* Symmetrical spacing for mobile header */
@media (max-width: 991px) {
    .header-bottom_area .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .header-right_area {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .header-right_area > ul {
        margin-right: -5px !important; /* Pull icons to the right edge */
        padding-right: 0 !important;
        gap: 10px;
        justify-content: flex-end !important;
    }
    
    .header-right_area > ul > li {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .header-right_area > ul > li:last-child a {
        padding-right: 0 !important;
        margin-right: 0 !important;
        width: 30px !important; /* Tighten the last icon hit area */
    }
}
