/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    --color-bg: #0f0f0f;
    --color-surface: #1a1a1a;
    --color-surface-hover: #252525;
    --color-border: #2a2a2a;
    --color-text: #e8e8e8;
    --color-text-muted: #888;
    --color-accent: #6c63ff;
    --color-accent-hover: #5a52d5;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-logo {
    height: 48px;
    width: auto;
    flex-shrink: 0;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.header-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    font-weight: 400;
}

/* ===== Filters ===== */
.filters {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

.filters-container {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 50px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border-color: #444;
}

.filter-btn.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

/* Media type buttons (Imagenes / Videos) */
.media-btn {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 50px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.media-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border-color: #444;
}

.media-btn.active {
    background: #1a3a5c;
    color: #4da6ff;
    border-color: #2a5a8c;
}

.filter-divider {
    width: 1px;
    background: var(--color-border);
    align-self: stretch;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

/* ===== Gallery Grid ===== */
.catalog {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* ===== Gallery Card ===== */
.card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    aspect-ratio: 1 / 1;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.card:hover img {
    transform: scale(1.05);
}

.card-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover .card-badge {
    opacity: 1;
}

/* Video play icon overlay */
.card-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    padding-left: 4px;
    transition: all var(--transition);
    pointer-events: none;
}

.card:hover .card-play-icon {
    background: var(--color-accent);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Card enter animation */
.card.entering {
    animation: cardEnter 0.4s ease forwards;
}

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

/* Card hidden by filter */
.card.hidden {
    display: none;
}

/* ===== Loading ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Error ===== */
.error {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
}

.error-detail {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: #666;
}

.retry-btn {
    margin-top: 1.5rem;
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--color-accent);
    border-radius: 50px;
    background: transparent;
    color: var(--color-accent);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
}

.retry-btn:hover {
    background: var(--color-accent);
    color: #fff;
}

/* ===== Empty ===== */
.empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.lightbox-caption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 2rem;
    padding: 0.5rem;
    opacity: 0.6;
    transition: opacity var(--transition);
    z-index: 1001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

.lightbox-close {
    top: 1rem;
    right: 1.5rem;
    font-size: 2.5rem;
}

.lightbox-prev {
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header {
        padding: 1.25rem 1rem;
    }

    .header-logo {
        height: 36px;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .catalog {
        padding: 1rem;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }

    .filters-container {
        padding: 0 1rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .card {
        border-radius: var(--radius-sm);
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }
}
