/* ============================================
   GALLERY MODAL - Premium Design
   ============================================ */

.gallery-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #f9fafb;
    transition: opacity var(--transition-smooth);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gallery-modal-container {
    width: 100%;
    max-width: var(--px-800);
    height: 100%;
    margin: 0 auto;
    background: white;
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.4s var(--transition-elegant);
}

/* Header */
.gallery-modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: var(--px-16) var(--px-20);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-back-gallery {
    display: flex;
    align-items: center;
    gap: var(--px-4);
    background: transparent;
    border: none;
    color: var(--color-green);
    font: normal normal 500 var(--s-14);
    cursor: pointer;
    transition: all var(--transition-smooth);
    padding: var(--px-4) var(--px-8);
    border-radius: var(--px-8);
}

.btn-back-gallery:hover {
    background: rgba(16, 185, 129, 0.1);
}

.gallery-title {
    flex: 1;
    text-align: center;
    font: normal normal 600 var(--s-18);
    color: #1f2937;
}

.btn-upload-gallery {
    width: var(--px-36);
    height: var(--px-36);
    border-radius: 50%;
    background: var(--color-green);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: var(--shadow-soft);
}

.btn-upload-gallery:hover {
    background: #15803d;
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

/* Upload Section */
.gallery-upload-section {
    padding: var(--px-16);
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    animation: slideInDown 0.3s var(--transition-elegant);
}

.gallery-upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--px-120);
    padding: var(--px-16);
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: var(--px-8);
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.gallery-upload-area:hover {
    border-color: var(--color-green);
    background: rgba(16, 185, 129, 0.05);
}

/* Tabs */
.gallery-tabs {
    display: flex;
    gap: var(--px-8);
    padding: var(--px-12) var(--px-16);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
}

.gallery-tab {
    display: flex;
    align-items: center;
    gap: var(--px-6);
    padding: var(--px-8) var(--px-16);
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: var(--px-20);
    font: normal normal 500 var(--s-13);
    color: #6b7280;
    cursor: pointer;
    transition: all var(--transition-smooth);
    white-space: nowrap;
}

.gallery-tab:hover {
    background: #f9fafb;
}

.gallery-tab.active {
    background: var(--color-green);
    color: white;
    border-color: var(--color-green);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--px-20);
    height: var(--px-20);
    padding: 0 var(--px-6);
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--px-10);
    font: normal normal 600 var(--s-11);
}

.gallery-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Content */
.gallery-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--px-16);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--px-12);
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--px-8);
    overflow: hidden;
    background: #f3f4f6;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-medium);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-smooth);
}

.gallery-item:hover .gallery-image {
    transform: scale(1.1);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.btn-view-image {
    width: var(--px-40);
    height: var(--px-40);
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.btn-view-image svg {
    width: var(--px-20);
    height: var(--px-20);
    color: #1f2937;
}

.btn-view-image:hover {
    transform: scale(1.1);
}

/* Loading State */
.gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--px-200);
    gap: var(--px-16);
}

.spinner-large {
    width: var(--px-40);
    height: var(--px-40);
    border: 4px solid #e5e7eb;
    border-top-color: var(--color-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Empty State */
.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--px-300);
    gap: var(--px-16);
    padding: var(--px-32);
    text-align: center;
}

.empty-icon {
    width: var(--px-64);
    height: var(--px-64);
    color: #d1d5db;
}

.empty-title {
    font: normal normal 600 var(--s-18);
    color: #1f2937;
    margin: 0;
}

.empty-text {
    font: normal normal 400 var(--s-14);
    color: #6b7280;
    max-width: var(--px-300);
    margin: 0;
}

.btn-upload-empty {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    padding: var(--px-12) var(--px-24);
    background: var(--color-green);
    color: white;
    border: none;
    border-radius: var(--px-8);
    font: normal normal 600 var(--s-14);
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: var(--shadow-soft);
}

.btn-upload-empty:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Image Viewer */
.image-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
}

.image-viewer-header {
    display: flex;
    justify-content: space-between;
    padding: var(--px-16);
}

.btn-close-viewer,
.btn-delete-image {
    width: var(--px-40);
    height: var(--px-40);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.btn-close-viewer:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-delete-image {
    background: rgba(239, 68, 68, 0.1);
}

.btn-delete-image:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-close-viewer svg,
.btn-delete-image svg {
    width: var(--px-24);
    height: var(--px-24);
    color: white;
}

.image-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--px-16);
    padding: var(--px-16);
}

.btn-prev-image,
.btn-next-image {
    width: var(--px-48);
    height: var(--px-48);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.btn-prev-image:hover,
.btn-next-image:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-prev-image:disabled,
.btn-next-image:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-prev-image svg,
.btn-next-image svg {
    width: var(--px-24);
    height: var(--px-24);
    color: white;
}

.viewer-image {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
}

.image-viewer-info {
    padding: var(--px-16);
    text-align: center;
}

.image-counter {
    font: normal normal 500 var(--s-14);
    color: white;
}

/* Responsive */
@media (max-width: 640px) {
    .gallery-modal-container {
        max-width: 100%;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--px-8);
    }

    .gallery-tabs {
        gap: var(--px-6);
    }

    .gallery-tab {
        padding: var(--px-6) var(--px-12);
        font: normal normal 500 var(--s-12);
    }
}