/* ============================================================
   CreditBord Theme v1.4 — Full Dark Theme CSS
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --cb-bg:         #0b0d14;
    --cb-surface:    #12151f;
    --cb-surface-2:  #181c28;
    --cb-border:     rgba(255,255,255,.07);
    --cb-text:       #e2e8f0;
    --cb-muted:      #8892a4;
    --cb-accent:     #4ee8c4;
    --cb-accent-2:   #7c3aed;
    --cb-gold:       #ffd700;
    --cb-radius:     10px;
    --cb-shadow:     0 4px 24px rgba(0,0,0,.5);
    --cb-header-h:   68px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body.cb-body {
    background: var(--cb-bg);
    color: var(--cb-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--cb-bg); }
::-webkit-scrollbar-thumb { background: #2a2f3e; border-radius: 3px; }

/* ── Header ────────────────────────────────────────────────── */
.cb-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--cb-header-h);
    background: transparent;
    transition: background .3s, backdrop-filter .3s, box-shadow .3s;
}
.cb-header.cb-header--scrolled {
    background: rgba(11,13,20,.92);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 var(--cb-border);
}
.cb-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 24px;
}

/* Logo */
.cb-logo, .cb-logo a { display: flex; align-items: center; gap: 8px; }
.cb-logo img { height: 36px; width: auto; }
.cb-logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--cb-accent), var(--cb-accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -.5px;
}

/* Nav */
.cb-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.cb-nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--cb-muted);
    transition: color .2s, background .2s;
}
.cb-nav-link:hover, .cb-nav-link.active {
    color: var(--cb-text);
    background: rgba(255,255,255,.07);
}
.cb-nav-link.active { color: var(--cb-accent); }

/* Header actions */
.cb-header-actions { display: flex; align-items: center; gap: 8px; }
.cb-search-toggle, .cb-hamburger {
    background: none;
    border: none;
    color: var(--cb-muted);
    padding: 8px;
    border-radius: 6px;
    transition: color .2s, background .2s;
}
.cb-search-toggle:hover, .cb-hamburger:hover {
    color: var(--cb-text);
    background: rgba(255,255,255,.07);
}
.cb-hamburger { display: none; flex-direction: column; gap: 5px; }
.cb-hamburger span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; transition: .3s; }
.cb-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.cb-hamburger.open span:nth-child(2) { opacity: 0; }
.cb-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Search collapse */
.cb-search-collapse {
    display: none;
    background: rgba(11,13,20,.97);
    border-top: 1px solid var(--cb-border);
    padding: 12px 24px 16px;
    position: relative;
}
.cb-search-collapse.cb-search-collapse--open { display: block; }
.cb-search-bar-wrap {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}
.cb-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cb-muted);
    pointer-events: none;
}
.cb-search-input {
    width: 100%;
    background: var(--cb-surface-2);
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    color: var(--cb-text);
    font-size: .95rem;
    padding: 11px 14px 11px 44px;
    outline: none;
    transition: border-color .2s;
}
.cb-search-input:focus { border-color: var(--cb-accent); }
.cb-search-input::placeholder { color: var(--cb-muted); }
.cb-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 10px;
    overflow: hidden;
    z-index: 200;
    display: none;
    box-shadow: var(--cb-shadow);
}
.cb-search-results.open { display: block; }
.cb-sr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--cb-border);
    transition: background .15s;
}
.cb-sr-item:last-child { border-bottom: none; }
.cb-sr-item:hover { background: var(--cb-surface-2); }
.cb-sr-item img { width: 40px; height: 58px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.cb-sr-noposter { width: 40px; height: 58px; background: var(--cb-surface-2); border-radius: 4px; flex-shrink: 0; }
.cb-sr-info { flex: 1; }
.cb-sr-info b { display: block; font-size: .88rem; font-weight: 600; color: var(--cb-text); }
.cb-sr-info em { font-style: normal; font-size: .78rem; color: var(--cb-muted); }
.cb-sr-badge { font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: var(--cb-accent-2); color: #fff; }

/* ── Hero ──────────────────────────────────────────────────── */
.cb-hero {
    position: relative;
    min-height: 88vh;
    display: flex;
    align-items: flex-end;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    overflow: hidden;
}
.cb-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(11,13,20,.95) 0%,
        rgba(11,13,20,.7)  60%,
        rgba(11,13,20,.2)  100%
    ),
    linear-gradient(
        to top,
        rgba(11,13,20,1)   0%,
        transparent 50%
    );
}
.cb-hero-content {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 48px 72px;
    width: 100%;
    max-width: 680px;
}
.cb-hero-chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cb-hero-title {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    text-shadow: 0 2px 20px rgba(0,0,0,.6);
}
.cb-hero-overview {
    font-size: 1rem;
    color: rgba(255,255,255,.75);
    max-width: 520px;
    margin-bottom: 28px;
    line-height: 1.65;
}
.cb-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Buttons ───────────────────────────────────────────────── */
.cb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    border: none;
    transition: opacity .2s, transform .15s;
    cursor: pointer;
}
.cb-btn:hover { opacity: .88; transform: translateY(-1px); }
.cb-btn--primary { background: var(--cb-accent); color: #0b0d14; }
.cb-btn--secondary { background: rgba(255,255,255,.12); color: #fff; }

/* ── Chips ─────────────────────────────────────────────────── */
.cb-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: .78rem;
    font-weight: 600;
    background: rgba(255,255,255,.1);
    color: var(--cb-text);
}
.cb-chip--gold { background: rgba(255,215,0,.15); color: var(--cb-gold); }

/* ── Sections ──────────────────────────────────────────────── */
.cb-section-wrap { padding: 40px 0; }
.cb-section-container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.cb-section-heading {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    padding-left: 14px;
}
.cb-section-heading::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--cb-accent);
    border-radius: 2px;
}
.cb-sc-heading { margin-top: 24px; }

/* ── Cards Grid ────────────────────────────────────────────── */
.cb-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.cb-card-link { display: block; color: inherit; }
.cb-card {
    background: var(--cb-surface);
    border-radius: var(--cb-radius);
    overflow: hidden;
    border: 1px solid var(--cb-border);
    transition: transform .2s, box-shadow .2s;
}
.cb-card:hover { transform: translateY(-5px); box-shadow: 0 12px 32px rgba(0,0,0,.5); }
.cb-card-poster-wrap {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--cb-surface-2);
}
.cb-card-poster-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .35s;
}
.cb-card:hover .cb-card-poster-wrap img { transform: scale(1.05); }
.cb-card-no-poster { width: 100%; height: 100%; background: var(--cb-surface-2); }
.cb-card-rating {
    position: absolute;
    top: 8px; left: 8px;
    background: rgba(0,0,0,.75);
    padding: 3px 7px;
    border-radius: 5px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--cb-gold);
    backdrop-filter: blur(4px);
}
.cb-card-type-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--cb-accent-2);
    color: #fff;
    font-size: .6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: .5px;
}
.cb-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11,13,20,.88);
    display: flex;
    align-items: flex-end;
    padding: 12px;
    opacity: 0;
    transition: opacity .25s;
}
.cb-card:hover .cb-card-overlay { opacity: 1; }
.cb-card-overview { font-size: .76rem; color: rgba(255,255,255,.85); line-height: 1.5; }
.cb-card-body { padding: 10px 12px 12px; }
.cb-card-title {
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.cb-card-year { font-size: .75rem; color: var(--cb-muted); }

/* ── Browse page ───────────────────────────────────────────── */
.cb-browse-page { padding-top: calc(var(--cb-header-h) + 32px); }
.cb-browse-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.cb-category-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cb-cat-tab {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: .84rem;
    font-weight: 600;
    background: var(--cb-surface);
    color: var(--cb-muted);
    border: 1px solid var(--cb-border);
    transition: all .2s;
}
.cb-cat-tab:hover { color: var(--cb-text); border-color: var(--cb-accent); }
.cb-cat-tab.active { background: var(--cb-accent); color: #0b0d14; border-color: var(--cb-accent); }

/* Pagination */
.cb-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 40px; }
.cb-page-btn {
    padding: 9px 22px;
    border-radius: 7px;
    background: var(--cb-surface);
    color: var(--cb-text);
    border: 1px solid var(--cb-border);
    font-weight: 600;
    font-size: .88rem;
    transition: background .2s, border-color .2s;
}
.cb-page-btn:hover { background: var(--cb-accent); color: #0b0d14; border-color: var(--cb-accent); }
.cb-page-num { color: var(--cb-muted); font-size: .88rem; }

/* ── Detail / Watch Page ───────────────────────────────────── */
.cb-detail-page { padding-top: var(--cb-header-h); }
.cb-detail-topbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 24px 0;
}
.cb-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .86rem;
    font-weight: 600;
    color: var(--cb-muted);
    padding: 7px 14px;
    border-radius: 6px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--cb-border);
    transition: color .2s, background .2s;
}
.cb-back-btn:hover { color: var(--cb-text); background: rgba(255,255,255,.1); }

.cb-detail-hero {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 36px;
    max-width: 1400px;
    margin: 28px auto 0;
    padding: 0 24px;
    align-items: start;
}
.cb-detail-poster-wrap { flex-shrink: 0; }
.cb-detail-poster {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,.7);
    border: 1px solid var(--cb-border);
}
.cb-poster-placeholder {
    width: 220px; height: 330px;
    background: var(--cb-surface-2);
    border-radius: 12px;
}
.cb-detail-title {
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    font-weight: 800;
    margin-bottom: 6px;
    line-height: 1.15;
}
.cb-detail-tagline {
    font-size: .95rem;
    color: var(--cb-muted);
    font-style: italic;
    margin-bottom: 14px;
}
.cb-detail-chips { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.cb-detail-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.cb-genre-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .76rem;
    font-weight: 600;
    border: 1px solid var(--cb-accent);
    color: var(--cb-accent);
    background: rgba(78,232,196,.06);
}
.cb-detail-overview-wrap { margin-bottom: 18px; }
.cb-detail-overview-label { font-size: .78rem; font-weight: 700; color: var(--cb-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.cb-detail-overview { font-size: .95rem; line-height: 1.7; color: rgba(255,255,255,.82); }
.cb-detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-top: 16px;
}
.cb-detail-meta-grid > div { display: flex; flex-direction: column; gap: 2px; }
.cb-meta-full { grid-column: 1/-1; }
.cb-meta-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--cb-muted); }
.cb-meta-val { font-size: .88rem; color: var(--cb-text); }

/* ── Player Section ────────────────────────────────────────── */
.cb-player-section {
    max-width: 1400px;
    margin: 36px auto 0;
    padding: 0 24px;
}
.cb-player-inner {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 14px;
    overflow: hidden;
}
.cb-player-controls {
    padding: 14px 18px;
    background: var(--cb-surface-2);
    border-bottom: 1px solid var(--cb-border);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.cb-server-label { font-size: .8rem; font-weight: 700; color: var(--cb-muted); text-transform: uppercase; letter-spacing: .5px; }
.cb-server-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cb-srv-btn {
    padding: 7px 15px;
    border-radius: 6px;
    font-size: .83rem;
    font-weight: 600;
    background: var(--cb-surface);
    color: var(--cb-muted);
    border: 1px solid var(--cb-border);
    transition: all .2s;
}
.cb-srv-btn:hover { color: var(--cb-text); border-color: var(--cb-accent); }
.cb-srv-btn.active { background: var(--cb-accent); color: #0b0d14; border-color: var(--cb-accent); }

/* Episode controls */
.cb-ep-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.cb-ep-group { display: flex; flex-direction: column; gap: 2px; }
.cb-ep-label { font-size: .7rem; font-weight: 700; color: var(--cb-muted); text-transform: uppercase; }
.cb-ep-select {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    color: var(--cb-text);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .84rem;
    outline: none;
    cursor: pointer;
}
.cb-ep-select:focus { border-color: var(--cb-accent); }
.cb-ep-load-btn {
    padding: 8px 18px;
    border-radius: 6px;
    background: var(--cb-accent-2);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: .85rem;
    transition: opacity .2s;
}
.cb-ep-load-btn:hover { opacity: .85; }

/* iframe */
.cb-iframe-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.cb-player-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* ── Cast ──────────────────────────────────────────────────── */
.cb-cast-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 14px;
}
.cb-cast-card { text-align: center; }
.cb-cast-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.cb-cast-noimg { width: 100%; aspect-ratio: 2/3; background: var(--cb-surface-2); border-radius: 8px; margin-bottom: 6px; }
.cb-cast-name { font-size: .78rem; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-cast-char { font-size: .7rem; color: var(--cb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Detail card (shortcode) ───────────────────────────────── */
.cb-detail-card {
    display: flex;
    gap: 20px;
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    overflow: hidden;
    padding: 16px;
    align-items: flex-start;
    max-width: 680px;
}
.cb-dc-poster { width: 100px; flex-shrink: 0; border-radius: 8px; }
.cb-dc-info { flex: 1; }
.cb-dc-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.cb-dc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cb-dc-overview { font-size: .85rem; color: var(--cb-muted); margin-bottom: 14px; line-height: 1.6; }
.cb-dc-watch-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 6px;
    background: var(--cb-accent);
    color: #0b0d14;
    font-weight: 700;
    font-size: .85rem;
    transition: opacity .2s;
}
.cb-dc-watch-btn:hover { opacity: .85; }

/* ── Ad Slots ──────────────────────────────────────────────── */
.cb-ad-slot {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 24px;
    text-align: center;
}
.cb-ad-footer {
    margin: 0;
    padding: 20px 24px;
    background: var(--cb-surface);
    border-top: 1px solid var(--cb-border);
}

/* ── Footer ────────────────────────────────────────────────── */
.cb-footer {
    background: var(--cb-surface);
    border-top: 1px solid var(--cb-border);
    margin-top: 60px;
}
.cb-footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.cb-footer-nav { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.cb-footer-nav a { font-size: .88rem; color: var(--cb-muted); transition: color .2s; }
.cb-footer-nav a:hover { color: var(--cb-text); }
.cb-footer-copy { font-size: .8rem; color: var(--cb-muted); }
.cb-footer-copy a { color: var(--cb-accent); }

/* ── Generic page ──────────────────────────────────────────── */
.cb-page-content { color: var(--cb-muted); line-height: 1.8; }
.cb-page-content p { margin-bottom: 14px; }
.cb-page-content h2, .cb-page-content h3 { color: var(--cb-text); margin: 20px 0 10px; }

/* ── Shortcode search widget ───────────────────────────────── */
.cb-search-widget { margin: 16px 0; }
.cb-sc-search .cb-search-bar-wrap { max-width: 100%; }
.cb-sc-search .cb-search-results { max-height: 380px; overflow-y: auto; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cb-detail-hero { grid-template-columns: 1fr; }
    .cb-detail-poster-wrap { display: flex; justify-content: center; }
    .cb-detail-poster { max-width: 200px; }
    .cb-hamburger { display: flex; }
    .cb-nav {
        display: none;
        position: fixed;
        top: var(--cb-header-h);
        left: 0; right: 0;
        background: rgba(11,13,20,.97);
        backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 20px;
        border-bottom: 1px solid var(--cb-border);
        gap: 6px;
    }
    .cb-nav.cb-nav--open { display: flex; }
    .cb-nav-link { padding: 12px 16px; font-size: 1rem; }
}

@media (max-width: 600px) {
    .cb-hero-content { padding: 0 20px 50px; }
    .cb-cards-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
    .cb-player-controls { padding: 10px 12px; gap: 10px; }
    .cb-ep-controls { margin-left: 0; width: 100%; }
    .cb-detail-meta-grid { grid-template-columns: 1fr; }
    .cb-panels { grid-template-columns: 1fr; }
}
