/*
Theme Name: CS Player Drama
Theme URI: https://example.com/cs-player-drama
Author: CS Player
Description: Clean minimalist white WordPress theme for dramas and movies with integrated CS Player v1.0.0 Playlist & JW Player support.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cs-player-theme
*/

:root {
    --theme-bg: #ffffff;
    --theme-text: #111827;
    --theme-muted: #6b7280;
    --theme-border: #e5e7eb;
    --theme-surface: #f9fafb;
    --theme-accent: #0f766e;
    --theme-accent-red: #e7000b;
    --theme-radius: 0.375rem;
    --theme-container: 1220px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--theme-bg);
    color: var(--theme-text);
    font-family: "Lexend Deca", "Battambang", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
}

.watch-description img,
.page-card img {
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-main {
    flex: 1 0 auto;
}

.container {
    width: 100%;
    max-width: var(--theme-container);
    margin-inline: auto;
    padding-inline: 1rem;
}

/* Header */
.site-header {
    background: var(--theme-bg);
    position: relative;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 2.25rem;
    min-height: 4.25rem;
    border-bottom: 1px solid var(--theme-border);
    position: relative;
}

.site-branding {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.site-branding .custom-logo-link {
    display: inline-flex;
    align-items: center;
}

.site-branding .custom-logo {
    max-height: 2.75rem;
    width: auto;
    display: block;
}

.brand-fallback {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--theme-text);
}

.brand-fallback svg {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
}

.main-navigation {
    display: flex;
    align-items: stretch;
    align-self: stretch;
}

.nav-menu {
    display: flex;
    align-items: stretch;
    gap: 1.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    display: flex;
    align-items: stretch;
}

.nav-menu a {
    display: inline-flex;
    align-items: center;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #374151;
    padding-block: 0.5rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current_page_item > a,
.nav-menu .current-category-ancestor > a,
.nav-menu .current-post-ancestor > a,
.nav-menu .current-menu-parent > a,
.nav-menu .is-active > a {
    color: var(--theme-text);
    border-bottom-color: var(--theme-accent);
}

.header-actions {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--theme-radius);
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
    background: var(--theme-surface);
    color: var(--theme-text);
}

.icon-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

.menu-toggle {
    display: none;
}

/* Search Bar Dropdown */
.header-search-panel {
    display: none;
    padding-block: 0.75rem;
    border-bottom: 1px solid var(--theme-border);
    background: var(--theme-surface);
}

.header-search-panel.is-open {
    display: block;
}

.header-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-search-input {
    flex: 1 1 auto;
    height: 2.5rem;
    padding: 0.5rem 0.875rem;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--theme-text);
    background: var(--theme-bg);
    border: 1px solid #d1d5db;
    border-radius: var(--theme-radius);
    outline: none;
}

.header-search-input:focus {
    border-color: var(--theme-accent);
}

.header-search-submit {
    height: 2.5rem;
    padding-inline: 1.125rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--theme-accent);
    border: 0;
    border-radius: var(--theme-radius);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.header-search-submit:hover {
    opacity: 0.9;
}

/* Archive / Section Header */
.archive-header {
    padding-top: 1.5rem;
    padding-bottom: 0.25rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.archive-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-text);
}

.archive-count {
    font-size: 0.875rem;
    color: var(--theme-muted);
}

/* 5-Column Drama & Movie Grid */
.grid-section {
    padding-block: 1.5rem 2.75rem;
}

.drama-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5rem 1.125rem;
}

.drama-card {
    display: block;
    min-width: 0;
}

.drama-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--theme-radius);
    overflow: hidden;
    background: #16181a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.drama-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.28s ease;
}

.drama-card:hover .drama-thumb img {
    transform: scale(1.04);
}

.drama-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2937, #111827);
    color: rgba(255, 255, 255, 0.45);
}

.drama-thumb-fallback svg {
    width: 2.25rem;
    height: 2.25rem;
}

.drama-title {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--theme-text);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.drama-card:hover .drama-title {
    color: var(--theme-accent);
}

/* Pagination */
.pagination-nav {
    margin-top: 2.25rem;
    display: flex;
    justify-content: center;
}

.pagination-nav .nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.pagination-nav .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding-inline: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    transition: all 0.2s ease;
}

.pagination-nav a.page-numbers:hover {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

.pagination-nav .page-numbers.current {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    color: #ffffff;
}

/* Single Watch Page */
.watch-section {
    padding-block: 1.5rem 3rem;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--theme-muted);
}

.breadcrumbs a:hover {
    color: var(--theme-accent);
}

.watch-player-wrap {
    max-width: 1040px;
    margin-inline: auto;
}

.watch-player-notice {
    padding: 2rem 1.25rem;
    text-align: center;
    background: var(--theme-surface);
    border: 1px dashed #d1d5db;
    border-radius: var(--theme-radius);
    color: var(--theme-muted);
    font-size: 0.9375rem;
}

.watch-meta {
    max-width: 1040px;
    margin: 1.25rem auto 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--theme-border);
}

.watch-title {
    margin: 0;
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    font-weight: 700;
    color: var(--theme-text);
    line-height: 1.4;
}

.watch-taxonomy {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.watch-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 9999px;
    color: #374151;
    transition: all 0.2s ease;
}

.watch-badge:hover {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

.watch-description {
    margin-top: 1rem;
    color: #374151;
    font-size: 0.9375rem;
    line-height: 1.75;
}

.watch-description p:last-child {
    margin-bottom: 0;
}

.related-section {
    margin-top: 2rem;
}

.section-heading {
    margin: 0 0 1.25rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--theme-text);
}

/* Single Standard Page & 404 */
.page-section {
    padding-block: 2rem 3rem;
}

.page-card {
    max-width: 860px;
    margin-inline: auto;
}

.page-title {
    margin: 0 0 1rem;
    font-size: 1.625rem;
    font-weight: 700;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--theme-muted);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background: var(--theme-accent);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--theme-radius);
    margin-top: 1rem;
}

/* Footer */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--theme-border);
    padding-block: 1.25rem;
    background: var(--theme-bg);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--theme-muted);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .drama-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .header-inner {
        gap: 1rem;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .main-navigation {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--theme-bg);
        border-bottom: 1px solid var(--theme-border);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
        padding: 0.5rem 1rem 1rem;
        z-index: 60;
    }

    .main-navigation.is-open {
        display: block;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.25rem;
    }

    .nav-menu a {
        width: 100%;
        padding-block: 0.625rem;
        border-bottom: 0;
        border-left: 3px solid transparent;
        padding-inline-start: 0.75rem;
        margin-bottom: 0;
    }

    .nav-menu .current-menu-item > a,
    .nav-menu .current_page_item > a,
    .nav-menu .is-active > a {
        border-left-color: var(--theme-accent);
        color: var(--theme-accent);
        background: var(--theme-surface);
    }

    .drama-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.25rem 0.875rem;
    }
}

@media (max-width: 520px) {
    .drama-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.125rem 0.75rem;
    }

    .drama-title {
        font-size: 0.8125rem;
    }
}
