/* General Styling */
:root {
    --grid-mobile: repeat(2, 1fr); /* 2 columns below 768px */
    --grid-small: repeat(3, 1fr); /* 3 columns above 768px */
    --grid-large: repeat(4, 1fr); /* 4 columns above 992px */
    --aspect-ratio: 0.6666666666666666; /* 2:3 ratio, matching mariemur.com */
    --gap: 2rem; /* Default gap */
    --COLOR-BG: #ffffff; /* Match cart.css */
    --COLOR-TEXT: #333;
    --COLOR-TEXT-LIGHT: #666;
    --COLOR-TEXT-DARK: #000000;
}

body {
    font-family: "Poppins", Arial, sans-serif;
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    background-color: #ffffff;
    color: var(--COLOR-TEXT);
}

*::before, *::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 35px 16px; /* Reduced for <768px */
    transform: scaleY(0.875) !important; /* Force vertical scaling */
    transform-origin: top; /* Scale from top */
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #fff5e6, #ffe0b2);
    height: 68.57vh; /* Adjusted to maintain ~60vh after scaling */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: none; /* Ensure no borders */
}

.hero-content {
    z-index: 1;
    padding: 20px;
}

.hero-title {
    font-size: 3.5rem; /* Match cart.css */
    font-weight: 800;
    color: var(--COLOR-TEXT);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.5rem; /* Match cart.css */
    color: var(--COLOR-TEXT-LIGHT);
    margin-bottom: 2rem;
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    opacity: 0.8;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    outline: none;
    border: none;
    font-size: 1rem;
    color: #ffffff;
    white-space: nowrap;
    background-color: #000000;
    border-radius: 0; /* Match cart.css */
    transition: background-color 0.3s;
    cursor: pointer;
    width: 100%; /* Match cart.css */
}

.btn:hover {
    background-color: #a60b00; /* Match cart.css */
}

.hero-btn, .details-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.hero-btn {
    background-color: #000000 !important; /* Ensure black background */
    color: #ffffff !important; /* Ensure white text */
    text-decoration: none !important; /* Remove underline */
    border-radius: 0;
}

.hero-btn:hover {
    background-color: #a60b00 !important; /* Match cart.css */
}

.details-btn {
    background-color: #ffffff; /* White background */
    color: #000000; /* Black text */
    margin-bottom: 0.5rem; /* Per previous request */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 0;
}

.details-btn:hover {
    background-color: #f0f0f0; /* Slight gray for hover */
    color: #000000;
}

.details-btn:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* Product Grid */
.product-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: var(--grid-mobile); /* Default: 2 columns */
    padding: 0; /* Remove padding */
    margin: 0; /* Ensure no default margins */
    align-content: start; /* Align grid content to top */
}

/* Product Card */
.product-card {
    position: relative;
    background: var(--COLOR-BG);
    border: none; /* Borderless, match mariemur.com .product-item--borderless */
    border-radius: 0; /* Match cart.css */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0; /* Remove all margins */
}

.product-image {
    width: 100%;
    height: 0;
    padding-top: calc(1 / var(--aspect-ratio) * 100%); /* 2:3 ratio */
    position: relative;
    overflow: hidden;
    background-color: var(--COLOR-BG);
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Match cart.css */
    border-radius: 0; /* Sharp corners */
    display: block;
}

.no-image {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 1rem;
    color: #888;
    text-align: center;
    padding: 5%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border-radius: 0; /* Match cart.css */
}

.wishlist-form {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.wishlist-icon {
    background-color: #cccaca;
    border: none;
    border-radius: 50%; /* Circular shape */
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 5px;
    transition: background-color 0.3s;
}

.wishlist-icon:hover {
    background-color: rgba(166, 11, 0, 0.8); /* #a60b00 */
}

.wishlist-icon i {
    color: #fff;
    font-size: 16px;
}

.wishlist-icon[data-favorited="true"] i {
    color: #a60b00; /* Match cart.css */
}

/* Product Info */
.product-info {
    padding: 0 12px;
    margin-top: 0.3rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    z-index: 10; /* Match mariemur.com */
    line-height: 1.2; /* Match mariemur.com */
    text-align: center; /* Center text */
}

.product-info a {
    text-decoration: none !important; /* Ensure no underlines for links */
}

.product-title {
    font-size: 1rem;
    margin: 0.2rem;
    color: var(--COLOR-TEXT);
    text-decoration: none !important; /* Remove underlines */
    font-weight: 400; /* Normal weight */
}

.product-desc {
    font-size: 0.8rem;
    color: var(--COLOR-TEXT-LIGHT);
    margin: 0.2rem;
    text-decoration: none !important; /* Remove underlines */
    font-weight: 400; /* Normal weight */
}

.product-price {
    font-size: 1rem;
    color: var(--COLOR-TEXT-LIGHT);
    margin: 0.2rem;
    text-decoration: none !important; /* Remove underlines */
    font-weight: 400; /* Normal weight */
}

.product-stock {
    font-size: 0.8rem;
    margin: 0.2rem;
    color: var(--COLOR-TEXT-LIGHT);
    text-decoration: none !important; /* Remove underlines */
    font-weight: 400; /* Normal weight */
}

.product-stock.low-stock {
    color: #ff6f61; /* Match cart.css */
}

.action-buttons {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center buttons to match text */
    gap: 0.3rem;
    margin-bottom: 0.25rem;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background-color: #000000;
    color: #ffffff;
    border-radius: 0; /* Match cart.css */
    width: auto; /* Remove 100% width */
    z-index: 10;
    text-decoration: none; /* Remove underlines */
}

.back-to-top:hover {
    background-color: #a60b00;
}

/* Custom Dropdown */
.sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-family: "Poppins", Arial, sans-serif;
    justify-content: flex-end; /* Align to the right */
    position: relative; /* Isolate from container transform */
}

.sort-container.sort-right {
    width: 100%; /* Ensure full width for right alignment */
}

.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #000000; /* Black text */
    font-size: 0.9rem;
    font-family: "Poppins", Arial, sans-serif;
    font-weight: 400;
}

.dropdown-toggle:hover {
    color: #a60b00; /* Red on hover */
}

.dropdown-toggle i {
    font-size: 1rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #ffffff;
    border: none; /* Borderless */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10000; /* Extremely high z-index */
    min-width: 150px;
    padding: 0.5rem; /* Add padding for clarity */
}

.sort-container .custom-dropdown .dropdown-menu.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important; /* Counteract container scaling */
    z-index: 10000 !important; /* Match dropdown-menu z-index */
}

/* Dropdown option styles */
.dropdown-option {
    padding: 0.5rem;
    font-size: 0.9rem;
    color: #000000; /* Black text */
    font-family: "Poppins", Arial, sans-serif;
    font-weight: 400;
    cursor: pointer;
    border: none; /* Borderless */
}

.dropdown-option:hover {
    color: #a60b00; /* Red on hover */
}

.dropdown-option[data-selected="true"] {
    color: #a60b00; /* Red text for selected option */
}

/* Responsive adjustments for dropdown */
@media (max-width: 768px) {
    .sort-container {
        position: relative;
    }
    .dropdown-menu {
        min-width: 120px; /* Adjust for smaller screens */
        right: 0;
    }
    .dropdown-toggle {
        font-size: 0.8rem;
    }
    .dropdown-toggle i {
        font-size: 0.9rem;
    }
    .dropdown-option {
        font-size: 11.2px; /* Set font size to 11.2px for <768px */
        padding: 0.15rem 0.4rem; /* 0.15rem top/bottom, 0.4rem left/right */
    }
}

@media (max-width: 480px) {
    .dropdown-toggle {
        font-size: 0.7rem;
    }
    .dropdown-toggle i {
        font-size: 0.8rem;
    }
    .dropdown-option {
        font-size: 11.2px; /* Maintain 11.2px for <480px */
        padding: 0.15rem 0.3rem; /* 0.15rem top/bottom, 0.3rem left/right */
    }
    .dropdown-menu {
        min-width: 100px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --gap: 1rem; /* Reduced grid gap for mobile */
    }
    .container {
        padding: 35px 16px; /* Reduced for <768px */
    }
    .hero {
        height: 68.57vh; /* Adjusted to maintain ~60vh after scaling */
    }
    .hero-title {
        font-size: 2.5rem; /* Match cart.css */
    }
    .hero-subtitle {
        font-size: 1.2rem; /* Match cart.css */
    }
    .hero-content {
        padding: 10px; /* Match cart.css */
    }
    .product-grid {
        grid-template-columns: var(--grid-mobile); /* 2 columns */
    }
    .product-title {
        font-size: 1rem;
        font-weight: 400; /* Normal weight */
        margin: 0.2rem;
    }
    .product-desc, .product-price, .product-stock {
        font-size: 0.8rem;
        font-weight: 400; /* Normal weight */
        margin: 0.2rem;
    }
    .hero-btn, .details-btn {
        font-size: 0.8rem;
        padding: 0.25rem 1rem;
        border-radius: 0;
    }
    .wishlist-icon {
        border-radius: 50%; /* Keep circular */
    }
}

@media (min-width: 768px) {
    .container {
        padding: 70px 40px; /* Reduced for >=768px */
    }
    .product-grid {
        grid-template-columns: var(--grid-small); /* 3 columns */
    }
}

@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: var(--grid-large); /* 4 columns */
    }
}

@media (max-width: 568px) {
    .product-title {
        margin: 0.2rem; /* Reduced margin for small screens */
    }
    .product-desc {
        margin: 0.2rem; /* Reduced margin for small screens */
    }
    .product-price {
        margin: 0.2rem; /* Reduced margin for small screens */
    }
    .product-stock {
        margin: 0.2rem; /* Reduced margin for small screens */
    }
    .action-buttons {
        margin-bottom: 0.2rem; /* Reduced margin for small screens */
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem; /* Match cart.css */
    }
    .hero-subtitle {
        font-size: 1rem; /* Match cart.css */
    }
    .product-title {
        font-size: 0.9rem;
        font-weight: 400; /* Normal weight */
        margin: 0.2rem; /* Keep reduced margin */
    }
    .product-desc, .product-price, .product-stock {
        font-size: 0.7rem;
        font-weight: 400; /* Normal weight */
        margin: 0.2rem; /* Keep reduced margin */
    }
    .hero-btn, .details-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.8rem;
        border-radius: 0;
    }
    .wishlist-icon {
        border-radius: 50%; /* Keep circular */
    }
}