/* ========================================
   Catalog Component (Movie/TV Grid + Load More + Catalog Page)
   Used by: home.php, tv_home.php, movies.php (via discover.php),
            tv-shows.php, actor_detail.php, watchlist, etc.
   Loaded on all pages that display content grids
   ======================================== */

/* ========== MOVIE GRID ========== */
.movies-section {
    padding: 20px 0 10px;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 16px;
    margin-top: 16px;
    min-width: 0;
}

.movie-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
}

.movie-card a {
    text-decoration: none;
    color: inherit;
}

.movie-poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    position: absolute;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
}

.badge-quality {
    bottom: 2px;
    left: 2px;
    border-radius: 4px;
    background: #8e1b1b;
    color: white;
}

.badge-quality.hd {
    background: #27272a;
    color: white;
}

.badge-quality.cam {
    background: #8e1b1b;
    color: white;
}

.badge-type {
    bottom: 2px;
    right: 2px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.badge-type.tv {
    background: #8a2128;
    color: white;
}

.badge-rating {
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #f5c518;
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0.3px;
}

.movie-info {
    padding: 10px;
}

.movie-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.movie-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.movie-year {
    color: #f39c12;
}

/* ========== LOAD MORE / VIEW ALL ========== */
.load-more-section {
    display: flex;
    justify-content: center;
    padding: 10px 40px 40px;
}

.btn-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text);
    padding: 14px 60px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-load-more:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

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

/* ========== CATALOG PAGE ========== */
.catalog-header {
    margin-bottom: 30px;
    margin-top: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.catalog-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-badge {
    font-size: 13px;
    background: var(--accent);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Dense Grid for Catalog — Matches movies-grid: 8 columns */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 24px 20px;
    margin-bottom: 10px;
    min-width: 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 40px 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.empty-state {
    padding: 60px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 16px;
}

/* ========================================
   Catalog Responsive Overrides
   ======================================== */

/* Desktop / Small Desktop / iPad Pro — Keep 8 columns, cards shrink to fit */
@media (max-width: 1200px) {

    .movies-grid,
    .catalog-grid {
        gap: 12px;
    }
}

/* Tablet / iPad Portrait */
@media (max-width: 900px) {
    .movies-grid {
        gap: 10px;
    }
}

/* Small Tablet / Large Phone — Switch to 4 columns */
@media (max-width: 768px) {
    .movies-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .load-more-section {
        padding: 20px 16px 40px;
    }

    .btn-load-more {
        width: 100%;
        max-width: 300px;
    }

    .movie-title {
        font-size: 12px;
    }

    .movie-meta {
        font-size: 10px;
    }

    .catalog-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .catalog-title {
        font-size: 20px;
    }
}

/* Catalog Wide Desktop — No longer needed, 8 columns is default */

/* Mobile - 576px and below */
@media (max-width: 576px) {

    /* 2-column grid for mobile - NO CUTTING */
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .movies-section {
        padding: 12px 0 30px;
    }

    .movie-card {
        border-radius: 8px;
    }

    .movie-poster {
        border-radius: 8px 8px 0 0;
    }

    .badge {
        font-size: 11px;
        padding: 4px 7px;
    }

    .badge-quality {
        bottom: 2px;
        left: 2px;
    }

    .badge-type {
        bottom: 2px;
        right: 2px;
    }

    .badge-rating {
        top: 5px;
        left: 5px;
        font-size: 12px;
    }

    .movie-info {
        padding: 8px;
    }

    .movie-title {
        font-size: 11px;
        line-height: 1.3;
    }

    .movie-meta {
        font-size: 9px;
        gap: 4px;
    }

    .load-more-section {
        padding: 16px 12px 30px;
    }

    .btn-load-more {
        width: 100%;
        padding: 12px;
        font-size: 13px;
    }
}

/* Catalog Mobile */
@media (max-width: 480px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Very Small Mobile */
@media (max-width: 360px) {
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .movie-title {
        font-size: 10px;
    }
}