/* ========== Unified Anime Card (.oku-card) ========== */
.oku-card {
    display: flex;
    flex-direction: row;
    text-decoration: none;
    position: relative;
    z-index: 1;
}
.oku-card:hover { z-index: 10; }

.oku-card-image {
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.oku-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.oku-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 0.625rem 0.625rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 40%, rgba(0,0,0,0.4) 70%, transparent 100%);
    z-index: 3;
}
.oku-card-title span {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    line-height: 1.15;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* ========== Slide-out panel ========== */
.oku-card-slide {
    position: absolute;
    top: 0;
    left: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgb(28,26,42) 0%, rgb(22,20,32) 100%);
    border: 1px solid rgba(139,92,246,0.15);
    border-left: none;
    border-radius: 0 12px 12px 0;
    padding: 1rem;
    z-index: 1;
    width: 266px;
    min-width: 266px;
    overflow: hidden;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 0.75rem;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}
.oku-card:hover .oku-card-slide {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    left: calc(100% - 8px);
}
.oku-card:hover .oku-card-image {
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    transform: translateX(-8px);
}

/* Right-edge flip */
.oku-card.slide-left .oku-card-slide {
    left: auto;
    right: 100%;
    border-radius: 12px 0 0 12px;
    border: 1px solid rgba(139,92,246,0.15);
    border-right: none;
    clip-path: inset(0 0 0 100%);
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.oku-card.slide-left:hover .oku-card-slide {
    clip-path: inset(0 0 0 0);
    right: calc(100% - 8px);
}
.oku-card.slide-left:hover .oku-card-image {
    transform: translateX(8px);
}

/* ========== Top stats (trackers + retention + rating + fav) - absolute top-right ========== */
.oku-card-top-stats {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}
.oku-card-top-stats-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.oku-card-trackers {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #93c5fd;
}
.oku-card-trackers svg {
    width: 12px;
    height: 12px;
}

.oku-card-rating {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fcd34d;
}
.oku-card-rating svg {
    width: 12px;
    height: 12px;
    color: #fcd34d;
}
.oku-card-rating-count {
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.7;
}

.oku-card-retention {
    font-size: 0.7rem;
    font-weight: 600;
}
.oku-card-retention.high { color: #4ade80; }
.oku-card-retention.mid { color: #fbbf24; }
.oku-card-retention.low { color: #f87171; }

/* ========== Meta row (format · studio · source) ========== */
.oku-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.oku-card-meta-divider {
    color: var(--text-muted);
    opacity: 0.5;
}

.oku-card-format {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
}
.oku-card-format[data-format="tv"] { background: rgba(59,130,246,0.2); color: #93c5fd; }
.oku-card-format[data-format="tv_short"] { background: rgba(59,130,246,0.2); color: #93c5fd; }
.oku-card-format[data-format="ona"] { background: rgba(168,85,247,0.2); color: #c4b5fd; }
.oku-card-format[data-format="movie"] { background: rgba(251,191,36,0.2); color: #fde68a; }
.oku-card-format[data-format="ova"] { background: rgba(236,72,153,0.2); color: #f9a8d4; }
.oku-card-format[data-format="special"] { background: rgba(52,211,153,0.2); color: #6ee7b7; }
.oku-card-format[data-format="music"] { background: rgba(217,70,239,0.2); color: #e879f9; }

.oku-card-studio {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.oku-card-source {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* ========== Stats row (episodes · status · favorites · retention) ========== */
.oku-card-stats {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}
.oku-card-stat {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}
.oku-card-status.airing {
    color: #4ade80;
    background: rgba(74,222,128,0.12);
}
.oku-card-status.upcoming {
    color: var(--primary-light);
    background: rgba(167,139,250,0.12);
}
.oku-card-fav {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #f472b6;
}
.oku-card-fav svg {
    width: 12px;
    height: 12px;
}

/* ========== Description ========== */
.oku-card-desc {
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ========== Genres (bottom section) ========== */
.oku-card-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.oku-card-genres {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.oku-card-genre {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(139,92,246,0.2);
    padding: 0.2rem 0.45rem;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s ease;
}

/* Genre-specific colors */
.oku-card-genre[data-genre="action"] { background: rgba(239,68,68,0.2); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.oku-card-genre[data-genre="adventure"] { background: rgba(34,197,94,0.2); color: #86efac; border-color: rgba(34,197,94,0.3); }
.oku-card-genre[data-genre="comedy"] { background: rgba(251,191,36,0.2); color: #fde047; border-color: rgba(251,191,36,0.3); }
.oku-card-genre[data-genre="drama"] { background: rgba(168,85,247,0.2); color: #c4b5fd; border-color: rgba(168,85,247,0.3); }
.oku-card-genre[data-genre="fantasy"] { background: rgba(139,92,246,0.2); color: #c4b5fd; border-color: rgba(139,92,246,0.3); }
.oku-card-genre[data-genre="horror"] { background: rgba(100,116,139,0.25); color: #cbd5e1; border-color: rgba(100,116,139,0.35); }
.oku-card-genre[data-genre="mystery"] { background: rgba(99,102,241,0.2); color: #a5b4fc; border-color: rgba(99,102,241,0.3); }
.oku-card-genre[data-genre="psychological"] { background: rgba(129,140,248,0.2); color: #a5b4fc; border-color: rgba(129,140,248,0.3); }
.oku-card-genre[data-genre="romance"] { background: rgba(244,114,182,0.2); color: #f9a8d4; border-color: rgba(244,114,182,0.3); }
.oku-card-genre[data-genre="sci-fi"] { background: rgba(6,182,212,0.2); color: #67e8f9; border-color: rgba(6,182,212,0.3); }
.oku-card-genre[data-genre="slice of life"] { background: rgba(52,211,153,0.2); color: #6ee7b7; border-color: rgba(52,211,153,0.3); }
.oku-card-genre[data-genre="sports"] { background: rgba(251,146,60,0.2); color: #fdba74; border-color: rgba(251,146,60,0.3); }
.oku-card-genre[data-genre="supernatural"] { background: rgba(192,132,252,0.2); color: #d8b4fe; border-color: rgba(192,132,252,0.3); }
.oku-card-genre[data-genre="thriller"] { background: rgba(248,113,113,0.2); color: #fca5a5; border-color: rgba(248,113,113,0.3); }
.oku-card-genre[data-genre="mecha"] { background: rgba(148,163,184,0.2); color: #cbd5e1; border-color: rgba(148,163,184,0.3); }
.oku-card-genre[data-genre="music"] { background: rgba(217,70,239,0.2); color: #e879f9; border-color: rgba(217,70,239,0.3); }
.oku-card-genre[data-genre="ecchi"] { background: rgba(236,72,153,0.2); color: #f9a8d4; border-color: rgba(236,72,153,0.3); }

/* ========== Badge (image overlay) ========== */
.oku-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 4;
    background: rgba(0,0,0,0.8);
    color: white;
    backdrop-filter: blur(4px);
}

/* ========== Score Badge (top-right, star icon) ========== */
.oku-card-score-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fcd34d;
    z-index: 4;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.oku-card-score-badge svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.oku-card:hover .oku-card-score-badge {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.05);
}


/* ========== Legacy class compat (used by user page slide-out) ========== */
.oku-card-slide-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.oku-card-slide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.oku-card-slide-score {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}
.oku-card-slide-score svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* ========== Add-to-list button (bottom-right of slide-out) ========== */
.oku-card-add-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.4);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    z-index: 5;
    backdrop-filter: blur(4px);
}
.oku-card-add-btn:hover {
    background: rgba(var(--primary-rgb), 0.6);
    border-color: rgba(var(--primary-rgb), 0.8);
    color: #fff;
    transform: scale(1.1);
}
.oku-card-add-btn svg {
    width: 16px;
    height: 16px;
}

/* Status-specific button colors (when anime is in user's list) */
.oku-card-add-btn.status-watching {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.45);
    color: #fff;
}
.oku-card-add-btn.status-watching:hover {
    background: rgba(34, 197, 94, 0.65);
    border-color: rgba(34, 197, 94, 0.8);
    color: #fff;
}
.oku-card-add-btn.status-completed {
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(59, 130, 246, 0.45);
    color: #fff;
}
.oku-card-add-btn.status-completed:hover {
    background: rgba(59, 130, 246, 0.65);
    border-color: rgba(59, 130, 246, 0.8);
    color: #fff;
}
.oku-card-add-btn.status-plan {
    border-color: rgba(var(--primary-rgb), 0.6);
    background: rgba(var(--primary-rgb), 0.45);
    color: #fff;
}
.oku-card-add-btn.status-plan:hover {
    background: rgba(var(--primary-rgb), 0.65);
    border-color: rgba(var(--primary-rgb), 0.8);
    color: #fff;
}
.oku-card-add-btn.status-paused {
    border-color: rgba(234, 179, 8, 0.6);
    background: rgba(234, 179, 8, 0.45);
    color: #fff;
}
.oku-card-add-btn.status-paused:hover {
    background: rgba(234, 179, 8, 0.65);
    border-color: rgba(234, 179, 8, 0.8);
    color: #fff;
}
.oku-card-add-btn.status-dropped {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.45);
    color: #fff;
}
.oku-card-add-btn.status-dropped:hover {
    background: rgba(239, 68, 68, 0.65);
    border-color: rgba(239, 68, 68, 0.8);
    color: #fff;
}
.oku-card-add-btn.status-rewatching {
    border-color: rgba(6, 182, 212, 0.6);
    background: rgba(6, 182, 212, 0.45);
    color: #fff;
}
.oku-card-add-btn.status-rewatching:hover {
    background: rgba(6, 182, 212, 0.65);
    border-color: rgba(6, 182, 212, 0.8);
    color: #fff;
}

/* ========== Mobile: disable slide-out, enable detail sheet ========== */
@media (max-width: 768px) {
    .oku-card-slide { display: none; }
    .oku-card:hover .oku-card-image { transform: none; }

    /* Card lift animation when detail sheet opens */
    .oku-card.oku-card-lifting {
        z-index: 50;
    }
    .oku-card.oku-card-lifting .oku-card-image {
        transform: translateY(-12px);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
        transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    }
}

/* ========== Mobile Detail Sheet (Bottom Sheet) ========== */
.oku-card-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.oku-card-detail-overlay.open {
    opacity: 1;
    visibility: visible;
}

.oku-card-detail-overlay.closing {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease-in, visibility 0.25s ease-in;
}

.oku-card-detail-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 75vh;
    overflow-y: auto;
    background: var(--bg-deep, #0f0f13);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.oku-card-detail-overlay.open .oku-card-detail-sheet {
    transform: translateY(0);
}

.oku-card-detail-overlay.closing .oku-card-detail-sheet {
    transform: translateY(100%);
    transition: transform 0.25s ease-in;
}

/* Drag indicator */
.oku-card-detail-sheet::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 10px auto 0;
}

/* Header: cover + (stats above title) */
.oku-card-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px 12px;
}

.oku-card-detail-cover {
    width: 60px;
    height: 85px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.oku-card-detail-header-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.oku-card-detail-stats {
    display: flex;
    justify-content: flex-end;
}

.oku-card-detail-stats .oku-card-top-stats {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.oku-card-detail-stats .oku-card-top-stats-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.oku-card-detail-stats .oku-card-fav {
    margin-left: auto;
}

.oku-card-detail-stats .oku-card-trackers,
.oku-card-detail-stats .oku-card-rating,
.oku-card-detail-stats .oku-card-retention,
.oku-card-detail-stats .oku-card-fav {
    font-size: 0.7rem;
}

.oku-card-detail-stats .oku-card-trackers svg,
.oku-card-detail-stats .oku-card-rating svg,
.oku-card-detail-stats .oku-card-fav svg {
    width: 12px;
    height: 12px;
}

.oku-card-detail-title {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Body: reuse slide-out classes with layout overrides */
.oku-card-detail-body {
    padding: 0 20px 8px;
}

.oku-card-detail-body .oku-card-meta {
    font-size: 0.8rem;
    margin-bottom: 10px;
    gap: 6px;
}

.oku-card-detail-body .oku-card-format {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

.oku-card-detail-body .oku-card-stats {
    margin-bottom: 10px;
    gap: 6px;
}

.oku-card-detail-body .oku-card-stat {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
}

.oku-card-detail-body .oku-card-desc {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary, #9ca3af);
    margin-bottom: 12px;
    max-height: 120px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    -webkit-box-orient: vertical;
}

.oku-card-detail-body .oku-card-genres {
    gap: 6px;
    margin-bottom: 4px;
}

.oku-card-detail-body .oku-card-genre {
    font-size: 0.65rem;
    padding: 0.25rem 0.55rem;
}

/* Action buttons */
.oku-card-detail-actions {
    display: flex;
    gap: 10px;
    padding: 12px 20px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.oku-card-detail-add-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    background: var(--primary, #8b5cf6);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-body, 'Space Grotesk', sans-serif);
}

.oku-card-detail-add-btn svg {
    width: 18px;
    height: 18px;
}

.oku-card-detail-add-btn:hover {
    background: var(--primary-hover, var(--primary-hover));
}

.oku-card-detail-view-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 12px;
    color: var(--text-primary, #fff);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body, 'Space Grotesk', sans-serif);
}

.oku-card-detail-view-btn svg {
    width: 18px;
    height: 18px;
}

.oku-card-detail-view-btn:hover {
    border-color: var(--primary, #8b5cf6);
    color: var(--primary, #8b5cf6);
}

/* Hide detail overlay on desktop */
@media (min-width: 769px) {
    .oku-card-detail-overlay {
        display: none !important;
    }
}
