/* ================================================================
   css_components_gallery.css
   Westonaria Connect — split from style.css (lines 4365–5229)
   ================================================================ */

/* //////////////////////////////////////////////////////////////////////////////////////////////// */
/* GALLERY STYLES (gallery-styles.css) */
/* //////////////////////////////////////////////////////////////////////////////////////////////// */

/* Gallery Grid - Main Container */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
    animation: fadeIn 0.4s ease;
}

/* Individual Gallery Items */
.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Gallery Item Error State */
.gallery-item-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f5f5f5;
    color: #999;
}

.gallery-item-error i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.gallery-item-error span {
    font-size: 0.75rem;
}

/* Empty Gallery State */
.gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px dashed #ddd;
}

.gallery-empty i {
    color: #ccc;
    margin-bottom: 15px;
}

.gallery-empty p {
    font-size: 1rem;
    margin: 10px 0;
}

/* Thumbnail Gallery - For Business Cards */
.thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 12px;
}

.thumbnail-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
    position: relative;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s;
}

.thumbnail-item img:hover {
    opacity: 0.8;
}

/* "+X more" indicator */
.thumbnail-more {
    background: linear-gradient(135deg, rgba(0, 78, 100, 0.9), rgba(0, 96, 128, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thumbnail-more:hover {
    background: linear-gradient(135deg, rgba(0, 78, 100, 1), rgba(0, 96, 128, 1));
    transform: scale(1.05);
}

/* View All Photos Button */
.view-all-photos {
    margin-top: 15px;
    width: 100%;
}

/* ===================================
   LIGHTBOX - Full Screen Gallery
   ⭐ FIXED: Proper close functionality
   =================================== */

/* =============================================
   LIGHTBOX — Branded Teal / Cyan redesign
   ============================================= */

/* ── Shell ─────────────────────────────────── */
.gallery-lightbox {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1),
                visibility 0.3s cubic-bezier(0.4,0,0.2,1);
}
.gallery-lightbox.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
}
.gallery-lightbox.lightbox-hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ── Backdrop — deep obsidian + cyan tint ── */
.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(0,8,12,0.98) 0%, rgba(0,25,35,0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1;
}
/* Cyan accent line at top */
.lightbox-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-ocean);
    box-shadow: 0 0 24px rgba(0,217,255,0.7);
}

/* ── Content wrapper: full-viewport column ── */
.lightbox-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    padding: 60px 90px 0;      /* top: room for close btn; sides: room for arrows */
}

/* ── Image container — takes all remaining height ── */
.lightbox-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    padding: 8px;
}

#lightboxImage {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    object-fit: contain;
    object-position: center;
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1.5px rgba(0,217,255,0.25),
        0 0 50px rgba(0,217,255,0.12),
        0 40px 100px rgba(0,0,0,0.85);
    transition: opacity 0.25s ease, transform 0.2s ease;
    display: block;
}

/* ── Loader ── */
.lightbox-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--electric-cyan);
    font-size: 2.5rem;
    filter: drop-shadow(0 0 14px rgba(0,217,255,0.8));
}

/* ── Info bar ── */
.lightbox-info {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 32px;
    margin: 8px auto 0;
    background: rgba(0,8,12,0.7);
    border: 1px solid rgba(0,217,255,0.22);
    border-radius: var(--radius-full);
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

.lightbox-counter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: 0.07em;
    color: var(--electric-cyan);
    text-shadow: 0 0 12px rgba(0,217,255,0.55);
}
.lightbox-counter::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gradient-ocean);
    box-shadow: 0 0 10px rgba(0,217,255,0.9);
    flex-shrink: 0;
}

.lightbox-caption {
    margin: 0;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.65);
    font-weight: 500;
}

/* Divider between counter and caption */
.lightbox-info .lightbox-divider {
    width: 1px;
    height: 16px;
    background: rgba(0,217,255,0.25);
    flex-shrink: 0;
}

/* ── Thumbnail strip ── */
.lightbox-thumb-strip {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 12px 90px 16px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    scrollbar-width: none;
}
.lightbox-thumb-strip::-webkit-scrollbar { display: none; }

.lightbox-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.lightbox-thumb:hover {
    opacity: 0.85;
    border-color: rgba(0,217,255,0.5);
}
.lightbox-thumb.active {
    opacity: 1;
    border-color: var(--electric-cyan);
    box-shadow: 0 0 12px rgba(0,217,255,0.6);
    transform: scale(1.08);
}

/* ── Close button ── */

.lightbox-close:hover {
    background: rgba(0,217,255,0.18);
    border-color: var(--electric-cyan);
    box-shadow: 0 0 18px rgba(0,217,255,0.45);
    transform: rotate(90deg) scale(1.1);
}

/* ── Nav arrows ── */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: rgba(0,217,255,0.07);
    border: 1.5px solid rgba(0,217,255,0.3);
    color: var(--electric-cyan);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
    z-index: 10;
    backdrop-filter: blur(8px);
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Hide prev/next arrows on mobile — users swipe instead */
@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next { display: none !important; }
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0,217,255,0.2);
    border-color: var(--electric-cyan);
    box-shadow: 0 0 22px rgba(0,217,255,0.5);
    transform: translateY(-50%) scale(1.12);
}
.lightbox-prev:active,
.lightbox-next:active {
    transform: translateY(-50%) scale(0.95);
}

/* ── Owner action strip (delete btn etc) ── */
.lightbox-actions {
    position: absolute;
    top: 16px;
    left: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

/* Delete button sizing */
.lightbox-delete-btn {
    height: 36px;
    padding: 0 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid rgba(239,68,68,0.5);
    color: #ef4444;
    background: rgba(239,68,68,0.08);
    cursor: pointer;
    transition: var(--transition-base);
}
.lightbox-delete-btn:hover {
    background: rgba(239,68,68,0.2);
    border-color: #ef4444;
    box-shadow: 0 0 14px rgba(239,68,68,0.35);
}

/* ===================================
   RESPONSIVE — lightbox only
   =================================== */
@media (max-width: 968px) {
    .lightbox-content { padding: 56px 72px 0; }
    .lightbox-prev,
    .lightbox-next { width: 44px; height: 44px; font-size: 1.1rem; }
    .lightbox-prev { left: 14px; }
    .lightbox-next { right: 14px; }
    .lightbox-thumb-strip { padding: 10px 72px 14px; }
}

@media (max-width: 768px) {
    .lightbox-content { padding: 52px 12px 0; }
    .lightbox-close  { width: 40px; height: 40px; font-size: 1rem; top: 12px; right: 12px; }
    .lightbox-prev,
    .lightbox-next   { width: 40px; height: 40px; font-size: 1rem; }
    .lightbox-prev   { left: 10px; }
    .lightbox-next   { right: 10px; }
    #lightboxImage   {

    }
    .lightbox-thumb  { width: 44px; height: 44px; }
    .lightbox-thumb-strip { padding: 8px 10px 12px; gap: 6px; }
    .lightbox-info   { padding: 8px 20px; gap: 10px; }
    .lightbox-counter { font-size: 0.82rem; }
    .lightbox-caption { font-size: 0.78rem; }
}

@media (max-width: 480px) {
    .lightbox-content { padding: 48px 8px 0; }
    .lightbox-thumb  { width: 38px; height: 38px; }
    #lightboxImage   {
   
    }
}

/* Tablets — gallery grid only */

/* Small Mobile */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .thumbnail-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth image loading */
.gallery-item img {
    animation: imageLoad 0.4s ease;
}

@keyframes imageLoad {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================
   UPLOAD MODAL STYLES
   =================================== */

.modal-sm {
    max-width: 600px;
}

/* Upload Area */
.upload-area {
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed var(--medium-gray);
    border-radius: 12px;
    background: var(--light-gray);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--deep-teal);
    background: rgba(77, 208, 225, 0.05);
}

.upload-area.drag-over {
    border-color: var(--sunset-orange);
    background: rgba(255, 107, 53, 0.1);
}

.upload-area i {
    color: var(--medium-gray);
    margin-bottom: 15px;
}

.upload-area h3 {
    margin: 10px 0;
    color: var(--dark-charcoal);
}

.upload-area p {
    color: #888;
    margin: 5px 0 15px;
}

.upload-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 10px;
}

/* Upload Preview */
.upload-preview {
    margin-bottom: 20px;
    background: var(--light-sand);
    border-radius: 12px;
    padding: 20px;
}

.upload-preview h4 {
    margin: 0 0 15px 0;
    color: var(--dark-charcoal);
}

.preview-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--medium-gray);
}

.preview-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.preview-info {
    flex: 1;
}

.file-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark-charcoal);
}

.file-size {
    display: block;
    font-size: 0.8rem;
    color: #888;
}

.remove-file {
    background: none;
    border: none;
    color: var(--error-red);
    font-size: 1.2rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.remove-file:hover {
    background: rgba(239, 83, 80, 0.1);
}

/* Upload Progress */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--medium-gray);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sunset-orange), var(--warm-yellow));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    font-weight: 600;
    color: var(--deep-teal);
    min-width: 40px;
}

/* Gallery Upload Section */
.gallery-upload-section {
    margin-bottom: 20px;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.upload-header h3 {
    margin: 0;
    color: var(--deep-charcoal);
    font-size: 1.25rem;
}

/* ===================================
   BUSINESS CARD GALLERY THUMBNAILS
   =================================== */

.gallery-thumbnail-section {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--medium-gray);
}

.thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.business-card .thumbnail-gallery {
    grid-template-columns: repeat(2, 1fr);
}

.thumbnail-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 6px;
    background: var(--light-gray);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumbnail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.thumbnail-item:hover img {
    transform: scale(1.05);
}

.thumbnail-more {
    background: linear-gradient(135deg, var(--deep-teal), var(--sunset-orange));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.thumbnail-more:hover {
    opacity: 0.9;
}

/* Upload photos button */
.upload-photos-btn {
    margin-top: 10px !important;
    font-size: 0.9rem !important;
    padding: 8px 12px !important;
}

.btn-text {
    background: none;
    border: none;
    color: var(--deep-teal);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.btn-text:hover {
    color: var(--sunset-orange);
    text-decoration: underline;
}

/* Owner badge */
.business-card .featured-badge:not(:first-child) {
    top: 45px;
}

.listing-badge:last-child {
    margin-left: 5px;
}

/* Delete Button Styles */
.lightbox-delete-btn {
    background: #EF4444;
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.lightbox-delete-btn:hover {
    background: #DC2626;
    transform: scale(1.05);
}

.lightbox-delete-btn i {
    margin-right: 5px;
}

/* Photo count warning */
.delete-warning {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    font-size: 0.9rem;
}

.delete-warning i {
    color: #F59E0B;
    margin-right: 8px;
}

/* Confirmation modal styles */
.delete-confirm-modal {
    background: white;
    border-radius: 12px;
    padding: 25px;
    max-width: 400px;
    margin: 0 auto;
}

.delete-confirm-modal h4 {
    color: #DC2626;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.delete-btn-danger {
    background: #DC2626;
    color: white;
    border: none;
}

.delete-btn-danger:hover {
    background: #B91C1C;
}

/* Gallery thumbnail delete buttons */
.thumbnail-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.thumbnail-item:hover .thumbnail-delete-btn {
    opacity: 1;
}

/* Empty gallery state */
.empty-gallery {
    text-align: center;
    padding: 40px 20px;
    color: #6B7280;
}

.empty-gallery i {
    font-size: 3rem;
    color: #D1D5DB;
    margin-bottom: 15px;
    display: block;
}

/* //////////////////////////////////////////////////////////////////////////////////////////////// */
