/* Top Albums Page Styles */

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: "Outfit", sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.back-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Subtitle under the main title */
.top-albums-subtitle {
    font-family: "Outfit", sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-secondary);
    margin-top: 12px;
    margin-bottom: 4px;
}

.top-albums-subtitle strong {
    color: var(--text-primary);
    font-weight: 600;
}

.top-albums-hint {
    font-family: "Outfit", sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.top-albums-hint.visible {
    opacity: 1;
}

/* Page-level loading overlay */
.gen-loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 80px 20px;
    position: relative;
    z-index: 10;
}

.gen-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.gen-loading-title {
    font-family: "Syne", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gen-loading-counter {
    font-family: "Outfit", sans-serif;
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.gen-loading-albums {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
}

.gen-loading-chip {
    font-family: "Outfit", sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    padding: 4px 12px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.gen-loading-chip.done {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Gallery grid */
.poster-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto 60px;
    padding: 0 40px;
    position: relative;
    z-index: 10;
    align-items: start; /* rows size to content, not to each other */
}

/* Individual card — height is determined by the image inside */
.gallery-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    animation: cardReveal 0.5s ease-out both;
}

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

.gallery-card:nth-child(1) { animation-delay: 0.05s; }
.gallery-card:nth-child(2) { animation-delay: 0.12s; }
.gallery-card:nth-child(3) { animation-delay: 0.19s; }
.gallery-card:nth-child(4) { animation-delay: 0.26s; }
.gallery-card:nth-child(5) { animation-delay: 0.33s; }
.gallery-card:nth-child(6) { animation-delay: 0.40s; }
.gallery-card:nth-child(7) { animation-delay: 0.47s; }
.gallery-card:nth-child(8) { animation-delay: 0.54s; }

.gallery-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Loading state inside card */
.card-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
}

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

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

.card-loading-text {
    font-family: "Outfit", sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Poster image — fills card width, height flows naturally from image ratio */
.card-poster {
    display: block;
    width: 100%;
}

.card-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Hover overlay — absolutely positioned over the image */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-card:hover .card-overlay {
    opacity: 1;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 12px;
}

.card-album {
    font-family: "Syne", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.card-artist {
    font-family: "Outfit", sans-serif;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.card-cta {
    display: inline-block;
    font-family: "Outfit", sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #000;
    background: var(--accent-primary);
    padding: 7px 16px;
    border-radius: 50px;
    align-self: flex-start;
}

/* Error state */
.card-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-family: "Outfit", sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* No albums fallback */
.no-albums {
    text-align: center;
    padding: 60px 20px;
    font-family: "Outfit", sans-serif;
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-primary);
    position: relative;
    z-index: 5;
}

footer a {
    font-family: "Outfit", sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 1000px) {
    .poster-gallery {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 24px;
    }
}

@media (max-width: 650px) {
    .poster-gallery {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 16px;
        gap: 12px;
    }
}

/* ── Collage poster ── */

.collage-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 11px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #ff6b35, #ff8f5e);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.collage-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
}

.collage-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 10, 0.85);
    backdrop-filter: blur(6px);
    z-index: 100;
}

.collage-overlay.active {
    display: flex;
}

.collage-modal {
    position: relative;
    max-width: min(92vw, 480px);
    max-height: 92vh;
    padding: 24px;
    background: #14141b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    overflow: auto;
}

.collage-modal img {
    width: 100%;
    border-radius: 8px;
}

.collage-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    color: #9a9aa5;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

.collage-close:hover {
    color: #ff6b35;
}

.collage-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: #c8c8d0;
}

.collage-download {
    display: inline-flex;
    align-items: center;
    padding: 11px 26px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #ff6b35, #ff8f5e);
    border-radius: 10px;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.collage-download:hover {
    transform: translateY(-2px);
}
