/* ==========================================================================
   AniWorld Listing Pages (Movies & Series) — Netflix-Style Extension
   Built on top of ../styles.css design tokens.
   ========================================================================== */

body.listing-page {
    background-color: var(--background);
    min-height: 100vh;
}

/* ------------------ Page Header / Title ------------------ */
.listing-hero {
    position: relative;
    padding: calc(var(--header-h) + 44px) 0 22px;
    background:
        radial-gradient(circle at top right, rgba(229, 9, 20, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, rgba(5, 5, 5, 0.4) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.listing-title h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin: 0;
    padding-left: 14px;
    position: relative;
}

.listing-title h1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 1.2em;
    background: var(--accent);
    border-radius: 2px;
}

.listing-count {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 6px 0 0;
    padding-left: 14px;
}

/* ------------------ Content Grid ------------------ */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
    padding: 30px 0 10px;
}

/* ------------------ Netflix Cards ------------------ */
.listing-page .af-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.25s var(--ease), border-color 0.25s ease, box-shadow 0.25s ease;
}

.listing-page .af-card:hover {
    transform: scale(1.04);
    z-index: 2;
    border-color: rgba(229, 9, 20, 0.5);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.listing-page .af-card .image-container {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--surface-2);
}

.listing-page .af-card .image-container img {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border-radius: 0;
    object-fit: cover;
    display: block;
    transition: transform 0.4s var(--ease), filter 0.3s ease;
}

.listing-page .af-card:hover .image-container img {
    transform: scale(1.08);
    filter: brightness(0.72);
}

/* Always-visible gradient overlay */
.listing-page .af-card .card-overlay {
    opacity: 1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.4) 100%);
}

.listing-page .af-card:hover .card-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.72) 100%);
}

/* Premium play button: hidden by default, pops in on hover */
.listing-page .af-card .card-play {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
    color: #fff;
    background: radial-gradient(circle at 32% 28%, #ff5f52 0%, var(--accent) 60%, #b00612 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 10px 26px rgba(229, 9, 20, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 0 3px rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.25s var(--ease), box-shadow 0.2s ease;
}

.listing-page .af-card .card-play i {
    transform: translateX(1px);
}

.listing-page .af-card:hover .card-play {
    opacity: 1;
    transform: scale(1);
    animation: card-play-pop 0.35s var(--ease);
}

.listing-page .af-card .card-play:hover {
    transform: scale(1.12);
    box-shadow:
        0 16px 44px rgba(229, 9, 20, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 0 4px rgba(255, 255, 255, 0.14);
}

@keyframes card-play-pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* View Details slides in on hover only */
.listing-page .af-card .card-info {
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: visibility 0s linear 0.25s, opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}

.listing-page .af-card:hover .card-info {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: visibility 0s linear 0s, opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}

/* Touch devices: no floating play button — the whole card is tappable */
@media (hover: none) {
    .listing-page .af-card .card-overlay,
    .listing-page .af-card .card-play { display: none; }
}

.listing-page .af-card .series-details-container {
    padding: 12px 10px;
}

.listing-page .af-card .series-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.35em;
}

.listing-page .af-card .series-metadata {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 3px 0 0;
    white-space: nowrap;
    min-height: 1.2em;
}

.listing-page .af-card .series-metadata .rating-value { color: #ffcc00; font-weight: 700; }
.listing-page .af-card .series-metadata .year-value { color: var(--text-secondary); font-weight: 600; }

/* ------------------ Skeleton Cards ------------------ */
.listing-page .af-card.skeleton-card .series-details-container {
    padding: 12px 10px;
}

.listing-page .af-card.skeleton-card .skeleton-title {
    margin-bottom: 9px;
}

.listing-page .af-card.skeleton-card .skeleton-meta {
    width: 50%;
}

/* ------------------ Pagination ------------------ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 36px 0 100px;
}

.pagination button {
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 22px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 6px 18px rgba(229, 9, 20, 0.35);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#page-number {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ------------------ Bottom Navigation (anchors) ------------------ */
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    padding: 7px 0;
    margin: 0 8px;
    border-radius: 12px;
    position: relative;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.bottom-nav a i { font-size: 1.25rem; transition: transform 0.25s ease; }
.bottom-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.bottom-nav a.active { color: var(--accent); background: rgba(229, 9, 20, 0.1); }
.bottom-nav a.active i { transform: translateY(-2px); }

.bottom-nav a.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--accent);
}

/* ------------------ Genre Chips ------------------ */
.genre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 22px 0 6px;
}

.genre-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.genre-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: var(--accent, #e50914);
    transform: translateY(-2px);
}

.genre-chip.active {
    background: var(--accent, #e50914);
    border-color: var(--accent, #e50914);
    color: #fff;
    box-shadow: 0 4px 14px rgba(229, 9, 20, 0.35);
}

.genre-chip i { font-size: 0.8rem; }

.chip-count {
    font-size: 0.72rem;
    opacity: 0.8;
    font-weight: 500;
}

@media (max-width: 480px) {
    .genre-chips { gap: 8px; padding: 16px 0 4px; }
    .genre-chip { padding: 8px 13px; font-size: 0.78rem; }
}

/* ------------------ Loading / Empty States ------------------ */
.loading-message, .error-message, .no-results {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 4px;
    font-size: 1em;
    grid-column: 1 / -1;
}

.error-message { color: #ff4d4d; }

/* ------------------ Responsive ------------------ */
@media (max-width: 768px) {
    .listing-hero { padding: 148px 0 18px; }
    .listing-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 20px 0 6px; }
    .pagination { padding: 26px 0 96px; }
}

@media (max-width: 480px) {
    .listing-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .pagination { gap: 10px; }
    .pagination button { font-size: 0.82rem; padding: 9px 16px; }
}

@media (max-width: 380px) {
    .listing-hero { padding-top: 140px; }
    .listing-grid { gap: 8px; }
    .listing-page .af-card .series-details-container { padding: 10px 8px; }
    .listing-page .af-card .series-title { font-size: 0.82rem; }
    .listing-page .af-card .series-metadata { font-size: 0.74rem; }
}
