/* Modern Cart Design - Full Height Right Sidebar */

/* Override parent container constraints */
.cart-btn {
    position: static !important;
}

/* Cart Sidebar - Full Height Right Side */
.dropdown-menu.dropdown-menu-right[aria-labelledby="dropdown-cart"] {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 400px !important;
    max-width: 90vw !important;
    height: 100vh !important;
    max-height: none !important;
    min-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1) !important;
    transform: translateX(100%) !important;
    transition: transform 0.3s ease !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 20px !important;
    z-index: 99999 !important;
    display: block !important;
    background: #ffffff !important;
    border-left: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Premium Sidebar Look */
.cart-sidebar {
    background: #ffffff !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05) !important;
    border-left: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Show state - slide in */
.open>.dropdown-menu.dropdown-menu-right[aria-labelledby="dropdown-cart"],
.dropdown-menu.dropdown-menu-right[aria-labelledby="dropdown-cart"].show {
    transform: translateX(0) !important;
}

/* Cart Sidebar Header */
.dropdown-menu h4,
.modern-cart-header {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #E5E7EB;
}

/* Cart Items Container */
#cart-contents {
    display: block !important;
}

.cart-items {
    width: 100%;
    margin-bottom: 20px;
}

/* Cart Modal Container */
.cart-sidebar,
.dropdown-menu {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Cart Item Card - Exact match to image */
.modern-cart-item {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

/* Product Image - Square with rounded corners */
.modern-cart-item-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #F9FAFB;
}

.modern-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Details Section */
.modern-cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 30px;
    /* Space for trash icon */
}

/* Product Name - Blue color */
.modern-cart-item-name {
    font-size: 16px;
    font-weight: 600;
    color: #2563EB;
    text-decoration: none;
    margin: 0;
    line-height: 1.3;
    display: block;
}

.modern-cart-item-name:hover {
    color: #1D4ED8;
    text-decoration: none;
}

/* Size Display */
.modern-cart-item-size {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

/* Price Display */
.modern-cart-item-price {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 4px 0 8px 0;
}

/* Quantity Controls - Circular buttons */
.modern-qty-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.modern-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #D1D5DB;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #374151;
    padding: 0;
}

.modern-qty-btn:hover {
    border-color: #9CA3AF;
    background: #F9FAFB;
}

.modern-qty-btn:active {
    transform: scale(0.95);
}

.modern-qty-btn i {
    font-size: 12px;
}

.modern-qty-display {
    font-size: 16px;
    font-weight: 500;
    color: #111827;
    min-width: 30px;
    text-align: center;
}

/* Remove Button - Trash icon */
.modern-cart-item-remove {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    padding: 0;
}

.modern-cart-item-remove:hover {
    color: #DC2626;
}

/* Add Gift Box Option */
.modern-addon-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    margin: 8px 0;
    border-top: 1px solid #F3F4F6;
}

.modern-addon-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.modern-addon-icon {
    font-size: 16px;
    color: #6B7280;
}

.modern-addon-label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.modern-addon-price {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

/* Premium Cart Summary - Clean and Structured */
.modern-cart-summary {
    background: #F9FAFB;
    border: 1px solid #F3F4F6;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modern-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modern-summary-label {
    font-size: 14px;
    color: #6B7280;
    font-weight: 500;
}

.modern-summary-value {
    font-size: 15px;
    color: #374151;
    font-weight: 600;
}

.modern-summary-row.total {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #E5E7EB;
}

.modern-summary-row.total .modern-summary-label {
    font-size: 16px;
    color: #111827;
    font-weight: 700;
}

.modern-summary-row.total .modern-summary-value {
    font-size: 20px;
    color: #2563EB;
    font-weight: 800;
}

/* Proceed to Checkout Button - High End */
.modern-btn-checkout {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 18px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    position: relative;
    overflow: hidden;
}

.modern-btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
    filter: brightness(1.1);
    color: #ffffff;
}

.modern-btn-checkout i {
    font-size: 18px;
}

/* View Shopping Cart Button - Minimalist Professional */
.modern-btn-view-cart {
    background: #ffffff;
    color: #4B5563;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.modern-btn-view-cart:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
    color: #111827;
}

.modern-btn-view-cart i {
    font-size: 16px;
    color: #9CA3AF;
}

/* Cart Actions Container */
.modern-cart-actions {
    margin-top: 16px;
}

/* Empty Cart State */
.modern-cart-empty {
    text-align: center;
    padding: 40px 20px;
}

.modern-cart-empty-icon {
    font-size: 48px;
    color: #D1D5DB;
    margin-bottom: 16px;
}

.modern-cart-empty-text {
    font-size: 16px;
    color: #6B7280;
    margin-bottom: 24px;
}

/* Responsive Design - High Performance Mobile Experience */
@media (max-width: 480px) {

    /* Full width sidebar for mobile */
    .dropdown-menu.dropdown-menu-right[aria-labelledby="dropdown-cart"],
    .cart-sidebar {
        width: 100% !important;
        max-width: 80vw !important;
        padding: 16px !important;
    }

    .modern-cart-item {
        padding: 12px;
        gap: 10px;
    }

    .modern-cart-item-image {
        width: 70px;
        height: 70px;
    }

    .modern-cart-item-name {
        font-size: 14px;
        line-height: 1.2;
    }

    .modern-cart-item-price {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .modern-qty-controls {
        gap: 8px;
        margin-top: 4px;
    }

    .modern-qty-btn {
        width: 32px;
        /* Larger touch targets for mobile */
        height: 32px;
    }

    .modern-cart-summary {
        padding: 12px;
        margin: 15px 0;
    }

    .modern-summary-row.total .modern-summary-value {
        font-size: 18px;
    }

    /* Stack buttons for mobile if needed, but here we keep them large */
    .modern-btn-checkout,
    .modern-btn-view-cart {
        padding: 16px 20px;
        font-size: 15px;
    }

    /* Recommendation layout on mobile */
    .recommendation-item {
        width: calc(50% - 5px);
        padding: 10px;
    }

    .recommendation-item-name {
        font-size: 12px;
    }

    .recommendation-add-to-cart {
        padding: 6px 8px;
        font-size: 11px;
    }

    .modern-cart-header {
        font-size: 28px !important;
    }
}

/* Override existing cart styles */
.cart-items tr {
    border: none !important;
}

.cart-items td {
    border: none !important;
    padding: 0 !important;
}

/* Hide old cart table footer */
.cart-items tfoot {
    display: none;
}

/* Cart header styling */
.cart-sidebar h4,
.dropdown-menu h4 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

/* Mobile Header Row - Professional Single Row Layout */
@media (max-width: 767px) {
    .main-header .container.padding-y-md {
        padding-top: 5px !important;
        padding-bottom: 5px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .mobile-header-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 15px !important;
        background: #ffffff !important;
        height: 60px !important;
        width: 100% !important;
        position: relative !important;
        z-index: 1001 !important;
        flex-wrap: nowrap !important;
        margin: 0 !important;
        transition: box-shadow 0.3s ease;
    }

    .mobile-header-row.sticky {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        z-index: 10002 !important;
        /* Higher than collapse menu (1000) */
        /* animation removed to prevent visibility glitches */
    }

    body.mobile-sticky-active {
        padding-top: 60px !important;
    }

    .mobile-menu-toggle {
        font-size: 22px;
        color: #111827;
        cursor: pointer;
        width: 44px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .mobile-logo {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        max-height: 50px;
        overflow: hidden;
    }

    .mobile-logo a {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    .mobile-logo img {
        max-height: 44px !important;
        max-width: 140px !important;
        width: auto !important;
        object-fit: contain !important;
    }

    .mobile-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 88px;
        justify-content: flex-end;
    }

    .mobile-search-trigger {
        font-size: 20px;
        color: #111827;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
    }
}


/* Ensure mobile menu attaches to the fixed header when sticky */
body.mobile-sticky-active .navbar-collapse {
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border-top: 1px solid #eee !important;
    z-index: 1000 !important;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    margin: 0 !important;
}

/* Mobile Menu Mini-Card Design */
@media (max-width: 991px) {
    header.flex2 nav.navbar.navbar-default .navbar-collapse.in {
        position: fixed !important;
        left: 15px !important;
        right: auto !important;
        width: 80% !important;
        max-width: 320px !important;
        max-height: calc(100vh - 40px) !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.2) !important;
        padding: 20px !important;
        z-index: 100050 !important;
        overflow-y: auto !important;
        background: rgba(255, 255, 255, 0.98) !important;
        display: block !important;
        animation: menuSlideFromLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    /* Animation */
    @keyframes menuSlideFromLeft {
        from {
            opacity: 0;
            transform: translateX(-100px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* Menu item spacing in card */
    header.flex2 nav.navbar.navbar-default .navbar-nav>li>a {
        padding: 15px 20px !important;
        border-radius: 12px;
        margin-bottom: 8px;
        transition: all 0.2s ease;
        color: #111827 !important;
        background: #f3f4f6 !important;
        text-align: center;
        font-weight: 600 !important;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    header.flex2 nav.navbar.navbar-default .navbar-nav>li>a:hover {
        background: #e5e7eb !important;
        color: #000 !important;
        transform: scale(1.02);
    }

    /* Submenu visibility in card */
    header.flex2 nav.navbar.navbar-default .navbar-nav .dropdown-menu {
        display: none !important;
        position: static !important;
        float: none !important;
        width: 100% !important;
        box-shadow: none !important;
        background: transparent !important;
        border: none !important;
        padding-left: 20px !important;
    }

    /* Reveal submenus when parent is open */
    header.flex2 nav.navbar.navbar-default .navbar-nav .dropdown.open>.dropdown-menu,
    header.flex2 nav.navbar.navbar-default .navbar-nav .dropdown-submenu.open-submenu>.dropdown-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
    }

    /* Submenu link styling within card */
    header.flex2 nav.navbar.navbar-default .navbar-nav .dropdown-menu>li>a {
        color: #4b5563 !important;
        background: rgba(0, 0, 0, 0.03) !important;
        text-align: left;
        padding: 10px 15px !important;
        border-radius: 8px;
        margin-bottom: 4px;
        font-size: 13px !important;
        font-weight: 500 !important;
    }
}

/* Background Blur Styles */
.menu-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100040 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.menu-open .menu-card-overlay {
    display: block;
    opacity: 1;
}

body.menu-open {
    overflow: hidden;
}

/* Modernized Search Box for Mobile */
@media (max-width: 767px) {

    /* Ensure header and its containers don't clip absolute children like search/cart */
    .main-header {
        position: relative !important;
        z-index: 2 !important;
        /* Lowered to let cart (99999) be on top */
        overflow: visible !important;
    }

    .main-header .container,
    .main-header .row {
        overflow: visible !important;
    }

    #mobile-search-box.mobile-search-container {
        display: none !important;
        visibility: visible !important;
        width: 100% !important;
        padding: 10px 15px !important;
        margin: 0 !important;
        position: absolute !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 3000 !important;
        /* Higher than header row, but below cart sidebar (99999) */
        background: #ffffff !important;
        border-bottom: 2px solid #2563EB !important;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    }

    #mobile-search-box.mobile-search-container.show-mobile {
        display: block !important;
        animation: slideDownMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    @keyframes slideDownMobile {
        from {
            transform: translateY(-20px);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* Cart Overlay/Backdrop */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99998 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.cart-overlay.open {
    display: block !important;
    opacity: 1 !important;
}

/* Blur effect for the page content when cart is open */
body.cart-open .cart-overlay {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Cart Sidebar Header - Bold Serif Look */
.modern-cart-header {
    font-family: 'Zen Loop', cursive, serif !important;
    font-size: 32px !important;
    font-weight: 900 !important;
    color: #111827 !important;
    margin: 0 0 20px 0 !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid #E5E7EB !important;
}

/* Modern Cart Toggle Design (Icon + Badge) */
.modern-cart-toggle,
.modern-cart-toggle-mobile {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    position: relative;
    cursor: pointer;
    display: inline-block;
    box-shadow: none !important;
}

.cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.cart-icon-wrapper i {
    font-size: 24px !important;
    color: #374151 !important;
}

.modern-cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.modern-cart-toggle:hover .modern-cart-badge,
.modern-cart-toggle-mobile:hover .modern-cart-badge {
    transform: scale(1.15);
}


/* Ensure mobile toggle looks good */
.modern-cart-toggle-mobile {
    margin-right: 15px;
    margin-top: 5px;
}

/* Modern close button styling for both cart versions */
.modern-cart-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    background: #ffffff;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
    opacity: 1 !important;
    text-shadow: none;
    padding: 0;
    line-height: 1;
}

.modern-cart-close:hover {
    background: #F9FAFB;
    color: #111827;
    border-color: #D1D5DB;
    transform: rotate(90deg);
}

.modern-cart-close span {
    font-size: 24px;
}

/* Prevent accidental closing when clicking inside the fixed dropdown-menu */
.dropdown-menu.dropdown-menu-right[aria-labelledby="dropdown-cart"] {
    pointer-events: auto;
}

/* Recommendation Items Styling */
.recommendation {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.recommendation-item {
    width: calc(50% - 6px);
    min-width: calc(50% - 6px);
    flex: 0 0 calc(50% - 6px);
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    position: relative;
}

.recommendation-discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #EF4444;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 8px;
    z-index: 2;
}

.recommendation-item:hover {
    border-color: #DBEAFE;
    background: #FBFDFE;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}

.recommendation-item-image img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 10px;
}

.recommendation-item-name {
    font-size: 13px;
    font-weight: 700;
    color: #1D4ED8;
    margin: 8px 0 4px 0;
    line-height: 1.4;
    height: 36px;
    overflow: hidden;
    text-decoration: none;
}

.recommendation-item-price {
    font-size: 14px;
    font-weight: 800;
    color: #2563EB;
    margin: 0 0 10px 0;
}

.recommendation-add-to-cart {
    width: 100%;
    background: #2563EB;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-top: auto;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.recommendation-add-to-cart:hover {
    background: #1D4ED8;
    transform: scale(1.02);
}

.recommendation-add-to-cart:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

.recommendation-add-to-cart i {
    font-size: 14px;
}

/* Ensure sidebar is above overlay */
.cart-sidebar {
    z-index: 999;
    padding: 20px !important;
}

/* Premium Animations */
@keyframes cart-bounce {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(0.95);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.cart-bounce {
    animation: cart-bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.swal2-container {
    z-index: 99999;
}