/* ============================================================
   Gallery Page Styles
   ============================================================ */

.gallery-section {
    padding: 60px 0 90px;
    background: var(--bg-offwhite);
    min-height: 400px;
}

/* ─── Loading / Empty ────────────────────────────────────────── */
.gallery-loading,
.gallery-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
    font-size: 1rem;
}

.gallery-loading i,
.gallery-empty i {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 16px;
    color: var(--border);
}

/* ─── Album Grid ─────────────────────────────────────────────── */
.gallery-albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

.gallery-album-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-album-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.gallery-album-thumb {
    height: 220px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-light);
    position: relative;
    display: flex;
    align-items: flex-end;
}

.gallery-no-cover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 3rem;
}

.gallery-album-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.65);
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.gallery-album-info {
    padding: 18px 20px;
}

.gallery-album-info h3 {
    font-size: 1.05rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.gallery-album-info p {
    font-size: 0.88rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
}

/* ─── Lightbox ───────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.93);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.lightbox-caption {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    text-align: center;
    max-width: 600px;
    margin: 0;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 600px) {
    .gallery-albums-grid { grid-template-columns: 1fr; }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
}

/* ─── Public gallery type pill ──────────────────────────────── */
.gallery-type-pill {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.72);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Montserrat', sans-serif;
}

/* ─── Lightbox video iframe ──────────────────────────────────── */
.lightbox-video-wrap {
    width: min(90vw, 900px);
    aspect-ratio: 16 / 9;
}

.lightbox-video-wrap iframe {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* ─── Admin Gallery Styles (used in admin.html) ──────────────── */

.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.admin-gallery-card {
    background: white;
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.admin-gallery-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.admin-gallery-thumb {
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-light);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-gallery-thumb .no-cover-icon {
    font-size: 2.5rem;
    color: var(--border);
}

.admin-gallery-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

.admin-gallery-badge.published  { background: rgba(0,100,0,0.85);  color: white; }
.admin-gallery-badge.draft      { background: rgba(0,0,0,0.55);    color: white; }

.admin-gallery-info {
    padding: 14px 16px;
}

.admin-gallery-info h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.admin-gallery-info .gallery-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.admin-gallery-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-gallery-actions .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

/* ─── Admin image upload grid ────────────────────────────────── */
.admin-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.admin-image-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--bg-light);
    border: 1px solid var(--border);
}

.admin-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-image-item .image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.admin-image-item:hover .image-overlay { opacity: 1; }

.admin-image-item .image-overlay button {
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    width: 110px;
    justify-content: center;
}

.admin-image-item .image-overlay .btn-set-cover { color: var(--green); }
.admin-image-item .image-overlay .btn-delete-img { color: #dc2626; }

/* ─── Upload drop zone ───────────────────────────────────────── */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--green);
    background: rgba(0,100,0,0.04);
}

.upload-dropzone i {
    font-size: 2rem;
    color: var(--green);
    margin-bottom: 10px;
    display: block;
}

.upload-dropzone p { color: var(--text-light); font-size: 0.9rem; margin: 0; }
.upload-dropzone small { color: var(--text-light); font-size: 0.8rem; }

.upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-progress-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-med);
}

.upload-progress-item .progress-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-item .progress-bar {
    height: 100%;
    background: var(--green);
    border-radius: 3px;
    transition: width 0.3s;
}

/* ─── WebP conversion toggle bar ────────────────────────────── */
.webp-toggle-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    font-size: 0.85rem;
    color: var(--text-med);
    font-family: 'Montserrat', sans-serif;
}

.webp-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}

.webp-toggle-label input[type="checkbox"] { display: none; }

.webp-toggle-track {
    position: relative;
    width: 38px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.webp-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.webp-toggle-label input[type="checkbox"]:checked ~ .webp-toggle-track {
    background: var(--green);
}

.webp-toggle-label input[type="checkbox"]:checked ~ .webp-toggle-track .webp-toggle-thumb {
    transform: translateX(16px);
}

.webp-quality-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.webp-quality-label input[type="range"] {
    width: 100px;
    accent-color: var(--green);
    cursor: pointer;
}

#webpQualityVal {
    min-width: 36px;
    font-weight: 700;
    color: var(--green-dark);
}

/* ─── Gallery type toggle (modal) ────────────────────────────── */
.gallery-type-toggle {
    display: flex;
    gap: 10px;
}

.type-opt {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
}

.type-opt input[type="radio"] { display: none; }

.type-opt span {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: var(--text-med);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.type-opt input[type="radio"]:checked + span {
    border-color: var(--green);
    background: rgba(0,100,0,0.06);
    color: var(--green-dark);
}

/* ─── Gallery type badge (admin card) ────────────────────────── */
.gallery-type-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gallery-type-badge.video {
    background: rgba(30, 64, 175, 0.85);
    color: #fff;
}

/* ─── Video URL input row ─────────────────────────────────────── */
.admin-video-input {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 4px;
}

.admin-video-input input {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: 'Open Sans', sans-serif;
    background: white;
}

.admin-video-input input:focus {
    outline: none;
    border-color: var(--green);
}

/* ─── Admin image item: video badge + placeholder ────────────── */
.admin-vid-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.55);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    pointer-events: none;
}

.admin-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 2rem;
}
