/* Pinterest Style Gallery CSS */
@import url('./variables.css');

/* === ��联图标 === */
.icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 0;
}

.icon-inline svg {
    width: 1em;
    height: 1em;
}

.lobby-title .icon-inline svg {
    width: 0.9em;
    height: 0.9em;
}

.btn-secondary .icon-inline svg,
.btn-gold .icon-inline svg {
    width: 1em;
    height: 1em;
}

.heat-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.heat-icon svg {
    width: 1em;
    height: 1em;
    color: #ff9800;
}

body {
    margin: 0;
    font-family: var(--ls-font-sans);
    background: var(--ls-bg-base);
    color: var(--ls-text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(212, 168, 83, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(192, 57, 43, 0.04) 0%, transparent 60%);
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 30px 100px;
}

.lobby-header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

.lobby-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--ls-font-display);
    font-weight: 700;
    font-size: 3.5rem;
    color: var(--ls-accent-primary);
    text-shadow: 0 0 30px rgba(212, 168, 83, 0.4), 0 4px 8px rgba(0, 0, 0, 0.6);
    margin: 0 0 12px 0;
    letter-spacing: 0.08em;
}

.lobby-subtitle {
    font-size: 1.1rem;
    color: var(--ls-text-secondary);
    letter-spacing: 0.3em;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    padding: 10px 24px;
    border: 1px solid var(--ls-text-secondary);
    background: transparent;
    color: var(--ls-text-secondary);
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--ls-text-primary);
    color: var(--ls-text-primary);
}

.btn-gold {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    padding: 10px 24px;
    border: 2px solid var(--ls-accent-primary);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.15), rgba(160, 120, 48, 0.25));
    color: var(--ls-text-primary);
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-gold:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.3), rgba(160, 120, 48, 0.4));
    box-shadow: 0 0 25px rgba(212, 168, 83, 0.3);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CSS Grid layout (Left-to-Right Reading) */
.waterfall-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
}

@media (max-width: 1200px) {
    .waterfall-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .waterfall-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 600px) {
    .waterfall-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Javascript toggle classes */
.waterfall-grid.grid-1-col {
    grid-template-columns: repeat(1, 1fr) !important;
}

.waterfall-grid.grid-2-col {
    grid-template-columns: repeat(2, 1fr) !important;
}

.waterfall-grid.grid-4-col {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* 独立呈现的卡片，防止跨列截断 */
.gallery-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    border-color: rgba(212, 168, 83, 0.4);
}

.gallery-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 10;
    position: relative;
    background: #2a2a2a;
    overflow: hidden;
}

.gallery-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-image {
    transform: scale(1.05);
}

/* 封面占位符 */
.gallery-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--ls-bg-elevated) 0%, var(--ls-bg-surface) 100%);
    color: var(--ls-text-tertiary);
}

.gallery-placeholder .icon-inline svg {
    width: 48px;
    height: 48px;
}

.gallery-info {
    padding: 16px 20px;
}

.gallery-title {
    font-family: var(--ls-font-display);
    font-weight: 700;
    margin: 0 0 8px 0;
    font-size: 1.15rem;
    color: var(--ls-accent-primary);
    line-height: 1.3;
}

.gallery-desc {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--ls-text-secondary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.gallery-meta {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #ff9800;
    font-weight: bold;
    gap: 4px;
}

.heat-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

/* 移动端响应式 */
@media (max-width: 600px) {
    .gallery-container {
        padding: 50px 12px 80px;
    }

    .lobby-title {
        font-size: 2rem;
    }

    .lobby-subtitle {
        font-size: 0.85rem;
        letter-spacing: 0.15em;
    }
}

[data-theme="light"] .lobby-title {
    color: #b89d3a;
}

[data-theme="light"] .lobby-subtitle {
    color: #52525b;
}

[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #18181b;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .gallery-card {
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .gallery-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .gallery-image-wrapper {
    background: #f0f0f0;
}

[data-theme="light"] .gallery-title {
    color: #18181b;
}

[data-theme="light"] .gallery-desc {
    color: #52525b;
}

/* === Unified White Search Box === */
.gallery-search-group {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 22px;
    overflow: hidden;
    height: 42px;
    border: 1px solid transparent;
}

.gallery-input {
    border: none;
    background: transparent;
    color: #121212;
    padding: 0 16px;
    height: 100%;
    width: 220px;
    font-size: 0.95rem;
    outline: none;
}

.gallery-input::placeholder {
    color: var(--ls-text-tertiary);
}

.gallery-btn-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--ls-text-primary);
    border: none;
    border-left: 1px solid var(--ls-border-subtle);
    padding: 0 20px;
    height: 100%;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.gallery-btn-search:hover {
    background-color: var(--ls-bg-hover);
}

.gallery-btn-search .icon-inline svg {
    width: 1em;
    height: 1em;
}

/* Spinner animation */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* Select inputs remain themed naturally */
.gallery-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 42px;
    border-radius: 20px;
    border: 1px solid var(--ls-border-subtle);
    background: var(--ls-bg-elevated);
    color: var(--ls-text-primary);
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
}

.gallery-select .icon-inline svg {
    width: 1em;
    height: 1em;
}

/* === Poster Card Fading Overlay === */
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, #1e1e1e 100%);
    pointer-events: none;
}

[data-theme="light"] .gallery-overlay {
    background: linear-gradient(180deg, transparent 40%, #ffffff 100%);
}

/* === Type Badge === */
.gallery-type-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    color: #fff;
    z-index: 2;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gallery-type-badge.badge-vrm {
    background: rgba(233, 30, 99, 0.75);
    border: 1px solid rgba(255, 107, 157, 0.4);
}

.gallery-type-badge.badge-drama {
    background: rgba(33, 150, 243, 0.75);
    border: 1px solid rgba(100, 181, 246, 0.4);
}