/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.modal-active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 20px;
    max-width: 900px;
    width: 90%;
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.7);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.modal-active .modal-container {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.modal-close i {
    color: #5d4e37;
    font-size: 1.2rem;
}

.modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 400px;
    max-height: none;
}

.modal-image-section {
    background: #f8f6f2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    min-height: 300px;
    max-height: 400px;
    overflow: hidden;
}

.image-zoom-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.image-zoom-container.zoomed {
    cursor: zoom-out;
}

.modal-product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 15px;
    transition: transform 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.modal-info-section {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
}

.modal-title {
    font-size: 2rem;
    color: #5d4e37;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', Georgia, serif;
}

.modal-description {
    margin-bottom: 2rem;
}

.modal-description p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #8b7355;
    text-align: justify;
}

.modal-characteristics {
    margin-bottom: 2rem;
}

.modal-characteristics h3 {
    font-size: 1.3rem;
    color: #5d4e37;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', Georgia, serif;
}

.characteristics-list {
    list-style: none;
    padding: 0;
}

.characteristics-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    color: #8b7355;
    font-size: 1rem;
}

.characteristics-list i {
    color: #d4af37;
    font-size: 0.8rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #d4af37, #f4e4bc);
    color: #5d4e37;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: transparent;
    color: #5d4e37;
    border: 2px solid #d4af37;
}

.btn-secondary:hover {
    background: #d4af37;
    color: white;
    transform: translateY(-2px);
}

/* Enhanced Product Item Styles */
.product-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.product-item.loaded {
    opacity: 1;
    transform: translateY(0);
}

.product-item.error .product-image {
    opacity: 0.5;
}

/* Fallback Image Styles */
.product-image.fallback,
.modal-product-image.fallback {
    background: linear-gradient(135deg, #f8f6f2 0%, #e8e4d8 100%);
    border: 2px dashed #d4af37;
    position: relative;
}

.product-image.fallback::before,
.modal-product-image.fallback::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwIDVMMzAgMTVIMjVWMzVIMTVWMjVIMTBMMjAgNVoiIGZpbGw9IiNENEFGMzciLz4KPC9zdmc+') no-repeat center;
    background-size: contain;
    opacity: 0.3;
}

/* Loading States */
.product-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #d4af37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.product-image.loaded + .product-image-container::before {
    opacity: 0;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Loading Placeholder */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #8b7355;
    font-size: 1.1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #d4af37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-placeholder p {
    margin: 0;
    font-weight: 500;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .modal-image-section {
        padding: 1rem;
        min-height: 300px;
    }
    
    .modal-info-section {
        padding: 1.5rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        margin: 10px;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    .modal-description p {
        font-size: 1rem;
    }
}

/* Height-based responsive design */
@media (max-height: 600px) {
    .modal-container {
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .modal-image-section {
        min-height: 200px;
        max-height: 250px;
        padding: 1rem;
    }
    
    .modal-details-section {
        padding: 1rem;
    }
    
    .modal-product-title {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }
    
    .modal-product-description {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
}

/* Image Zoom Enhancement */
.image-zoom-container.zoomed .modal-product-image {
    transform: scale(1.5);
    cursor: zoom-out;
}

/* Hover Effects for Product Items */
.product-item:hover .product-image-container {
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.2);
}

.product-item:hover .product-name {
    color: #d4af37;
}

/* Accessibility */
.modal-overlay:focus-within {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.btn-primary:focus,
.btn-secondary:focus,
.modal-close:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

/* Image Gallery Styles */
.image-gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.image-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-arrow {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-arrow:disabled {
    background: rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
    transform: none;
}

.left-arrow {
    margin-right: 15px;
}

.right-arrow {
    margin-left: 15px;
}

.image-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
}

.image-gallery {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-slide.active {
    opacity: 1;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    /* Image Protection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.gallery-image:hover {
    transform: scale(1.05);
}

.gallery-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.gallery-prev,
.gallery-next {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

.gallery-prev:hover,
.gallery-next:hover {
    background: white;
    transform: scale(1.1);
}

.gallery-prev i,
.gallery-next i {
    color: #5d4e37;
    font-size: 1.2rem;
}

.gallery-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #d4af37;
    transform: scale(1.2);
}

.indicator:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* Variant Selection Styles */
.variant-selection {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f6f2;
    border-radius: 15px;
    border: 2px solid #e8e4d8;
}

.variant-selection h3 {
    font-size: 1.3rem;
    color: #5d4e37;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', Georgia, serif;
    text-align: center;
}

.variant-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.variant-option {
    background: white;
    border: 2px solid #e8e4d8;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.variant-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.1), transparent);
    transition: left 0.5s ease;
}

.variant-option:hover::before {
    left: 100%;
}

.variant-option:hover {
    border-color: #d4af37;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.2);
}

.variant-option.selected {
    border-color: #d4af37;
    background: linear-gradient(135deg, #f4e4bc, #fff);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.variant-option.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: #d4af37;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.variant-size {
    font-size: 1.1rem;
    font-weight: 600;
    color: #5d4e37;
    margin-bottom: 0.5rem;
    font-family: 'Playfair Display', Georgia, serif;
}

/* .variant-price removed - no longer showing prices */

/* Enhanced Modal Actions */
.modal-actions .btn-primary {
    flex: 1;
    min-width: 200px;
    justify-content: center;
}

/* Touch/Swipe Indicators */
.gallery-slide::after {
    content: '← Swipe to view more →';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-slide:first-child:not(:last-child)::after {
    opacity: 1;
}

/* Responsive Variant Selection */
@media (max-width: 768px) {
    .variant-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.8rem;
    }
    
    .variant-option {
        padding: 0.8rem;
    }
    
    .variant-size {
        font-size: 1rem;
    }
    
    /* .variant-price removed - no longer showing prices */
    
    .gallery-prev,
    .gallery-next {
        width: 40px;
        height: 40px;
    }
    
    .gallery-prev {
        left: 10px;
    }
    
    .gallery-next {
        right: 10px;
    }
    
    .gallery-indicators {
        bottom: 10px;
    }
    
    .indicator {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .variant-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .variant-option {
        padding: 0.6rem;
    }
    
    .variant-size {
        font-size: 0.9rem;
    }
    
    /* .variant-price removed - no longer showing prices */
    
    .gallery-slide::after {
        font-size: 0.7rem;
        padding: 3px 10px;
    }
}

/* Animation for variant selection */
@keyframes variantSelect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.variant-option.selected {
    animation: variantSelect 0.3s ease;
}

/* Gallery slide transition effects */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.gallery-slide.slide-in-right {
    animation: slideInRight 0.5s ease;
}

.gallery-slide.slide-in-left {
    animation: slideInLeft 0.5s ease;
}

/* Print Styles */
@media print {
    .modal-overlay {
        position: static;
        background: white;
    }
    
    .modal-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .modal-close,
    .modal-actions,
    .gallery-controls,
    .gallery-indicators {
        display: none;
    }
    
    .gallery-slide {
        position: static;
        opacity: 1;
        page-break-inside: avoid;
    }
}
