/* Product Intro Styles */
.product-intro {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(0, 255, 0, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 0, 0.2);
}

.product-intro p {
    color: #00ff00;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

/* Product Quote Styles */
.product-quote {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(0, 255, 0, 0.05);
    border-left: 4px solid #00ff00;
    border-radius: 0 8px 8px 0;
}

.product-quote blockquote {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    color: #00ff88;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.5;
}

.product-quote blockquote p {
    margin: 0;
}

/* Image Gallery Styles */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding: 0;
    /* Ensure consistent alignment */
    align-items: stretch;
}

/* Optimize for common image counts */
.image-gallery.gallery-2-items {
    grid-template-columns: repeat(2, 1fr);
}

.image-gallery.gallery-3-items {
    grid-template-columns: repeat(3, 1fr);
}

.image-gallery.gallery-4-items {
    grid-template-columns: repeat(4, 1fr);
}

.image-gallery.gallery-5-items {
    grid-template-columns: repeat(5, 1fr);
}

.image-gallery.gallery-6-items {
    grid-template-columns: repeat(3, 1fr);
}

.gallery-item {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 320px; /* Fixed height for consistency */
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
    border-color: #00ff88;
}

.gallery-item img {
    width: 100%;
    height: 200px; /* Fixed height */
    object-fit: cover; /* Crop to fit consistently */
    display: block;
    flex-shrink: 0;
    background: #001122; /* Fallback background */
}

/* Special handling for advertisement images */
.gallery-item img[alt*="advertisement"],
.gallery-item img[alt*="ad"] {
    object-fit: contain; /* Show full ad without cropping */
    background: rgba(0, 17, 34, 0.8);
}

.gallery-caption {
    padding: 1rem;
    color: #00ff00;
    font-size: 0.85rem;
    line-height: 1.3;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-caption strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #00ff88;
    font-size: 0.95rem;
    font-weight: bold;
}

/* Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #001122;
    border: 2px solid #00ff00;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #00ff00;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 17, 34, 0.8);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 255, 0, 0.2);
    transform: scale(1.1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1001;
    pointer-events: none;
}

.nav-btn {
    background: rgba(0, 17, 34, 0.8);
    border: 1px solid #00ff00;
    color: #00ff00;
    font-size: 24px;
    font-weight: bold;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px;
    min-height: 400px;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.modal-caption {
    background: rgba(0, 17, 34, 0.95);
    padding: 1.5rem;
    border-top: 1px solid #00ff00;
    color: #00ff00;
}

.modal-caption h3 {
    margin: 0 0 0.5rem 0;
    color: #00ff88;
    font-size: 1.2rem;
}

.modal-caption p {
    margin: 0 0 1rem 0;
    line-height: 1.5;
    font-size: 0.95rem;
}

.modal-counter {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
    font-family: monospace;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-intro {
        margin: 1rem 0;
        padding: 1rem;
    }
    
    .product-intro p {
        font-size: 1rem;
    }
    
    .product-quote {
        margin: 1.5rem 0;
        padding: 1rem;
    }
    
    .product-quote blockquote {
        font-size: 1rem;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.75rem;
    }
    
    /* Override specific layouts on tablets */
    .image-gallery.gallery-4-items,
    .image-gallery.gallery-5-items,
    .image-gallery.gallery-6-items {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-item {
        height: 280px; /* Slightly smaller on tablets */
    }
    
    .gallery-item img {
        height: 160px; /* Proportionally smaller */
    }
    
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .modal-image-container {
        padding: 50px 15px 15px;
        min-height: 300px;
    }
    
    .modal-caption {
        padding: 1rem;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .image-gallery,
    .image-gallery.gallery-2-items,
    .image-gallery.gallery-3-items,
    .image-gallery.gallery-4-items,
    .image-gallery.gallery-5-items,
    .image-gallery.gallery-6-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .gallery-item {
        height: 240px; /* Even smaller on phones */
    }
    
    .gallery-item img {
        height: 120px;
    }
    
    .modal-nav {
        padding: 0 10px;
    }
}

@media (max-width: 320px) {
    .image-gallery {
        grid-template-columns: 1fr; /* Single column on very small screens */
    }
}
