/* Layout and Main Structure */
.main {
    min-height: calc(100vh - 400px); /* Adjust based on header/footer height */
    padding-bottom: 100px; /* Increased from 50px to 100px */
    position: relative;
}

footer {
    position: relative;
    z-index: 10;
    background: #fff;
    margin-top: 0; /* Changed from 50px to 0 */
    padding: 20px 0;
    clear: both; /* Ensures footer clears floated elements */
}

.page-wrapper {
    position: relative;
    min-height: 100vh;
    padding-bottom: 200px; /* Should be equal to or greater than footer height */
}

#loginButton .spinner-border {
    margin-left: 8px;
    margin-right: -4px;
}

/* Cart Dropdown Styling */
.cart-dropdown .dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.dropdown-cart-products {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px 0;
}

.cart-product-item {
    position: relative;
    padding: 12px 15px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
}

.cart-product-item:hover {
    background-color: #f8f9fa;
}

.cart-product-item:last-child {
    border-bottom: none;
}

/* Cart Modal Styles - Fixed Selectors for Actual HTML Structure */
.product.cart-product-item .product-image-container,
.cart-product-item .product-image-container {
    flex-shrink: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #f8f9fa url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiBmaWxsPSIjRjNGNEY2Ci8+CjxwYXRoIGQ9Ik0yMCAyMEg0NFY0NEgyMFYyMFoiIHN0cm9rZT0iIzlDQTNBRiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTI4IDI4TDM2IDM2TDQwIDMyIiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=') center/contain no-repeat !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Cart Modal Image Styles - Fixed Selectors for Actual HTML Structure */
.product.cart-product-item .product-image-container img,
.cart-product-item .product-image-container img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.product.cart-product-item .product-image-container img.loaded,
.cart-product-item .product-image-container img.loaded {
    z-index: 2 !important;
}

/* Hide broken or missing images to show background placeholder */
.product.cart-product-item .product-image-container img[src=""],
.product.cart-product-item .product-image-container img:not([src]),
.product.cart-product-item .product-image-container img[src*="no-image"],
.product.cart-product-item .product-image-container img[alt="Broken image"],
.product.cart-product-item .product-image-container img.error,
.cart-product-item .product-image-container img[src=""],
.cart-product-item .product-image-container img:not([src]),
.cart-product-item .product-image-container img[src*="no-image"],
.cart-product-item .product-image-container img[alt="Broken image"],
.cart-product-item .product-image-container img.error {
    display: none !important;
}

.cart-product-item .product-cart-details {
    flex: 1;
    min-width: 0;
    padding-right: 25px;
}

.cart-product-item .product-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 500;
}

.cart-product-item .product-title a {
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-product-item .product-title a:hover {
    color: #cc9966;
}

.cart-product-item .cart-product-info {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.cart-product-item .cart-product-qty {
    color: #cc9966;
    font-weight: 600;
}

.cart-product-item .btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    color: #999;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.cart-product-item .btn-remove:hover {
    background: #dc3545;
    color: white;
    opacity: 1;
    transform: scale(1.1);
}

.dropdown-cart-total {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.dropdown-cart-total .cart-total-price {
    color: #cc9966;
    font-size: 18px;
}

.dropdown-cart-action {
    padding: 15px;
    display: flex;
    gap: 10px;
}

.dropdown-cart-action .btn {
    flex: 1;
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-cart-action .btn-primary {
    background: #cc9966;
    border-color: #cc9966;
    color: white;
}

.dropdown-cart-action .btn-primary:hover {
    background: #b8875a;
    border-color: #b8875a;
}

.dropdown-cart-action .btn-outline-primary-2 {
    background: transparent;
    border: 1px solid #cc9966;
    color: #cc9966;
}

.dropdown-cart-action .btn-outline-primary-2:hover {
    background: #cc9966;
    color: white;
}

/* Empty cart state */
.dropdown-cart-products:empty::after {
    content: "Your cart is empty";
    display: block;
    text-align: center;
    padding: 30px 15px;
    color: #999;
    font-style: italic;
}

/* Navigation menu styling */
.header.header-7 .header-middle .main-nav.header-center,
.header-middle .main-nav.header-center {
    margin: 0 !important;
    position: static !important;
    transform: none !important;
}

.header.header-7 .header-middle .main-nav {
    margin-right: 0 !important;
}

/* Prevent text wrapping in navigation menu */
.header-middle .main-nav .menu li a {
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
}

.header-middle .main-nav .menu {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 1rem !important;
}

/* Mobile responsive styles for cart dropdown */
@media (max-width: 767px) {
    .cart-dropdown .dropdown-menu {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;
        transform: none !important;
        margin: 0 !important;
        z-index: 1060;
    }

    .dropdown-cart-products {
        max-height: 250px;
        padding: 10px 0;
    }

    .cart-product-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .cart-product-item .product-image-container {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
        background: #f8f9fa !important;
        border: 1px solid #eee;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .cart-product-item .product-image {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

    .cart-product-item .product-image img {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        object-fit: scale-down !important;
        display: block !important;
        border-radius: 4px;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Fallback for broken images on mobile */
    .cart-product-item .product-image img[src=""],
    .cart-product-item .product-image img:not([src]),
    .cart-product-item .product-image img[src*="no-image"] {
        background: url('/content/assets/images/products/product-placeholder.jpg') center/cover no-repeat !important;
        background-color: #f8f9fa !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }

    .cart-product-item .product-cart-details {
        padding-right: 20px;
        flex: 1;
        min-width: 0;
    }

    .cart-product-item .product-title {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .cart-product-item .cart-product-info {
        font-size: 12px;
    }

    .cart-product-item .btn-remove {
        width: 20px;
        height: 20px;
        top: 6px;
        right: 6px;
        font-size: 10px;
    }

    .dropdown-cart-total {
        padding: 12px;
        font-size: 14px;
    }

    .dropdown-cart-total .cart-total-price {
        font-size: 16px;
    }

    .dropdown-cart-action {
        padding: 12px;
        gap: 8px;
    }

    .dropdown-cart-action .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Additional mobile image fallbacks */
    .cart-product-item .product-image img[src=""],
    .cart-product-item .product-image img:not([src]) {
        background: url('/content/assets/images/no-image.jpg') center/cover no-repeat;
        min-height: 50px;
        width: 50px;
    }
}