/* Gallery & Layout Styles */
:root {
    --bg-base: #000000;
    --page-text: #f5f5f5;
    --muted: #9ca3af;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-base);
    color: var(--page-text);
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

/* Page Structure */
.site-header {
    padding: 1rem 1.5rem 0.5rem;
    text-align: center;
}

.site-header h1 {
    font-size: var(--dyn-size-title, 1.6rem);
    margin: 0 0 0.25rem;
    text-shadow: var(--dyn-txt-effect, none);
}

.site-header p {
    margin: 0;
    font-size: var(--dyn-size-subtitle, 0.9rem);
    opacity: 0.8;
    text-shadow: var(--dyn-txt-effect, none);
}

.page-shell {
    display: block;
    min-height: 100vh;
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 0.5rem;
}

.filter-btn {
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: #020617;
    color: #e5e7eb;
    border-radius: 0;
    padding: 0.25rem 0.75rem;
    font-size: var(--dyn-size-button, 0.8rem);
    cursor: pointer;
    opacity: 0.85;
    text-shadow: var(--dyn-txt-effect, none);
}

.filter-btn.is-active {
    background: #e5e7eb;
    color: #020617;
    opacity: 1;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    gap: 0;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0;
    min-height: 100vh;
    contain: layout paint style;
    /* PERFORMANCE: strict containment for grid */
}

.gallery-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

/* Photo Cards */
.photo-card {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    width: 100%;
    background: transparent;
    border: none;
    cursor: zoom-in;
    display: block;
    margin: 0;
    transition: transform 0.25s ease-out;
}

/* Dynamic Placeholder States */
.gallery-grid.is-dragging .photo-card {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Hover Effect (Desktop Only) */
@media (hover: hover) {
    .photo-card:hover {
        -webkit-transform: scale(0.95) translateZ(0);
        transform: scale(0.95) translateZ(0);
        /* Keep GPU layer during hover */
    }
}

.photo-card.is-trail {
    /* Trail Effect Disabled */
    transform: none;
    z-index: auto;
    box-shadow: none;
}

.photo-thumb {
    width: 100%;
    height: 100%;
    /* Fill pre-allocated aspect-ratio card */
    display: block;
    background-color: transparent;
    object-fit: cover;
}

/* Aspect Ratio Utilities (to avoid inline styles) */
.ratio-squared {
    aspect-ratio: 1;
}

.ratio-portrait {
    aspect-ratio: 3/4;
}

.ratio-landscape {
    aspect-ratio: 4/3;
}

.ratio-wide {
    aspect-ratio: 16/9;
}

.ratio-tall {
    aspect-ratio: 9/16;
}

.ratio-4-5 {
    aspect-ratio: 4/5;
}

.ratio-5-7 {
    aspect-ratio: 5/7;
}


/* Modal (Facebook Style) */
#photo-modal {
    position: fixed;
    inset: 0;
    display: none;
    background: #000000;
    /* Fondo totalmente opaco para simular una página nueva */
    z-index: 1000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#photo-modal.open {
    display: flex;
}

/* Modal Stacking & Interaction */
.modal-main {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
    /* Main container allows clicking background to close */
    pointer-events: auto;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: auto;

    /* Prevent default browser image drag & context menus during zoom/pan */
    pointer-events: auto !important;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* Toolbar Overlay */
/* SIMPLIFIED FIX: Allow toolbar to be active. */
.modal-toolbar {
    position: absolute;
    width: 100%;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2000;
}

/* Re-enable events: redundant if container is auto, but safe */
.modal-toolbar button,
.modal-toolbar a,
.modal-toolbar .action-group,
.modal-toolbar .icon-btn {
    pointer-events: auto !important;
}

.modal-top {
    top: 0;
    /* Background shadow removed to clean up interface during zoom */
}

.action-group {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Navigation Buttons */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background 0.2s;
    z-index: 50;
    /* Above image, below toolbar */
    pointer-events: auto !important;
    -webkit-user-select: none;
    user-select: none;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-prev {
    left: 20px;
}

.nav-next {
    right: 20px;
}

.nav-btn {
    display: none;
}

/* --- Information Button (ⓘ) --- */
.info-btn-red {
    transition: all 0.25s ease;
}

.info-btn-red.info-btn-active {
    background: rgba(255, 255, 255, 0.4);
}

.info-btn-red svg {
    width: 18px;
    height: 18px;
}

/* --- Information Panel (Full-Page Overlay) --- */
.modal-info-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.96);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    z-index: 3000;
    overflow-y: auto;
    padding: 80px 24px 40px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s;
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-info-panel.info-panel-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.info-panel-inner {
    width: 100%;
    max-width: 520px;
}

.info-panel-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    z-index: 3001;
}

.info-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.info-panel-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 32px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
}

.info-panel-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.info-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(220, 38, 38, 0.9);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.info-value {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.6;
    margin: 0;
}

.info-description {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.75;
    font-style: italic;
}

/* Force Mobile Styles override defaults/cache */
.filter-btn {
    border-radius: 0 !important;
    -webkit-appearance: none;
    appearance: none;
}

.gallery-grid,
.gallery-col {
    gap: 0 !important;
}

.photo-card {
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Footer / Last Updated */
#page-last-updated {
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.5;
    font-size: var(--dyn-size-body, 0.8rem);
    color: var(--muted);
    pointer-events: none;
    display: none;
    /* Hidden by default */
}

/* ═══════════════════════════════════════════════════════════════════
   LOBBY MEGA-GRID — Mixed Multimedia Card Styles
   ═══════════════════════════════════════════════════════════════════ */

/* --- Placeholder Base (Text, Audio, Video fallback) --- */
.lobby-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.lobby-placeholder-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

/* --- Video Card --- */
.lobby-video-card {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.lobby-video-card .photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lobby-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: transform 0.2s ease, background 0.2s ease;
}

@media (hover: hover) {
    .photo-card:hover .lobby-play-overlay {
        transform: translate(-50%, -50%) scale(1.1);
        background: rgba(0, 0, 0, 0.7);
    }
}

/* --- Text Card --- */
.lobby-text-card {
    padding: 1.5rem;
    box-sizing: border-box;
}

/* --- Audio Card --- */
.lobby-audio-card {
    padding: 1.5rem;
    box-sizing: border-box;
}

/* --- Shared card label/title overlay --- */
.lobby-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.6rem 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    z-index: 4;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lobby-card-excerpt {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem 0.75rem 0.6rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.68rem;
    font-style: italic;
    line-height: 1.4;
    z-index: 4;
    pointer-events: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Multimedia Type Badge (bottom-left) --- */
.lobby-type-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* --- Carousel Badge --- */
.carousel-badge {
    pointer-events: none;
}

/* --- Lobby Modal Content --- */
#photo-modal {
    position: fixed;
    inset: 0;
    display: none;
    background: #000000;
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
#photo-modal.open {
    display: flex;
}
.modal-main {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
    pointer-events: auto;
}
/* Toolbar Overlay */
.modal-toolbar {
    position: absolute;
    width: 100%;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
}
.modal-top {
    top: 0;
}
.action-group {
    display: flex;
    gap: 1rem;
}
.icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto !important;
}
.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    font-size: 30px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: background 0.3s;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.nav-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    background: transparent;
}
.nav-prev { left: 20px; }
.nav-next { right: 20px; }

#modal-content-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#modal-content-area img,
#modal-content-area video,
#modal-content-area .modal-text-content,
#modal-content-area .modal-audio-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#modal-content-area img,
#modal-content-area video {
    pointer-events: auto;
    cursor: auto;
}

.modal-text-content {
    padding: 2rem;
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 100%;
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-audio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    color: white;
    padding: 2rem;
    text-align: center;
}

.modal-audio-content audio {
    width: 100%;
    max-width: 400px;
}

/* 2D VISOR CAROUSEL (VERTICAL DOTS) */
#modal-vertical-dots {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1200; /* above the image but not above the top bar */
    pointer-events: none; /* let clicks pass through to swipe/zoom */
}

.modal-vertical-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.modal-vertical-dot.active {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.3);
}

/* ── ADMIN CAROUSEL CONTEXT MENU ── */
.admin-context-menu {
    position: absolute;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 180px;
    color: white;
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
}

.admin-context-menu button {
    background: transparent;
    border: none;
    color: #e5e7eb;
    text-align: left;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-context-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-context-menu button.danger {
    color: #ef4444;
}

.admin-context-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.admin-context-menu button.safe {
    color: #10b981;
}

.admin-context-menu button.safe:hover {
    background: rgba(16, 185, 129, 0.2);
}

.admin-context-menu hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.2rem 0;
}

.is-carousel-parent {
    box-shadow: 0 0 0 4px #f59e0b, 0 0 20px rgba(245, 158, 11, 0.5) !important;
    transform: scale(0.98);
    transition: all 0.2s ease;
}

.is-carousel-child {
    box-shadow: 0 0 0 4px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.5) !important;
    transform: scale(0.98);
    transition: all 0.2s ease;
}