﻿/* Custom Lightbox Styles - Bootstrap 3.x Compatible */
.custom-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    cursor: pointer;
}

    .custom-lightbox.active {
        display: block;
    }

.lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    font-family: Arial, sans-serif;
    transition: opacity 0.3s ease;
}

    .lightbox-close:hover {
        opacity: 0.7;
    }

    .lightbox-close:focus {
        outline: none;
        opacity: 0.7;
    }

.lightbox-title {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    word-wrap: break-word;
}

    .lightbox-title .price {
        color: #ff6b6b;
        font-weight: bold;
        margin-left: 10px;
    }

/* Loading spinner */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: lightbox-spin 1s linear infinite;
}

@keyframes lightbox-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Enhanced zoom overlay for product images */
.zoom-item-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.product-img:hover .zoom-item-overlay,
a.preview:hover .zoom-item-overlay {
    opacity: 1;
}

/* Responsive adjustments - Updated for better mobile experience */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 98%;
        max-height: 95%;
        width: 95vw; /* Use viewport width for better mobile experience */
    }

    .lightbox-image {
        width: 100%;
        height: auto;
        max-height: 80vh; /* Ensure it doesn't exceed viewport height */
    }

    .lightbox-close {
        top: -35px;
        font-size: 25px;
    }

    .lightbox-title {
        bottom: -45px;
        font-size: 14px;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .lightbox-content {
        max-width: 99%;
        max-height: 90%;
        width: 96vw; /* Nearly full width on mobile */
    }

    .lightbox-image {
        width: 100%;
        height: auto;
        max-height: 75vh; /* More room for title on small screens */
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.8);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .lightbox-title {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        max-height: 20vh; /* Prevent title from taking too much space */
        overflow-y: auto; /* Allow scrolling if title is too long */
    }
}
/* Add these mobile-specific rules to your lightbox.css */

/* Force mobile detection */
@media screen and (max-device-width: 768px), screen and (max-width: 768px) and (orientation: portrait), screen and (max-width: 768px) and (orientation: landscape) {

    .lightbox-content {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        transform: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px;
        box-sizing: border-box;
    }

    .lightbox-image {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        object-fit: contain !important;
        display: block !important;
        margin: 0 auto !important;
    }

    .lightbox-close {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        z-index: 10001 !important;
        background: rgba(0, 0, 0, 0.9) !important;
        border-radius: 50% !important;
        width: 50px !important;
        height: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 24px !important;
        color: white !important;
    }

    .lightbox-title {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(0, 0, 0, 0.9) !important;
        color: white !important;
        padding: 15px !important;
        font-size: 14px !important;
        text-align: center !important;
        max-height: 15vh !important;
        overflow-y: auto !important;
        border-radius: 0 !important;
    }
}

/* Specific portrait mobile rules */
@media screen and (max-device-width: 480px) and (orientation: portrait), screen and (max-width: 480px) and (orientation: portrait) {

    .lightbox-image {
        max-width: 95vw !important;
        max-height: 85vh !important;
    }
}

/* Specific landscape mobile rules */
@media screen and (max-device-height: 480px) and (orientation: landscape), screen and (max-height: 480px) and (orientation: landscape) {

    .lightbox-image {
        max-width: 90vw !important;
        max-height: 75vh !important;
    }

    .lightbox-title {
        max-height: 20vh !important;
    }
}