/* ========================================
   UNIFIED CARD SYSTEM - COMPLETE STYLES
   Episode Badge: Bottom Right
   Status Badge: Top Right
   ======================================== */

/* ─── DRAMA GRID ─── */
.drama-grid {
    display: grid;
    gap: 20px;
    border-radius: var(--radius);
}

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}
.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}
.grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* ─── DRAMA CARD ─── */
.drama-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.drama-card .card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ─── CARD THUMB ─── */
.drama-card .card-thumb {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    aspect-ratio: 16/9;
    flex-shrink: 0;
}

.drama-card .card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.drama-card .card-thumb.thumb-poster {
    aspect-ratio: 2/3;
}
.drama-card .card-thumb.thumb-backdrop {
    aspect-ratio: 16/9;
}

/* ─── CARD INFO ─── */
.drama-card .card-info {
    padding: 12px 14px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--card);
}

.drama-card .card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
    transition: color 0.2s ease;
}

.drama-card:hover .card-title {
    color: var(--gold);
}

/* ─── CARD META ─── */
.drama-card .card-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--muted);
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.drama-card .card-meta .meta-year {
    color: var(--text-secondary);
}
.drama-card .card-meta .meta-country {
    color: var(--text-secondary);
}
.drama-card .card-meta .meta-sep {
    opacity: 0.3;
}

/* ─── CARD GENRES ─── */
.drama-card .card-genres {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.drama-card .card-genres .genre-tag {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 4px;
    background: rgba(232, 185, 35, 0.08);
    color: var(--gold);
    border: 1px solid rgba(232, 185, 35, 0.12);
    transition: all 0.2s ease;
}

.drama-card .card-genres .genre-tag.more {
    background: var(--surface);
    color: var(--muted);
    border-color: var(--border);
}

.drama-card:hover .card-genres .genre-tag {
    background: rgba(232, 185, 35, 0.15);
}

/* ─── CARD BADGES - TOP RIGHT ─── */
.card-badges-top {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
    align-items: flex-end;
    pointer-events: none;
}

.card-badges-top .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    line-height: 1.4;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

/* Status Badge - Top Right */
.card-badges-top .badge-status {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.card-badges-top .badge-status-ongoing {
    background: rgba(46, 204, 113, 0.92);
    color: #fff;
    border-color: rgba(46, 204, 113, 0.4);
    box-shadow: 0 2px 12px rgba(46, 204, 113, 0.25);
}

.card-badges-top .badge-status-ongoing .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.card-badges-top .badge-status-completed {
    background: rgba(52, 152, 219, 0.92);
    color: #fff;
    border-color: rgba(52, 152, 219, 0.4);
    box-shadow: 0 2px 12px rgba(52, 152, 219, 0.2);
}

.card-badges-top .badge-status-upcoming {
    background: rgba(241, 196, 15, 0.92);
    color: #000;
    border-color: rgba(241, 196, 15, 0.4);
    box-shadow: 0 2px 12px rgba(241, 196, 15, 0.2);
}

.card-badges-top .badge-status-upcoming svg {
    color: #000;
}

.card-badges-top .badge-status-ongoing svg,
.card-badges-top .badge-status-completed svg {
    color: #fff;
}

/* Content Type Badge - Top Right (below status) */
.card-badges-top .badge-type {
    background: rgba(232, 185, 35, 0.92);
    color: #000;
    font-weight: 700;
    font-size: 9px;
    padding: 2px 10px;
    border-color: rgba(232, 185, 35, 0.3);
    box-shadow: 0 2px 12px rgba(232, 185, 35, 0.2);
}

.card-badges-top .badge-type svg {
    color: #000;
}

/* ─── CARD BADGES - BOTTOM ─── */
.card-badges-bottom {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 2;
    flex-wrap: wrap;
    justify-content: flex-start;
    pointer-events: none;
}

.card-badges-bottom .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    line-height: 1.4;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

/* Rating Badge - Bottom Left */
.card-badges-bottom .badge-rating {
    color: var(--gold);
    background: rgba(0, 0, 0, 0.8);
    font-weight: 700;
    border-color: rgba(232, 185, 35, 0.15);
}

.card-badges-bottom .badge-rating svg {
    color: var(--gold);
}

/* Views Badge - Bottom Left */
.card-badges-bottom .badge-views {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.6);
}

.card-badges-bottom .badge-views svg {
    color: var(--muted);
}

/* ─── EPISODE BADGE - BOTTOM RIGHT ─── */
.card-badges-bottom .badge-ep {
    margin-left: auto;
    background: rgba(232, 185, 35, 0.95);
    color: #000;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 12px;
    border-color: rgba(232, 185, 35, 0.3);
    box-shadow: 0 2px 16px rgba(232, 185, 35, 0.35);
    letter-spacing: 0.5px;
}

.card-badges-bottom .badge-ep svg {
    color: #000;
}

/* ─── HOVER EFFECTS ─── */

/* Scale Effect */
.drama-card.hover-scale:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: var(--gold);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.drama-card.hover-scale:hover .card-thumb img {
    transform: scale(1.08);
}

/* Glow Effect */
.drama-card.hover-glow:hover {
    border-color: var(--gold);
    box-shadow: 0 0 40px rgba(232, 185, 35, 0.15), 0 8px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

.drama-card.hover-glow:hover .card-thumb img {
    transform: scale(1.05);
}

/* Lift Effect */
.drama-card.hover-lift:hover {
    transform: translateY(-8px);
    border-color: var(--gold);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.drama-card.hover-lift:hover .card-thumb img {
    transform: scale(1.04);
}

/* ─── SIZE VARIANTS ─── */

/* Small Cards */
.drama-card.card-small .card-info {
    padding: 8px 10px 10px;
}
.drama-card.card-small .card-title {
    font-size: 13px;
}
.drama-card.card-small .card-meta {
    font-size: 10px;
    gap: 6px;
}
.drama-card.card-small .card-genres .genre-tag {
    font-size: 9px;
    padding: 1px 8px;
}
.drama-card.card-small .card-badges-top .badge {
    font-size: 8px;
    padding: 2px 7px;
}
.drama-card.card-small .card-badges-top .badge-status {
    font-size: 8px;
    padding: 2px 8px;
}
.drama-card.card-small .card-badges-top .badge-type {
    font-size: 7px;
    padding: 1px 7px;
}
.drama-card.card-small .card-badges-bottom .badge {
    font-size: 8px;
    padding: 2px 7px;
}
.drama-card.card-small .card-badges-bottom .badge-ep {
    font-size: 9px;
    padding: 2px 9px;
}
.drama-card.card-small .card-badges-bottom .badge-rating {
    font-size: 8px;
    padding: 2px 7px;
}
.drama-card.card-small .card-badges-bottom .badge-views {
    font-size: 8px;
    padding: 2px 7px;
}
.drama-card.card-small .card-badges-top {
    top: 5px;
    right: 5px;
    gap: 3px;
}
.drama-card.card-small .card-badges-bottom {
    bottom: 5px;
    left: 5px;
    right: 5px;
    gap: 4px;
}

/* Large Cards */
.drama-card.card-large .card-info {
    padding: 16px 18px 18px;
}
.drama-card.card-large .card-title {
    font-size: 18px;
}
.drama-card.card-large .card-meta {
    font-size: 13px;
    gap: 14px;
}
.drama-card.card-large .card-genres .genre-tag {
    font-size: 12px;
    padding: 3px 14px;
}
.drama-card.card-large .card-badges-top .badge {
    font-size: 12px;
    padding: 5px 14px;
}
.drama-card.card-large .card-badges-top .badge-status {
    font-size: 12px;
    padding: 5px 16px;
}
.drama-card.card-large .card-badges-top .badge-type {
    font-size: 10px;
    padding: 3px 12px;
}
.drama-card.card-large .card-badges-bottom .badge {
    font-size: 12px;
    padding: 5px 14px;
}
.drama-card.card-large .card-badges-bottom .badge-ep {
    font-size: 13px;
    padding: 5px 16px;
}
.drama-card.card-large .card-badges-bottom .badge-rating {
    font-size: 12px;
    padding: 5px 14px;
}
.drama-card.card-large .card-badges-bottom .badge-views {
    font-size: 12px;
    padding: 5px 14px;
}
.drama-card.card-large .card-badges-top {
    top: 12px;
    right: 12px;
    gap: 6px;
}
.drama-card.card-large .card-badges-bottom {
    bottom: 12px;
    left: 12px;
    right: 12px;
    gap: 8px;
}

/* ─── ANIMATIONS ─── */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.drama-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.drama-card:nth-child(1) { animation-delay: 0.02s; }
.drama-card:nth-child(2) { animation-delay: 0.04s; }
.drama-card:nth-child(3) { animation-delay: 0.06s; }
.drama-card:nth-child(4) { animation-delay: 0.08s; }
.drama-card:nth-child(5) { animation-delay: 0.10s; }
.drama-card:nth-child(6) { animation-delay: 0.12s; }
.drama-card:nth-child(7) { animation-delay: 0.14s; }
.drama-card:nth-child(8) { animation-delay: 0.16s; }
.drama-card:nth-child(9) { animation-delay: 0.18s; }
.drama-card:nth-child(10) { animation-delay: 0.20s; }
.drama-card:nth-child(11) { animation-delay: 0.22s; }
.drama-card:nth-child(12) { animation-delay: 0.24s; }
.drama-card:nth-child(13) { animation-delay: 0.26s; }
.drama-card:nth-child(14) { animation-delay: 0.28s; }
.drama-card:nth-child(15) { animation-delay: 0.30s; }
.drama-card:nth-child(16) { animation-delay: 0.32s; }
.drama-card:nth-child(17) { animation-delay: 0.34s; }
.drama-card:nth-child(18) { animation-delay: 0.36s; }
.drama-card:nth-child(19) { animation-delay: 0.38s; }
.drama-card:nth-child(20) { animation-delay: 0.40s; }

/* ─── SECTION HEADER ─── */
.content-section {
    margin-bottom: 36px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.section-icon {
    font-size: 22px;
    line-height: 1;
}

.view-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.view-all:hover {
    color: var(--gold);
    transform: translateX(4px);
}

.view-all svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.view-all:hover svg {
    transform: translateX(2px);
}

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ─── RESPONSIVE ─── */

/* Tablet */
@media (max-width: 1024px) {
    .grid-auto {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .grid-5 {
        grid-template-columns: repeat(4, 1fr);
    }
    .grid-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 820px) {
    .grid-auto {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    .grid-4, .grid-5, .grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .section-title h2 {
        font-size: 18px;
    }
    .drama-card .card-title {
        font-size: 14px;
    }
    .drama-grid {
        gap: 16px;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .grid-auto {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .grid-3, .grid-4, .grid-5, .grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
    
    .drama-card .card-title {
        font-size: 13px;
    }
    .drama-card .card-info {
        padding: 8px 10px 10px;
    }
    .drama-card .card-meta {
        font-size: 10px;
        gap: 6px;
    }
    .drama-card .card-genres .genre-tag {
        font-size: 9px;
        padding: 1px 8px;
    }
    
    .card-badges-top {
        top: 6px;
        right: 6px;
        gap: 3px;
    }
    .card-badges-top .badge {
        font-size: 8px;
        padding: 2px 8px;
    }
    .card-badges-top .badge-status {
        font-size: 8px;
        padding: 2px 8px;
    }
    .card-badges-top .badge-type {
        font-size: 7px;
        padding: 1px 6px;
    }
    
    .card-badges-bottom {
        bottom: 6px;
        left: 6px;
        right: 6px;
        gap: 4px;
    }
    .card-badges-bottom .badge {
        font-size: 8px;
        padding: 2px 7px;
    }
    .card-badges-bottom .badge-ep {
        font-size: 9px;
        padding: 2px 9px;
    }
    .card-badges-bottom .badge-rating {
        font-size: 8px;
        padding: 2px 7px;
    }
    .card-badges-bottom .badge-views {
        font-size: 8px;
        padding: 2px 7px;
    }
    
    .section-title h2 {
        font-size: 16px;
    }
    .view-all {
        font-size: 12px;
    }
    .content-section {
        margin-bottom: 24px;
    }
    
    /* Disable animation on mobile for performance */
    .drama-card {
        animation: none;
        opacity: 1;
    }
}

/* Small Mobile */
@media (max-width: 400px) {
    .grid-auto {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .drama-card .card-title {
        font-size: 12px;
    }
    .drama-card .card-info {
        padding: 6px 8px 8px;
    }
    .drama-card .card-meta {
        font-size: 9px;
        gap: 4px;
    }
    .drama-card .card-genres .genre-tag {
        font-size: 8px;
        padding: 1px 6px;
    }
    
    .card-badges-top .badge {
        font-size: 7px;
        padding: 1px 6px;
    }
    .card-badges-top .badge-status {
        font-size: 7px;
        padding: 1px 6px;
    }
    .card-badges-top .badge-type {
        font-size: 6px;
        padding: 1px 5px;
    }
    
    .card-badges-bottom .badge {
        font-size: 7px;
        padding: 1px 6px;
    }
    .card-badges-bottom .badge-ep {
        font-size: 8px;
        padding: 1px 7px;
    }
    .card-badges-bottom .badge-rating {
        font-size: 7px;
        padding: 1px 6px;
    }
    .card-badges-bottom .badge-views {
        font-size: 7px;
        padding: 1px 6px;
    }
}

/* ─── SIDEBAR CARDS ─── */
.drama-card.sidebar-card .card-title {
    font-size: 12px;
}
.drama-card.sidebar-card .card-info {
    padding: 8px 10px 10px;
}
.drama-card.sidebar-card .card-thumb {
    aspect-ratio: 16/9;
}
.drama-card.sidebar-card .card-badges-top .badge {
    font-size: 7px;
    padding: 1px 6px;
}
.drama-card.sidebar-card .card-badges-top .badge-status {
    font-size: 7px;
    padding: 1px 6px;
}
.drama-card.sidebar-card .card-badges-bottom .badge {
    font-size: 7px;
    padding: 1px 6px;
}
.drama-card.sidebar-card .card-badges-bottom .badge-ep {
    font-size: 8px;
    padding: 1px 7px;
}
.drama-card.sidebar-card .card-badges-bottom .badge-rating {
    font-size: 7px;
    padding: 1px 6px;
}
.drama-card.sidebar-card .card-badges-bottom .badge-views {
    font-size: 7px;
    padding: 1px 6px;
}
.drama-card.sidebar-card .card-badges-top {
    top: 4px;
    right: 4px;
    gap: 2px;
}
.drama-card.sidebar-card .card-badges-bottom {
    bottom: 4px;
    left: 4px;
    right: 4px;
    gap: 3px;
}

/* ─── THEME VARIABLES (Fallback) ─── */
:root {
    --card: #171a20;
    --surface: #111318;
    --border: #242830;
    --text: #e2e4ea;
    --text-secondary: #a0a0b0;
    --muted: #7a7f91;
    --gold: #e8b923;
    --gold-dim: rgba(232, 185, 35, 0.2);
    --border-radius: 8px;
}

/* ─── PRINT STYLES ─── */
@media print {
    .drama-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
    .drama-card .card-thumb img {
        max-height: 200px;
    }
    .drama-card .card-badges-top,
    .drama-card .card-badges-bottom {
        display: none;
    }
}