/* ================================================
   Subtitle Catalog Styles
   Matches the existing subtitle-translator theme
   ================================================ */

/* Hero Section */
.catalog-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: #fff;
    padding: 3rem 1rem 2rem;
    text-align: center;
}

.catalog-hero h1 {
    font-size: 2.2rem;
    margin: 0 0 0.5rem;
    font-weight: 700;
}

.catalog-hero p {
    font-size: 1.1rem;
    opacity: 0.85;
    margin: 0 0 1.5rem;
}

/* Search Box */
.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto 1.2rem;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.search-box input {
    flex: 1;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    border: none;
    outline: none;
    background: #fff;
    color: #1e293b;
}

.search-box input::placeholder {
    color: #94a3b8;
}

.search-box button {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    background: #22c55e;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #16a34a;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.filter-tabs .tab {
    padding: 0.5rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tabs .tab:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.filter-tabs .tab.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    color: #fff;
}

/* Catalog Content */
.catalog-content {
    padding: 2rem 1rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #475569;
}

.status-bar #clear-search {
    padding: 0.3rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    font-size: 0.85rem;
}

.status-bar #clear-search:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Subtitle Grid */
.subtitle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    transition: opacity 0.3s;
}

/* Subtitle Card */
.subtitle-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.subtitle-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

.card-type.type-movie {
    background: #dbeafe;
    color: #1d4ed8;
}

.card-type.type-episode {
    background: #fae8ff;
    color: #a21caf;
}

.card-lang {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: #22c55e;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-release {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: #64748b;
    align-items: center;
}

.card-meta .downloads {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card-meta .fps {
    color: #94a3b8;
}

.card-meta .tag-hi {
    font-size: 0.7rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.card-meta .tag-versions {
    font-size: 0.78rem;
    color: #94a3b8;
}

/* Download Button */
.btn-download {
    margin-top: auto;
    padding: 0.6rem;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.btn-download:hover {
    background: #1d4ed8;
}

/* Spinner */
.spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 0;
    color: #64748b;
}

.spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 4rem 1rem;
    text-align: center;
    color: #94a3b8;
}

.empty-state h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #64748b;
}

.empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

/* Error Message */
.error-msg {
    text-align: center;
    color: #ef4444;
    padding: 2rem;
    font-size: 0.95rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.pagination button {
    padding: 0.5rem 1.2rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

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

.pagination #page-info,
.pagination #js-page-info {
    font-size: 0.9rem;
    color: #64748b;
}

/* Server-side pagination links (front page) */
.pagination-link {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.pagination-link:hover:not(.disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.pagination-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    border: none;
    background: none;
    font-size: 1.6rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #475569;
}

.modal-content h2 {
    margin: 0 0 1rem;
    font-size: 1.3rem;
    color: #1e293b;
}

.modal-details p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
    color: #475569;
}

.modal-details strong {
    color: #1e293b;
}

.modal-actions {
    margin-top: 1.5rem;
}

.btn.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    box-sizing: border-box;
    text-align: center;
}

.btn.btn-primary:hover {
    background: #1d4ed8;
    color: #fff;
}

.download-status {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    text-align: center;
}

.download-status.success { color: #22c55e; }
.download-status.error   { color: #ef4444; }
.download-status.loading { color: #64748b; }

/* Responsive */
@media (max-width: 768px) {
    .catalog-hero {
        padding: 2rem 1rem 1.5rem;
    }

    .catalog-hero h1 {
        font-size: 1.6rem;
    }

    .search-box {
        flex-direction: column;
        border-radius: 8px;
    }

    .search-box button {
        justify-content: center;
    }

    .subtitle-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .filter-tabs {
        gap: 0.3rem;
    }

    .filter-tabs .tab {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }

    .catalog-content {
        padding: 1rem 0.5rem 2rem;
    }
}

/* ================================================
   Homepage Featured Movies Section
   ================================================ */

.home-movies {
    background: #f8fafc;
    padding: 3rem 1rem 3.5rem;
    margin-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.home-movies-heading {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin: 0 0 0.4rem;
}

.home-movies-sub {
    font-size: 1rem;
    color: #64748b;
    text-align: center;
    margin: 0 0 2rem;
}

.home-movies-cta {
    text-align: center;
    margin-top: 2rem;
}

.btn-browse-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-browse-all:hover {
    background: #1d4ed8;
    color: #fff;
}

/* Poster Card Layout */
.subtitle-card.has-poster {
    flex-direction: row;
    gap: 1rem;
    align-items: stretch;
}

.card-poster-link {
    flex-shrink: 0;
    display: block;
    border-radius: 6px;
    overflow: hidden;
}

.card-poster {
    display: block;
    width: 100px;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
    transition: transform 0.2s;
}

.card-poster-link:hover .card-poster {
    transform: scale(1.03);
}

.subtitle-card.has-poster .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.card-year {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.9em;
}

/* Card Title Link */
.card-title-link {
    text-decoration: none;
    color: inherit;
}

.card-title-link:hover .card-title {
    color: #2563eb;
}

/* Card Actions Row */
.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.card-actions .btn-download {
    flex: 1;
    margin-top: 0;
}

.btn-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-view-all:hover {
    background: #f1f5f9;
    border-color: #2563eb;
    color: #2563eb;
}

/* ================================================
   Movie Detail Page
   ================================================ */

/* Movie Hero (breadcrumb bar) */
.movie-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: #fff;
    padding: 1.2rem 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    max-width: 1200px;
    margin: 0 auto;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #fff;
}

.breadcrumb span {
    color: rgba(255, 255, 255, 0.5);
}

.breadcrumb span:last-child {
    color: #fff;
    font-weight: 500;
}

/* Movie Detail Section */
.movie-detail {
    padding: 2rem 1rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Movie Header (poster + info) */
.movie-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.movie-poster img {
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 220px;
    height: auto;
}

.movie-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.movie-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

.movie-year {
    font-weight: 400;
    color: #64748b;
}

.movie-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.genre-tag {
    font-size: 0.78rem;
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.movie-rating {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: #475569;
    font-weight: 500;
}

.movie-overview {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

/* Movie Tagline */
.movie-tagline {
    font-style: italic;
    color: #64748b;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.4;
}

/* Movie Details Grid */
.movie-details-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid #f1f5f9;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.detail-value {
    font-size: 0.88rem;
    color: #1e293b;
    font-weight: 500;
}

/* Rich Content Sections */
.movie-seo-text {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.movie-seo-text:first-of-type {
    margin-top: 2rem;
}

.movie-seo-text h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.movie-seo-text h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin: 1.25rem 0 0.4rem;
}

.movie-seo-text p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #475569;
    margin: 0 0 0.75rem;
}

.movie-seo-text ol,
.movie-seo-text ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.5rem;
    color: #475569;
}

.movie-seo-text li {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.4rem;
}

.movie-meta-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.movie-meta-list li {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

/* Cast & Crew */
.crew-line {
    font-size: 0.95rem;
    color: #475569;
    margin: 0.3rem 0;
}

.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.cast-card {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0.85rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.actor-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}

.actor-role {
    font-size: 0.78rem;
    color: #64748b;
}

/* Trivia Section */
.trivia-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

.trivia-list li {
    position: relative;
    padding: 0.65rem 0.85rem 0.65rem 2.2rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.93rem;
    line-height: 1.6;
    color: #334155;
}

.trivia-list li::before {
    content: "\2726";
    position: absolute;
    left: 0.8rem;
    top: 0.65rem;
    color: #2563eb;
    font-size: 1rem;
}

/* Keyword Tags */
.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.88rem;
    color: #475569;
}

.keyword-tags strong {
    margin-right: 0.25rem;
}

.keyword-tag {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid #c7d2fe;
}

.movie-sub-count {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: #2563eb;
    margin-top: 0.5rem;
}

.movie-sub-count strong {
    font-weight: 700;
}

/* Subtitle Table */
.subtitle-table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.subtitle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.subtitle-table thead {
    background: #f8fafc;
}

.subtitle-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0;
}

.subtitle-table td {
    padding: 0.7rem 1rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.subtitle-table tbody tr:hover {
    background: #f8fafc;
}

.subtitle-table tbody tr:last-child td {
    border-bottom: none;
}

.col-release {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    font-family: monospace;
}

.source-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #dbeafe;
    color: #1d4ed8;
}

.col-downloads {
    color: #64748b;
    font-size: 0.85rem;
}

.btn-download-sm {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    border: none;
    border-radius: 5px;
    background: #2563eb;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-download-sm:hover {
    background: #1d4ed8;
    color: #fff;
}

.no-link {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Back Button */
.movie-back {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

/* Movie Detail Responsive */
@media (max-width: 768px) {
    .movie-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .movie-poster img {
        max-width: 180px;
    }

    .movie-info {
        align-items: center;
    }

    .movie-genres {
        justify-content: center;
    }

    .movie-title {
        font-size: 1.4rem;
    }

    .subtitle-table th:nth-child(4),
    .subtitle-table td:nth-child(4) {
        display: none;
    }

    .col-release {
        max-width: 200px;
    }

    .movie-details-grid {
        justify-content: center;
    }

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

@media (max-width: 480px) {
    .movie-detail {
        padding: 1rem 0.5rem 2rem;
    }

    .subtitle-table th:nth-child(3),
    .subtitle-table td:nth-child(3) {
        display: none;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-poster {
        width: 80px;
    }
}
