/* Product Detail Modal */
.product-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.product-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-modal-content {
    background: var(--secondary-color);
    border: 3px solid var(--primary-color);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.4s ease;
    box-shadow: 0 10px 50px rgba(236, 167, 1, 0.3);
}

.product-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 3px solid var(--primary-color);
    background: var(--secondary-color);
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 1rem;
}

.product-modal-header h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    flex: 1;
    min-width: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    background: rgba(236, 167, 1, 0.2);
    transform: rotate(90deg);
}

.product-modal-body {
    padding: 2rem;
}

.product-image-section {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: pan-y; /* allow vertical scroll, we handle horizontal swipes */
}

/* The loading spinner */
.loading-spinner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-top-color: var(--primary-color, #3498db); /* optional accent color */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none; /* hidden by default */
    z-index: 10; /* above the image */
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.product-image {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 240ms ease;  /* fade duration */
    will-change: opacity;
}

/* when loading, we fade the current image out */
.product-image.is-fading-out {
  opacity: 0;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-image-btns {
    position: absolute;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 2rem;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

.prev-image, .next-image {
    position: absolute;
    top: 45%;
}

.next-image {
    right: 0;
}
.prev-image {
    left: 0;
}

.panorama-btn {
    position: absolute;
    bottom: 0;
    right: 0;
}

.next-image, .prev-image, .panorama-btn {
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.panorama-modal {
    display: none;
    position: fixed;
    z-index: 2500;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}
.panorama-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}
.panorama-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}
.panorama-modal-header {
    position: absolute;
    top: 1rem;
    right: 0;
    left: 0;
    z-index: 10;
}
.panorama-modal-header #panoramaTitle {
    font-family: "Montserrat", sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 10px;
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
}
.panorama-modal .modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
}
.image-panorama-view {
    width: 100%;
    height: auto;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 50px rgba(236, 167, 1, 0.3);
    cursor: e-resize;
}
.panorama-arrows {
    position: absolute;
    bottom: -70px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    box-sizing: border-box;
    pointer-events: none; /* allow clicks to pass through */
}
.panorama-arrows span {
    color: white;
    cursor: pointer;
    pointer-events: all; /* enable pointer events on arrows */
    user-select: none;
    background-repeat: no-repeat;
    background-size: contain;
    width: 160px;
    height: 40px;
}

.product-info-section {
    color: white;
}

.info-group {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(236, 167, 1, 0.1);
    border-left: 4px solid var(--primary-color);
}

.info-group h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-group h3::before {
    content: '⚠';
    font-size: 1.5rem;
}

.specs-list {
    list-style: none;
    padding: 0;
}

.specs-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(236, 167, 1, 0.2);
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
}

.specs-list li:last-child {
    border-bottom: none;
}

.spec-label {
    font-weight: bold;
    color: var(--primary-color);
}

.spec-value {
    color: white;
}

.features-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.features-list li {
    padding: 0.75rem;
    background: rgba(26, 26, 26, 0.5);
    border-left: 3px solid var(--primary-color);
    font-size: 1rem;
}

.features-list li::before {
    content: '✓ ';
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 0.5rem;
}

.info-group p {
    line-height: 1.8; 
    font-size: 1.1rem;
}

.contact-product-btn {
    width: 100%;
    margin-top: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .prev-image button, .next-image button {
        padding: 0.6rem;
    }

    .panorama-btn button {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 520px) {
    .product-modal-header h2 {
        font-size: 1.5rem;
    }

    .prev-image button, .next-image button {
        padding: 0.3rem;
        font-size: 0.8rem;
    }

    .panorama-btn button {
        padding: 0.4rem;
        font-size: 0.6rem;
    }

    .panorama-modal-header #panoramaTitle {
        font-size: 0.9rem;
    }

    .specs-list li, .features-list li {
        font-size: 0.8rem;
    }

    .info-group p {
        font-size: 0.8rem;
    }

    .contact-product-btn {
        font-size: 0.8rem;
        margin-top: 0;
        padding: 0.8rem;
    }
}