/* ============================================
   Galeria CELQ v1.2.0 — Frontend CSS
   Modern gallery & listing styles
   ============================================ */

:root {
    --celq-accent: #c9a96e;
    --celq-columns: 4;
    --celq-gap: 8px;
}

/* ---- Theme: Dark ---- */
.celq-theme-dark {
    --celq-bg: #0a0a0a;
    --celq-bg-subtle: #141414;
    --celq-bg-card: #1a1a1a;
    --celq-bg-hover: #222;
    --celq-text: #f5f5f5;
    --celq-text-secondary: #a0a0a0;
    --celq-text-muted: #666;
    --celq-border: #2a2a2a;
    --celq-overlay: rgba(0, 0, 0, .92);
    --celq-shadow: rgba(0, 0, 0, .4);
    --celq-input-bg: #1e1e1e;
}

/* ---- Theme: Light ---- */
.celq-theme-light {
    --celq-bg: #fafafa;
    --celq-bg-subtle: #f0f0f0;
    --celq-bg-card: #fff;
    --celq-bg-hover: #f5f5f5;
    --celq-text: #1a1a1a;
    --celq-text-secondary: #666;
    --celq-text-muted: #aaa;
    --celq-border: #e5e5e5;
    --celq-overlay: rgba(0, 0, 0, .88);
    --celq-shadow: rgba(0, 0, 0, .08);
    --celq-input-bg: #fff;
}

/* ===========================
   GALLERY LISTING (shortcode)
   =========================== */
.celq-gallery-listing {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    font-family: inherit;
}

.celq-listing-empty {
    text-align: center;
    color: #888;
    font-size: 15px;
    padding: 48px 0;
}

.celq-listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Card */
.celq-listing-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    transition: all .25s ease;
}

.celq-listing-card:hover {
    border-color: var(--celq-accent, #c9a96e);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .08), 0 0 0 1px var(--celq-accent, #c9a96e);
    transform: translateY(-3px);
    color: inherit;
    text-decoration: none;
}

/* Photo preview grid */
.celq-listing-preview {
    display: grid;
    gap: 2px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f0f0f0;
}

.celq-preview-1 { grid-template-columns: 1fr; }
.celq-preview-2 { grid-template-columns: 1fr 1fr; }
.celq-preview-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.celq-preview-3 .celq-preview-thumb:first-child { grid-row: 1 / -1; }
.celq-preview-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.celq-preview-thumb {
    overflow: hidden;
    position: relative;
}

.celq-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.celq-listing-card:hover .celq-preview-thumb img {
    transform: scale(1.05);
}

.celq-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    background: #f5f5f5;
}

/* Card body */
.celq-listing-card-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 18px;
}

.celq-listing-card-main {
    flex: 1;
    min-width: 0;
}

.celq-listing-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.celq-listing-date {
    display: inline-block;
    font-size: 12px;
    color: #999;
    font-variant-numeric: tabular-nums;
}

.celq-listing-lock {
    color: #bbb;
    flex-shrink: 0;
}

.celq-listing-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.35;
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.celq-listing-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.celq-listing-client {
    font-size: 13px;
    color: #999;
}

.celq-listing-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #999;
    white-space: nowrap;
}

.celq-listing-count svg {
    opacity: .5;
}

/* "Ver Galeria" button */
.celq-listing-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--celq-accent, #c9a96e);
    border: 1px solid var(--celq-accent, #c9a96e);
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all .2s ease;
}

.celq-listing-card:hover .celq-listing-btn {
    background: var(--celq-accent, #c9a96e);
    color: #fff;
}

/* ===========================
   PAGINATION (shared)
   =========================== */
.celq-listing-pagination,
.celq-photo-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.celq-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    border: 1px solid rgba(150, 150, 150, .2);
    border-radius: 8px;
    transition: all .15s;
    white-space: nowrap;
}

.celq-page-btn:hover {
    border-color: var(--celq-accent, #c9a96e);
    color: var(--celq-accent, #c9a96e);
    text-decoration: none;
}

.celq-page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.celq-page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
    transition: all .15s;
}

.celq-page-num:hover {
    background: rgba(150, 150, 150, .1);
    text-decoration: none;
    color: inherit;
}

.celq-page-current {
    background: var(--celq-accent, #c9a96e);
    color: #fff !important;
}

.celq-page-current:hover {
    background: var(--celq-accent, #c9a96e);
    color: #fff !important;
}

.celq-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 36px;
    font-size: 14px;
    color: #999;
    user-select: none;
}

/* ===========================
   PASSWORD PAGE
   =========================== */
.celq-password-page {
    min-height: 100vh;
    background: var(--celq-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.celq-password-container {
    width: 100%;
    max-width: 420px;
    padding: 32px 24px;
    text-align: center;
}

.celq-password-card {
    background: var(--celq-bg-card);
    border: 1px solid var(--celq-border);
    border-radius: 16px;
    padding: 48px 36px 40px;
    box-shadow: 0 8px 40px var(--celq-shadow);
}

.celq-password-logo {
    margin-bottom: 28px;
}

.celq-password-logo svg {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .15));
}

.celq-password-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--celq-text);
    margin: 0 0 8px;
    letter-spacing: -.02em;
    line-height: 1.3;
}

.celq-password-subtitle {
    font-size: 14px;
    color: var(--celq-text-secondary);
    margin: 0 0 28px;
    line-height: 1.5;
}

.celq-password-error {
    background: rgba(220, 53, 69, .1);
    color: #e8484a;
    border: 1px solid rgba(220, 53, 69, .2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 20px;
}

.celq-input-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--celq-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s;
    background: var(--celq-input-bg);
}

.celq-input-group:focus-within {
    border-color: var(--celq-accent);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, .15);
}

.celq-password-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--celq-text);
    outline: none;
    font-family: inherit;
}

.celq-password-input::placeholder {
    color: var(--celq-text-muted);
}

.celq-password-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    background: var(--celq-accent);
    border: none;
    cursor: pointer;
    color: #fff;
    transition: background .15s;
    flex-shrink: 0;
}

.celq-password-submit:hover {
    filter: brightness(1.1);
}

.celq-password-footer {
    margin-top: 32px;
    font-size: 12px;
    color: var(--celq-text-muted);
}

/* ===========================
   GALLERY PAGE
   =========================== */
.celq-gallery {
    background: var(--celq-bg);
    min-height: 100vh;
    color: var(--celq-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header */
.celq-gallery-header {
    background: var(--celq-bg-subtle);
    border-bottom: 1px solid var(--celq-border);
    padding: 48px 0 40px;
}

.celq-gallery-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.celq-gallery-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -.03em;
    line-height: 1.2;
    color: var(--celq-text);
}

.celq-gallery-description {
    font-size: 15px;
    color: var(--celq-text-secondary);
    margin: 0 0 14px;
    line-height: 1.6;
    max-width: 600px;
}

.celq-gallery-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.celq-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--celq-text-secondary);
}

.celq-meta-item svg {
    opacity: .6;
    flex-shrink: 0;
}

/* Download All */
.celq-download-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--celq-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.celq-download-all:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 169, 110, .25);
    color: #fff;
    text-decoration: none;
}

/* Grid (masonry via CSS columns) */
.celq-gallery-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 40px;
    columns: var(--celq-columns);
    column-gap: var(--celq-gap);
}

.celq-gallery-item {
    break-inside: avoid;
    margin-bottom: var(--celq-gap);
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    line-height: 0;
    background: var(--celq-bg-card);
}

.celq-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .4s cubic-bezier(.25, .1, .25, 1), filter .4s;
    will-change: transform;
}

.celq-gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.45) 0%, transparent 50%);
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}

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

.celq-gallery-item:hover::after {
    opacity: 1;
}

/* Item Name */
.celq-item-name {
    position: absolute;
    bottom: 8px;
    left: 10px;
    right: 40px;
    font-size: 11px;
    color: #fff;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.celq-gallery-item:hover .celq-item-name {
    opacity: 1;
}

/* Item Download */
.celq-item-download {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity .2s, background .15s;
    z-index: 2;
    text-decoration: none;
}

.celq-gallery-item:hover .celq-item-download {
    opacity: 1;
}

.celq-item-download:hover {
    background: var(--celq-accent);
    color: #fff;
}

/* Lazy loading placeholder */
.celq-lazy {
    background: var(--celq-bg-card);
    min-height: 100px;
}

.celq-lazy.loaded {
    animation: celqFadeIn .4s ease;
}

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

/* Photo pagination (inside gallery) */
.celq-photo-pagination {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 32px 56px;
}

/* ===========================
   LIGHTBOX
   =========================== */
.celq-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity .3s ease;
}

.celq-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.celq-lightbox.visible {
    opacity: 1;
}

.celq-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .92);
}

.celq-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.celq-lightbox-img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 2px;
    transition: opacity .25s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.celq-lightbox-img.loading {
    opacity: .2;
}

/* Spinner (loading state) */
.celq-lightbox-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: rgba(255, 255, 255, .7);
    border-radius: 50%;
    animation: celqSpin .8s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.celq-lightbox-img.loading ~ .celq-lightbox-spinner,
.celq-lightbox-spinner.active {
    opacity: 1;
}

/* Reverse: spinner before img in DOM, so use sibling order */
.celq-lightbox-content .celq-lightbox-spinner {
    z-index: 1;
}

.celq-lightbox-content .celq-lightbox-img.loading + .celq-lightbox-spinner {
    opacity: 1;
}

@keyframes celqSpin {
    to { transform: rotate(360deg); }
}

/* Lightbox buttons — glassmorphism */
.celq-lightbox-close,
.celq-lightbox-prev,
.celq-lightbox-next {
    position: absolute;
    z-index: 3;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.celq-lightbox-close:hover,
.celq-lightbox-prev:hover,
.celq-lightbox-next:hover {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .2);
}

.celq-lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.celq-lightbox-prev,
.celq-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.celq-lightbox-prev {
    left: 20px;
}

.celq-lightbox-next {
    right: 20px;
}

/* Toolbar — pill-shaped, blurred bg */
.celq-lightbox-toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 28px;
    padding: 10px 22px;
}

.celq-lightbox-counter {
    font-size: 13px;
    color: rgba(255, 255, 255, .7);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.celq-lightbox-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    transition: background .15s;
    text-decoration: none;
}

.celq-lightbox-download:hover {
    background: var(--celq-accent, #c9a96e);
    color: #fff;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1024px) {
    .celq-gallery-grid {
        columns: calc(var(--celq-columns) - 1);
        padding: 20px 20px 36px;
    }

    .celq-gallery-header {
        padding: 36px 0 32px;
    }

    .celq-gallery-header-inner {
        padding: 0 20px;
    }

    .celq-gallery-title {
        font-size: 26px;
    }

    .celq-photo-pagination {
        padding: 8px 20px 48px;
    }
}

@media (max-width: 768px) {
    .celq-gallery-grid {
        columns: 2;
        padding: 16px 16px 32px;
    }

    .celq-gallery-header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 16px;
    }

    .celq-gallery-title {
        font-size: 22px;
    }

    .celq-download-all {
        width: 100%;
        justify-content: center;
    }

    .celq-lightbox-prev,
    .celq-lightbox-next {
        width: 40px;
        height: 40px;
    }

    .celq-lightbox-prev {
        left: 10px;
    }

    .celq-lightbox-next {
        right: 10px;
    }

    .celq-lightbox-close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
    }

    .celq-lightbox-toolbar {
        bottom: 16px;
        padding: 8px 18px;
        border-radius: 24px;
    }

    .celq-password-card {
        padding: 36px 24px 32px;
    }

    .celq-listing-grid {
        grid-template-columns: 1fr;
    }

    .celq-listing-card-body {
        padding: 14px 16px 16px;
    }

    .celq-photo-pagination {
        padding: 8px 16px 40px;
    }
}

@media (max-width: 480px) {
    .celq-gallery-grid {
        columns: 1;
    }

    .celq-gallery-title {
        font-size: 20px;
    }

    .celq-listing-title {
        font-size: 15px;
    }

    .celq-listing-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .celq-lightbox-toolbar {
        gap: 10px;
        padding: 8px 14px;
    }
}

/* Prevent body scroll when lightbox open */
body.celq-lightbox-open {
    overflow: hidden !important;
}
