/**
 * Stili Galleria Pubblica - Volantino Supermercato
 */

/* Gallery Wrapper */
.vs-gallery-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

/* Header */
.vs-gallery-header {
    text-align: center;
    margin-bottom: 50px;
}

.vs-gallery-title {
    font-size: 36px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.vs-gallery-title i {
    color: var(--vs-primary-color, #4CAF50);
}

.vs-gallery-subtitle {
    font-size: 18px;
    color: #6c757d;
    margin: 0;
}

/* Empty State */
.vs-gallery-empty {
    text-align: center;
    padding: 80px 40px;
    background: #f8f9fa;
    border-radius: 20px;
}

.vs-gallery-empty .vs-empty-icon {
    font-size: 72px;
    color: #dee2e6;
    margin-bottom: 24px;
}

.vs-gallery-empty p {
    font-size: 18px;
    color: #6c757d;
    margin: 0;
}

.vs-gallery-empty .vs-empty-hint {
    font-size: 14px;
    color: #adb5bd;
    margin-top: 12px;
}

/* Grid */
.vs-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
}

/* Grid columns based on count */
.vs-gallery-grid[data-columns="3"],
.vs-gallery-count-3 {
    grid-template-columns: repeat(3, 1fr);
}

.vs-gallery-grid-count-1 {
    grid-template-columns: minmax(0, 360px);
}

.vs-gallery-grid-count-2 {
    grid-template-columns: repeat(2, minmax(0, 360px));
}

.vs-gallery-count-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800px;
    margin: 0 auto;
}

.vs-gallery-count-1 {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
}

/* Gallery Item */
.vs-gallery-item {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    width: 100%;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.vs-gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Gallery Link */
.vs-gallery-link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 0 0 auto;
}

/* Image Wrapper */
.vs-gallery-image-wrapper {
    position: relative;
    height: 240px;
    overflow: hidden;
    background: #f6f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.vs-gallery-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.vs-gallery-item:hover .vs-gallery-image {
    transform: scale(1.08);
}

/* Overlay */
.vs-gallery-overlay {
    display: none;
}

.vs-gallery-item:hover .vs-gallery-overlay {
    display: none;
}

.vs-gallery-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--item-color, #4CAF50);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.vs-gallery-item:hover .vs-gallery-icon {
    transform: scale(1);
}

.vs-gallery-action {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vs-gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #5f6673;
    background:
        linear-gradient(135deg, rgba(76, 175, 80, 0.08), rgba(255, 152, 0, 0.08)),
        #f7f8fb;
}

.vs-gallery-placeholder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 116px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e2e6ee;
    box-shadow: 0 10px 24px rgba(22, 32, 54, 0.08);
    color: #d93025;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0;
}

.vs-gallery-placeholder-text {
    font-size: 13px;
    font-weight: 700;
    color: #747b88;
}

/* Label */
.vs-gallery-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 20px;
}

.vs-gallery-label {
    padding: 0;
    text-align: center;
    background: transparent;
    border-top: 0;
    flex: 1 1 auto;
}

.vs-gallery-category-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.vs-gallery-category-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: block;
    line-height: 1.35;
    margin: 0;
    overflow-wrap: anywhere;
}

/* Actions */
.vs-gallery-actions {
    display: flex;
    gap: 10px;
    padding: 18px 0 0;
    justify-content: center;
    flex: 0 0 auto;
}

.vs-btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 8px;
}

.vs-btn-view {
    background: var(--item-color, #4CAF50);
    color: #ffffff;
}

.vs-btn-view:hover {
    filter: brightness(0.9);
}

.vs-btn-download {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.vs-btn-download:hover {
    background: #e9ecef;
}

.vs-btn-sm i {
    font-size: 12px;
}

/* Lightbox */
.vs-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vs-lightbox-content {
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.vs-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    z-index: 10;
}

.vs-lightbox-close:hover {
    background: #ffffff;
    transform: rotate(90deg);
}

.vs-lightbox-body {
    flex: 1;
    overflow: hidden;
}

.vs-lightbox-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.vs-lightbox-footer {
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    text-align: center;
}

/* Button styles (shared) */
.vs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 992px) {
    .vs-gallery-grid,
    .vs-gallery-grid[data-columns="3"],
    .vs-gallery-count-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vs-gallery-count-2 {
        grid-template-columns: repeat(2, 1fr);
        max-width: none;
    }
    
    .vs-gallery-image-wrapper {
        height: 220px;
    }
    
    .vs-gallery-image {
        max-height: 100%;
    }
}

@media (max-width: 768px) {
    .vs-gallery-wrapper {
        padding: 24px 16px;
    }

    .vs-gallery-title {
        font-size: 24px;
        flex-direction: column;
        gap: 8px;
    }

    .vs-gallery-grid,
    .vs-gallery-grid[data-columns="3"],
    .vs-gallery-count-3,
    .vs-gallery-count-2,
    .vs-gallery-grid-count-1,
    .vs-gallery-grid-count-2 {
        grid-template-columns: 1fr;
        max-width: 420px;
        margin: 0 auto;
        gap: 22px;
    }
    
    .vs-gallery-image-wrapper {
        height: 190px;
        padding: 22px;
    }
    
    .vs-gallery-image {
        max-height: 100%;
        transform: none;
    }

    .vs-gallery-item {
        border-radius: 16px;
        transform: none;
    }

    .vs-gallery-item:hover {
        transform: none;
    }

    .vs-gallery-actions {
        flex-direction: column;
        gap: 12px;
    }

    .vs-gallery-actions .vs-btn-sm {
        width: 100%;
        text-align: center;
    }

    .vs-gallery-overlay,
    .vs-gallery-item:hover .vs-gallery-overlay {
        display: none;
    }

    .vs-gallery-item:hover .vs-gallery-image {
        transform: none;
    }

    .vs-lightbox-content {
        max-width: 100%;
        height: 95vh;
        border-radius: 0;
    }

    .vs-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Print styles */
@media print {
    .vs-gallery-wrapper {
        padding: 0;
    }

    .vs-gallery-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .vs-gallery-overlay,
    .vs-gallery-actions {
        display: none;
    }
}
