/**
 * Coffee Shop Theme - Products Swiper Styles
 * 
 * Modern Swiper implementation for the products carousel
 * Light theme only - no dark mode support
 */

/* ========================================
   PRODUCTS CAROUSEL SECTION
   ======================================== */

.products-carousel-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

/* ========================================
   SWIPER CONTAINER STYLES
   ======================================== */

.coffeeshop-products-swiper {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding-bottom: 40px !important; /* Space for pagination */
    padding-left: 10px;
    padding-right: 10px;
}

/* Equal height slides */
.coffeeshop-products-swiper .swiper-wrapper {
    align-items: stretch;
    height: auto;
}

.coffeeshop-products-swiper .swiper-slide {
    height: auto;
    display: flex;
    pointer-events: auto; /* Ensure that pointer events work properly */
}

/* Explicitly ensure all clickable elements work properly */
.swiper-slide a,
.swiper-slide button,
.swiper-slide .product-card,
.swiper-slide .product-title,
.swiper-slide .add-to-cart {
    position: relative;
    z-index: 1; /* Higher than swiper controls */
    pointer-events: auto;
}

/* ========================================
   PRODUCT CARD STYLES
   ======================================== */

.swiper-slide .product-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.swiper-slide .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.product-card .image-container {
    position: relative;
    overflow: hidden;
    padding-top: 75%; /* 4:3 aspect ratio */
}

.product-card .image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .image-container img {
    transform: scale(1.05);
}

.product-card .product-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.product-card .product-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: #1a202c;
    line-height: 1.4;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card:hover .product-title {
    color: #06594e;
}

.product-card .product-price {
    font-weight: 700;
    color: #06594e;
    margin: 0.75rem 0;
    font-size: 1.25rem;
}

.product-card .add-to-cart {
    display: inline-block;
    background: #06594e;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-align: center;
    cursor: pointer;
    border: none;
    width: 100%;
}

.product-card .add-to-cart:hover {
    background: #054a40;
    transform: translateY(-2px);
}

/* Sale badge */
.product-card .sale-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #e53e3e;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    z-index: 10;
}

/* ========================================
   NAVIGATION STYLES
   ======================================== */

.products-swiper-button-next,
.products-swiper-button-prev {
    width: 50px !important;
    height: 50px !important;
    background-color: rgba(6, 89, 78, 0.9) !important;
    border-radius: 50%;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.products-swiper-button-next:after,
.products-swiper-button-prev:after {
    font-size: 18px !important;
    font-weight: bold;
}

.products-swiper-button-next:hover,
.products-swiper-button-prev:hover {
    background-color: rgba(6, 89, 78, 1) !important;
    transform: scale(1.1);
}

/* Position the navigation arrows */
.products-swiper-button-prev {
    left: 10px !important;
}

.products-swiper-button-next {
    right: 10px !important;
}

/* ========================================
   PAGINATION STYLES
   ======================================== */

.products-swiper-pagination {
    bottom: 0 !important;
}

.products-swiper-pagination .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(6, 89, 78, 0.3);
    opacity: 1;
    transition: all 0.3s ease;
}

.products-swiper-pagination .swiper-pagination-bullet-active {
    background: rgba(6, 89, 78, 1);
    transform: scale(1.2);
}

/* ========================================
   LOADING ANIMATION
   ======================================== */

.swiper-slide-loading {
    position: relative;
}

.swiper-slide-loading:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swiper-slide-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(6, 89, 78, 0.3);
    border-top-color: rgba(6, 89, 78, 1);
    border-radius: 50%;
    z-index: 11;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Mobile styles */
@media (max-width: 640px) {
    .products-swiper-button-next,
    .products-swiper-button-prev {
        width: 40px !important;
        height: 40px !important;
    }
    
    .products-swiper-button-next:after,
    .products-swiper-button-prev:after {
        font-size: 16px !important;
    }
    
    .product-card .product-title {
        font-size: 1rem;
    }
    
    .product-card .product-price {
        font-size: 1.1rem;
    }
}

/* Hide navigation arrows on small screens */
@media (max-width: 768px) {
    .products-swiper-button-next,
    .products-swiper-button-prev {
        display: none !important;
    }
}

/* Make product cards more compact on small screens */
@media (max-width: 640px) {
    .product-card .product-content {
        padding: 1rem;
    }
}

/* ========================================
   ACCESSIBILITY STYLES
   ======================================== */

.coffeeshop-products-swiper:focus-within {
    outline: 2px solid #06594e;
    outline-offset: 4px;
}

.product-card a:focus,
.product-card button:focus {
    outline: 2px solid #06594e;
    outline-offset: 2px;
    position: relative;
    z-index: 5; /* Ensure focus state is visible and clickable */
}

/* Make sure all interactive elements are clickable */
.swiper-slide a,
.swiper-slide button,
.swiper-slide .add_to_cart_button {
    cursor: pointer !important;
    position: relative;
    z-index: 5;
}

/* Screen reader text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading and added to cart states */
.add-to-cart.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.add-to-cart.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.add-to-cart.added {
    background: #047857;
}
