/* Header User Dropdown Fixes */
.header {
    z-index: 20000 !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

/* Make only the top header sticky */
.header .header-top {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 20001 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 50px !important;
    padding: 8px 0 !important;
}

/* Category bar scrolls naturally */
.header .category-bar {
    position: relative;
    z-index: 10 !important;
}

.top-links {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
    position: relative;
    z-index: 20002;
    margin-left: auto;
}

.top-links>* {
    white-space: nowrap;
}

/* User Dropdown Styling */
.top-links .dropdown {
    position: relative;
    z-index: 20002;
}

.top-links .dropdown.show {
    z-index: 20003;
}

.top-links .dropdown-toggle {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.top-links .dropdown-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.top-links .dropdown-toggle::after {
    margin-left: 5px;
}

/* Dropdown Menu Styling */
.top-links .dropdown-menu {
    min-width: 200px;
    max-width: 250px;
    padding: 10px 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    margin-top: 5px;
    z-index: 30000 !important;
    position: absolute;
    background-color: #fff;
}

.top-links .dropdown-item {
    padding: 10px 20px;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-links .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #000;
}

.top-links .dropdown-item:active {
    background-color: #e9ecef;
}

.top-links .dropdown-divider {
    margin: 5px 0;
}

/* Cart Link Styling */
.top-links .cart-link {
    position: relative;
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.top-links .cart-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.top-links .cart-count {
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 3px;
}

/* User Icon Styling */
.top-links .fa-user {
    font-size: 16px;
    margin-right: 3px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .top-links {
        gap: 10px;
        font-size: 13px;
    }

    .top-links .dropdown-menu {
        min-width: 180px;
    }

    .top-links .dropdown-item {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Fix for dropdown button in form */
.top-links .dropdown-item button {
    background: none;
    border: none;
    padding: 0;
    width: 100%;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.top-links .dropdown-item button:hover {
    background: none;
}

/* Ensure dropdown shows when active */
.top-links .dropdown.show .dropdown-menu {
    display: block !important;
    z-index: 10002 !important;
}

/* Fix dropdown toggle behavior */
.top-links .dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.255em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

/* Remove default Bootstrap dropdown arrow positioning issues */
.top-links .dropdown-toggle {
    cursor: pointer;
    user-select: none;
}

/* Ensure dropdown menu is properly positioned */
.top-links .dropdown-menu {
    top: 100%;
    left: auto;
    right: 0;
    margin-top: 0.125rem;
}

/* =============================================
   USER PROFILE PILL - FIXED INLINE POSITIONING
   ============================================= */

/* Make user profile pill inline with other links */
.top-links .user-profile-pill {
    display: inline-flex !important;
    align-items: center !important;
    position: relative;
    flex-shrink: 0;
}

.top-links .user-pill-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px;
    padding: 4px 10px 4px 4px !important;
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border-radius: 50px;
    text-decoration: none !important;
    color: #333 !important;
    border: 1px solid #FFE082;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.top-links .user-pill-trigger:hover {
    background: linear-gradient(135deg, #FFECB3 0%, #FFE082 100%);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    text-decoration: none !important;
}

/* User Avatar - Smaller Size */
.top-links .user-avatar {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border-radius: 50%;
    overflow: hidden;
    background: #FFC107;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.top-links .user-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
}

/* User Name - Compact */
.top-links .user-name {
    font-weight: 600;
    font-size: 12px !important;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    margin-left: 4px !important;
}

/* Caret Icon */
.top-links .caret-icon {
    font-size: 10px !important;
    transition: transform 0.3s ease;
    margin-left: 2px;
}

.top-links .user-profile-pill:hover .caret-icon {
    transform: rotate(180deg);
}

/* User Dropdown Menu */
.top-links .user-dropdown {
    min-width: 180px;
    padding: 8px 0;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
    margin-top: 8px;
    background: #fff;
}

.top-links .user-dropdown .dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
    transition: all 0.2s ease;
}

.top-links .user-dropdown .dropdown-item:hover {
    background: #FFF8E1;
    color: #000;
}

.top-links .user-dropdown .dropdown-item i {
    color: #FFB300;
    width: 18px;
}

/* Login Link Styling */
.top-links .login-link {
    background: linear-gradient(135deg, #FFC107 0%, #FFB300 100%) !important;
    color: #000 !important;
    font-weight: 600 !important;
    border-radius: 50px !important;
    padding: 8px 16px !important;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    text-decoration: none !important;
    font-size: 13px !important;
    white-space: nowrap;
}

.top-links .login-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4) !important;
}

/* ================================================
   RESPONSIVE ADJUSTMENTS
   ================================================ */

@media (max-width: 1200px) {
    .top-links .user-name {
        max-width: 60px;
    }
}

@media (max-width: 991px) {
    .top-links {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
    }

    .top-links .user-avatar {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }

    .top-links .user-name {
        display: none !important;
    }

    .top-links .user-pill-trigger {
        padding: 4px 8px 4px 4px !important;
    }
}

@media (max-width: 575px) {
    .top-links .user-avatar {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
    }

    .top-links .user-pill-trigger {
        padding: 3px 6px 3px 3px !important;
    }

    .top-links .caret-icon {
        display: none !important;
    }
}

/* Modern scroll behavior is handled in YellowMenu.css */

/* ================================================
   FIX: Content padding for fixed header
   Ensures page content doesn't hide behind fixed header
   Total header height: header-top (~60px) + category-bar (~85px) = ~145-150px
   Adding extra buffer = 160px for desktop, more for mobile
   ================================================ */

/* Add padding to body to push all content below fixed header */
body {
    padding-top: 160px !important;
}

/* Responsive adjustments for smaller screens where header is taller */
@media (max-width: 991px) {
    body {
        padding-top: 180px !important;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 200px !important;
    }
}

@media (max-width: 576px) {
    body {
        padding-top: 260px !important;
    }
}