/**
 * Custom Carousel Styles with Swiper
 * 
 * Responsive styles for the Swiper-powered product carousel
 */

/* Fix for initial zoom animation */
.swiper {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swiper.swiper-initialized {
    opacity: 1;
}

/* Critical for smooth transitions */
.swiper-free-mode > .swiper-wrapper {
    transition-timing-function: linear !important;
}

/* Main carousel container */
.c-carousel {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    margin: 2rem 0;
}

.c-carousel__wrapper.swiper {
    position: static;
}

.c-carousel__inner-wrapper.swiper-wrapper {
    display: flex;
    align-items: center;
}

/* Individual carousel items */
.c-carousel__item.swiper-slide {
    position: relative;
    transition: all 0.3s ease;
    text-align: center;
}

/* Product image styling */
.c-carousel__item img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: all 0.3s ease;
}

/* === Shop Me Badge (shown on hover for in-stock products) === */
.shop-me-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg) scale(0.8);
    background-color: rgba(0, 0, 0, 1);
    color: #fff;
    padding: 0.5rem 1.5rem;
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    z-index: 2;
    pointer-events: none;
    border: 1.5px solid #fff;
    box-shadow: 0 1.5px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
}

/* Show shop-me-badge on hover */
.c-carousel__item:not(.sold-out):hover .shop-me-badge {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Make sure links are clickable */
.c-carousel__item a {
    display: block;
    position: relative;
    z-index: 3;
    cursor: pointer;
}

/* Optional: Scale effect on hover */
.c-carousel__item:hover {
    transform: scale(1.03);
}


/* === Product Modal Window === */
#product-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
}

.product-modal-window {
    width: 90%;
    height: 90%;
    max-height: 90vh;
    max-width: 90vw;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 1;
    z-index: 1;
    pointer-events: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    background-color: #fff;
}


/* Remove window-header grabbing cursor for this specific modal */
.product-modal-window .window-header {
    cursor: default;
}

#product-modal {
    display: flex;
    flex-direction: column;
}

.product-modal-content {
    padding: 0;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 100%;
}

/* Product layout wrapper - this is the new container */
/* .product-modal-wrapper {
    display: flex;
    width: 100%;
    max-height: 90%;
    margin: auto;
} */

/* Styling for the loading spinner */
.product-modal-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: #007aff;
    border-radius: 50%;
    animation: spinner 1s ease-in-out infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Product details content */
#product-details-content {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
}

/* Custom Modal Layout - New Design with Image Navigation and Zoom */
.product-modal-layout {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    height: 100%;
}

/* Product Image Column */
.product-image-column {
    flex: 1 1 50%;
    min-width: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    justify-content: center;
}

/* Main Product Image with Navigation */
.main-image {
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1rem;
    user-select: none;
}

/* Image container to hold the image with flex ordering */
.image-container {
    display: flex;
    align-items: center;
    height: 100%;
    justify-content: center;
    gap: 2rem; /* Space between image and arrows */
}

.main-image img {
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    order: 2; /* Place image between navigation arrows */
}

/* Image Navigation Arrows - Positioned directly adjacent to the image */
.image-nav-arrow {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    background: none;
}

.image-nav-arrow:hover {
    opacity: 0.7;
}

.image-nav-arrow .arrow-icon {
    width: 2rem;
    height: auto;
    transition: transform 0.2s ease;
}

.image-nav-arrow:hover .arrow-icon {
    transform: scale(1.2);
}

.image-nav-prev {
    order: 1; /* Position before the image */
}

.image-nav-next {
    order: 3; /* Position after the image */
}

/* Image thumbnails strip */
.product-thumbnails {
    display: flex;
    gap: 2rem;
    justify-content: center;
    width: 80%;
    margin: 0 auto;
    user-select: none;
}

.thumbnail {
    height: 100%;
    cursor: pointer;
    opacity: 0.7;
    overflow: hidden;
}

.thumbnail.active {
    position: relative;
    opacity: 1;
}

/* Add overlay effect to active thumbnail */
.thumbnail.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(90, 90, 90, 0.1);
    pointer-events: none;
}

.thumbnail:hover {
    opacity: 1;
}

.thumbnail img {
    width: auto;
    height: 100%;
    object-fit: contain;
    margin: auto;
}

/* Product Info Column with Zoom Window */
.product-info-column {
    flex: 1 1 50%;
    min-width: 280px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    background-color: var(--window-bg, #fff);
    overflow-y: auto;
    justify-content: center;
}

/* Zoom Window */
.zoom-window {
    height: 30vh;
    width: 80%;
    border: 1px solid #e0e0e0;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
    opacity: 1;
}

.zoom-window-content {
    position: relative;
    overflow: hidden;
    height: 100%;
}

.zoom-image {
    position: absolute;
    transform-origin: 0 0;
    width: 100%;
    height: auto;
    pointer-events: none;
}

/* Product Title */
.product-title {
    text-transform: uppercase;
    font-size: clamp(1.25rem, 2vw, 2rem);
    margin: 0.5rem 0 0.5rem 0;
    padding: 0;
    line-height: 1.2;
    letter-spacing: 0.05em;
    font-weight: bold;
}

/* Product Details */
.product-details {
    margin-bottom: 1rem;
    font-size: var(--font-size-base);
    line-height: 1.0;
    width: 80%;
    max-width: 800px;
    white-space: pre-line;
}

.product-details p {
    margin-bottom: 1rem;
}

/* Product Price */
.product-price {
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 1rem; /* Reduced space before add to cart button */
    color: #000;
}


/* Product Meta Information */
.product-meta {
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #333;
    line-height: 1.8;
}

.product-meta div {
    margin-bottom: 0.5rem;
    text-transform: none;
}

.product-specs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Add to Cart Button */
.add-to-cart {
    position: relative; /* For spinner positioning */
    display: flex;
    flex-direction: column; /* Stack items vertically */
    align-items: flex-start; /* Align items to the start */
    gap: 1rem; /* Space between quantity selector and button area */
    width: 80%; /* Match other info column elements */
    max-width: 800px;
    margin-top: .6em;
}

/* Wrapper for the button and spinner */
.add-to-cart-action {
    display: flex;
    align-items: center; /* Vertically align button and spinner */
    gap: 0.5rem; /* Space between button and spinner */
}

.add-to-cart-btn {
    display: inline-block;
    width: 200px;
    /* min-width: 180px;
    background-color: #30302F;
    color: #fff !important; */
    padding: 0.2rem;
    text-transform: uppercase;
    font-family: 'RetroComputer', monospace;
    letter-spacing: 0.05em;
    font-size: 1.2rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    text-align: center;
}

.add-to-cart-btn.image-button {
    background: transparent;
}

.add-to-cart-btn:hover:not(:disabled) img {
    filter: grayscale(0) brightness(1.4);
}

/* .add-to-cart-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
} */

.add-to-cart-btn:disabled img {
    filter: grayscale(1) brightness(1.5) opacity(0.5);
    pointer-events: none;
}

.add-to-cart-btn[aria-label="Select options"] img,
.add-to-cart-btn[aria-label="Out of stock"] img {
    filter: grayscale(1) brightness(1.5) opacity(0.5);
    pointer-events: none;
}

/* Loading spinner for add to cart button */
.add-to-cart-spinner {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.add-to-cart .stock,
.variation-availability .stock {
    margin-bottom: 0;
    font-weight: 700;
    color: #4c0;
}


.stock.out-of-stock {
    color: red;
}

.add-to-cart .stock {
    margin-bottom: 0.5rem;
}

.variation-availability {
    margin-left: 0.6em;
    margin-top: 0.3em;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0.6em;
    width: auto; /* Adjust width as needed */
}

/* New container for input and buttons */
.quantity-input-container {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden; /* Clip button borders */
    background-color: #fff;
}

.quantity-input {
    width: 30px !important; /* Adjust width */
    text-align: center;
    /* Remove spinner arrows for number input */
    -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* New styles for quantity buttons */
.quantity-button {
    background-color: #f0f0f0;
    border: none;
    /* border-left: 1px solid #ccc; */ /* Separator line */
    cursor: pointer;
    padding: 0.3rem 0.5rem; /* Adjust padding */
    font-size: 1rem;
    line-height: 1;
    color: #555;
    transition: background-color 0.2s ease;
    user-select: none;
}

.quantity-button:hover {
    background-color: #e0e0e0;
}

.quantity-button:active {
    background-color: #d0d0d0;
}

.quantity-button.decrease {
    border-left: none;
    /* border-right: 1px solid #ccc; */ /* Separator on the right for decrease */
}

.out-of-stock-message {
    width: 80%;
    max-width: 800px;
    text-align: center;
    padding: 1rem;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #777;
    font-style: italic;
}

.out-of-stock-message p {
    margin: auto;
}

/* Current Image Indicator */
.image-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.8rem;
}

/* Custom font for Add to Cart button */
@font-face {
    font-family: 'RetroComputer';
    src: url('../fonts/retro_computer.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}




/* Responsive Adjustments */
@media (max-height: 900px) {
    .zoom-window {
        height: 20vh;
    }
}

@media (max-width: 768px) {
    .product-modal-window {
        width: 95%;
        height: 95vh;
        max-width: 100%;
    }
    
    .product-modal-content {
        height: calc(95vh - 40px);
    }
    
    .product-modal-wrapper {
        max-height: 95%;
        flex-direction: column;
        overflow-y: auto;
    }
    
    .product-image-column,
    .product-info-column {
        flex: 1 1 100%;
    }
    
    .product-image-column {
        padding: 1.5rem 1.5rem 1rem 1.5rem;
    }
    
    .product-info-column {
        padding: 1rem 1.5rem 1.5rem 1.5rem;
    }
    
    .main-image img {
        max-height: 40vh;
    }
    
    .zoom-window {
        height: 150px;
    }
    
    .thumbnail {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .product-modal-window {
        width: 100%;
        height: 100vh;
        top: 0;
        left: 0;
        transform: none;
        max-height: 100vh;
    }
    
    .product-modal-content {
        height: calc(100vh - 40px);
    }
    
    .product-image-column,
    .product-info-column {
        padding: 1rem;
    }
    
    .zoom-window {
        height: 120px;
    }
    
    .image-nav-arrow {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }
    
    .thumbnail {
        width: 45px;
        height: 45px;
    }
}

/* Prevent body scrolling when modal is open */
body.modal-open {
    overflow: hidden;
}

/* macOS-style Notifications */
.macos-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 350px;
    backdrop-filter: blur(5px); /* Optional: Add blur effect */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.notification-icon {
    font-size: 1.2rem;
    margin-right: 12px;
}

.notification-content {
    flex-grow: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0 0 0 10px;
    line-height: 1;
}

.macos-notification.error .notification-title {
    color: #d9534f; /* Reddish color for error */
}