/* Modern Product Card Design - Matching Header & Dashboard UI */
* {
    box-sizing: border-box;
}

.product-card {
    background: var(--white-background);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.added_to_cart.wc-forward {
    display: none !important;
}

/* Product Badges Container */
.product-badges-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px;
    pointer-events: none;
}

/* Minimal Badge Base Styling */
.product-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    transition: transform 0.2s ease;
    pointer-events: auto;
    letter-spacing: 0.2px;
    line-height: 1;
}

/* Badge Icon Styling */
.badge-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.badge-text {
    white-space: nowrap;
    font-weight: 600;
}

/* Sale Badge - Minimal Red */
.sale-badge {
    background: #ef4444;
    color: white;
}

.sale-badge:hover {
    transform: scale(1.05);
}

/* Stock Badge Variants - Minimal */
.stock-badge.stock-out {
    background: #ef4444;
    color: white;
}

.stock-badge.stock-low {
    background: #f59e0b;
    color: white;
}

.stock-badge.stock-available {
    background: #10b981;
    color: white;
}

/* Subtle Hover Effects */
.stock-badge:hover {
    transform: scale(1.05);
}

/* Product Image Container */
.product-image-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    /* Fallback for browsers without aspect-ratio support */
    aspect-ratio: 1;
    /* Modern browsers */
    overflow: hidden;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

/* Modern browsers with aspect-ratio support */
@supports (aspect-ratio: 1) {
    .product-image-container {
        height: auto;
        padding-bottom: 0;
    }
}

.product-images-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Fallback positioning for browsers without aspect-ratio */
@supports not (aspect-ratio: 1) {
    .product-images-slider {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.product-image.active {
    opacity: 1;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

/* Ensure lazy loading wrapper takes full size */
.product-image .image-loading,
.product-image .color-palette-reveal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important;
}


/* Image Indicators */
.image-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 15;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.indicator {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
    position: relative;
}

.indicator.active {
    background: white;
    transform: scale(1.3);
}

.indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

/* Touch feedback for indicators */
.indicator:active {
    transform: scale(0.9);
}

/* Enhanced mobile indicators */
@media (max-width: 768px) {
    .image-indicators {
        bottom: 8px;
        gap: 4px;
        padding: 3px 6px;
    }

    .indicator {
        width: 6px;
        height: 6px;
    }

    .indicator.active {
        width: 8px;
        height: 8px;
    }
}

/* Touch feedback for product image container */
.product-image-container.touching {
    cursor: grabbing;
}

.product-image-container.touching .product-images-slider {
    transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}

/* Swipe animation classes */
.product-image.animate-out-next {
    animation: slideOutLeft 0.3s ease-out forwards;
}

.product-image.animate-out-prev {
    animation: slideOutRight 0.3s ease-out forwards;
}

.product-image.animate-in-next {
    animation: slideInRight 0.3s ease-out forwards;
}

.product-image.animate-in-prev {
    animation: slideInLeft 0.3s ease-out forwards;
}

/* Swipe animation keyframes */
@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile touch optimizations */
@media (max-width: 768px) {
    .product-image-container {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .product-image-container.touching {
        transform: scale(0.98);
        transition: transform 0.1s ease-out;
    }

    /* Enhanced visual feedback on mobile */
    .image-indicators {
        opacity: 0.9;
    }

    .product-image-container:hover .image-indicators {
        opacity: 1;
    }
}

/* Smooth transitions for all states */
.product-images-slider {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Prevent text selection during swipe */
.product-image-container.touching * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}


/* Product Info Section */
.product-card .p-4 {
    padding: 20px;
}

.product-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-text-color);
    margin-bottom: 16px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card h3:hover {
    color: var(--primary-text-color-hover);
    transition: color 0.2s ease;
}

/* Price Container */
.price-container {
    flex: 1;
}

.price-container del {
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: line-through;
    margin-bottom: 4px;
    display: block;
}

.price-container .font-bold {
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1.2;
}

.price-container .text-red-600 {
    color: #ef4444;
}

.price-container .text-gray-900 {
    color: #1a1a1a;
}

/* Product Info Bottom Section */
.product-card .flex.justify-between.items-center {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    min-height: 60px;
}

/* Action Buttons */
.product-card .flex.space-x-2 {
    display: flex;
    gap: 8px;
    align-self: flex-end;
}

.add_to_cart_button {
    width: 40px;
    height: 40px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--product-card-cart);
    color: var(--white-text);
    text-decoration: none;
}

.add_to_cart_button:hover {
    background: var(--product-card-cart-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-boxshadow);
}

/* Button Icons */
.add_to_cart_button svg {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
}

.add_to_cart_button:hover svg {
    transform: scale(1.1);
}

/* Loading States */
.add_to_cart_button.loading {
    pointer-events: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-boxshadow);
}

/* Hide icon when loading */
.add_to_cart_button.loading svg {
    opacity: 0;
    transform: scale(0.5);
}

/* Beautiful loading spinner */
.add_to_cart_button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: elegant-spin 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes elegant-spin {
    0% {
        transform: rotate(0deg) scale(0.8);
        opacity: 0.8;
    }

    50% {
        transform: rotate(180deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: rotate(360deg) scale(0.8);
        opacity: 0.8;
    }
}

/* Ripple Effect for Buttons */
.add_to_cart_button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    z-index: 5;
}

.add_to_cart_button:active::before {
    width: 40px;
    height: 40px;
}

/* Hide ripple effect when loading */
.add_to_cart_button.loading::before {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-card .p-4 {
        padding: 16px;
    }

    .product-card h3 {
        font-size: 0.875rem;
        margin-bottom: 12px;
    }

    .add_to_cart_button {
        width: 36px;
        height: 36px;
    }

    .add_to_cart_button svg {
        width: 18px;
        height: 18px;
    }

    /* Mobile Badge Adjustments */
    .product-badges-container {
        padding: 8px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .product-badge {
        font-size: 0.6875rem;
        padding: 5px 8px;
        gap: 4px;
        border-radius: 5px;
    }

    .badge-icon {
        width: 12px;
        height: 12px;
    }

    .badge-text {
        font-size: 0.6875rem;
    }

    /* Enhanced mobile touch area */
    .product-image-container {
        touch-action: pan-y;
        /* Allow vertical scrolling but prevent horizontal */
    }

    /* Improved mobile indicators */
    .image-indicators {
        bottom: 12px;
        gap: 6px;
        padding: 6px 10px;
        background: rgba(0, 0, 0, 0.5);
    }

    .indicator {
        width: 8px;
        height: 8px;
        touch-action: manipulation;
        /* Improve touch responsiveness */
    }

    .indicator.active {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .product-card h3 {
        font-size: 0.8125rem;
    }

    .price-container .font-bold {
        font-size: 1rem;
    }

    .add_to_cart_button {
        width: 32px;
        height: 32px;
    }

    .add_to_cart_button svg {
        width: 16px;
        height: 16px;
    }

    /* Extra Small Screen Badge Adjustments */
    .product-badges-container {
        padding: 6px;
        gap: 4px;
    }

    .product-badge {
        font-size: 0.625rem;
        padding: 4px 7px;
        gap: 3px;
        border-radius: 4px;
    }

    .badge-icon {
        width: 11px;
        height: 11px;
    }

    .badge-text {
        font-size: 0.625rem;
    }

    /* Ultra-compact mobile indicators */
    .image-indicators {
        bottom: 8px;
        gap: 4px;
        padding: 4px 6px;
    }

    .indicator {
        width: 6px;
        height: 6px;
    }

    .indicator.active {
        width: 8px;
        height: 8px;
    }
}

/* Hover Effects for Better UX */
.product-image-container:hover .image-indicators {
    opacity: 1;
}

.image-indicators {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* Focus States for Accessibility */
.add_to_cart_button:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid #000;
    }

    .badge {
        border: 1px solid #000;
    }

    .add_to_cart_button {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .product-card,
    .product-image img,
    .add_to_cart_button,
    .product-badge,
    .indicator,
    .product-images-slider,
    .image-indicators {
        transition: none !important;
        animation: none !important;
    }

    .product-image.animate-out-next,
    .product-image.animate-out-prev,
    .product-image.animate-in-next,
    .product-image.animate-in-prev {
        animation: none !important;
        transition: opacity 0.1s linear !important;
    }


}

/* Mobile performance optimizations */
@media (max-width: 768px) {

    /* Hardware acceleration for smooth animations */
    .product-image-container,
    .product-images-slider,
    .product-image {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform, opacity;
    }

    /* Optimize image rendering */
    .product-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        image-rendering: pixelated;
    }

    /* Shadow removed from indicators for cleaner look */
}

/* Touch accessibility improvements */
.product-image-container {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

/* Focus visible for keyboard navigation */
.product-image-container:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.indicator:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 1px;
    border-radius: 50%;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    .image-indicators {
        background: rgba(0, 0, 0, 0.8);
        border: 1px solid #fff;
    }

    .indicator {
        border: 1px solid #fff;
    }

    .indicator.active {
        background: #fff;
        border-color: #000;
    }

    /* Badge high contrast support */
    .product-badge {
        border: 2px solid #fff;
    }

    .sale-badge,
    .stock-badge.stock-out {
        background: #dc2626;
    }

    .stock-badge.stock-low {
        background: #d97706;
    }

    .stock-badge.stock-available {
        background: #059669;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .image-indicators {
        background: rgba(255, 255, 255, 0.2);
    }

    .indicator {
        background: rgba(255, 255, 255, 0.4);
    }

    .indicator.active {
        background: #fff;
    }


}

/* Grid View Responsive Adjustments */
@media (max-width: 1024px) {
    .product-image-container {
        aspect-ratio: 1;
        /* Maintain 1:1 aspect ratio on all screen sizes */
    }
}

@media (max-width: 768px) {
    .product-image-container {
        aspect-ratio: 1;
        /* Maintain 1:1 aspect ratio on mobile */
    }

    .product-image img {
        object-fit: cover;
        object-position: center;
    }
}

@media (max-width: 480px) {
    .product-image-container {
        aspect-ratio: 1;
        /* Maintain 1:1 aspect ratio on small screens */
    }
}

/* Force image reflow on grid changes */
.product-grid.grid-cols-1 .product-image img,
.product-grid.grid-cols-2 .product-image img,
.product-grid.grid-cols-3 .product-image img,
.product-grid.grid-cols-4 .product-image img,
.product-grid.grid-cols-5 .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* =
=========================================================================
   VERTICAL PRICE DISPLAY
   ========================================================================== */

/* Unified Price Container */
.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-height: 60px;
    justify-content: flex-end;
    flex: 1;
}

/* Old Price (Crossed Out) */
.price-container .old-price {
    order: 1;
    margin-bottom: 0;
}

.price-container .old-price del {
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: line-through;
    margin-bottom: 0;
    display: inline;
}

/* Current Price */
.price-container .current-price {
    order: 2;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
    color: #1a1a1a;
    margin-top: 2px;
    align-self: flex-start;
}

/* Mobile Responsive for Price Display */
@media (max-width: 768px) {
    .price-container {
        min-height: 50px;
    }

    .price-container .old-price del {
        font-size: 0.8125rem;
    }

    .price-container .current-price {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .price-container {
        min-height: 45px;
    }

    .price-container .old-price del {
        font-size: 0.75rem;
    }

    .price-container .current-price {
        font-size: 1rem;
    }
}

/* Catalog Mode Message */
.catalog-mode-message {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 8px 0;
}

.catalog-contact-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: var(--product-card-cart);
    color: var(--white-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.catalog-contact-button:hover {
    background: var(--product-card-cart-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}