@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
    --bg-main: #0a0d14;
    --bg-card: rgba(22, 28, 45, 0.65);
    --bg-glass: rgba(15, 23, 42, 0.75);
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.4);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0a0d14;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Header & Navigation */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    transition: var(--transition);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.6rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.logo i {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.8rem;
}

.logo-text span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-categories {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.cat-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    background: transparent;
    color: var(--text-sub);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.cat-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.cat-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
    width: 260px;
}

.search-input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
    font-size: 0.9rem;
    pointer-events: none;
}

.watchlist-btn {
    position: relative;
    padding: 0.55rem 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.watchlist-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.watchlist-count {
    background: var(--accent-red);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

/* Hero Section */
.hero-section {
    position: relative;
    width: 100%;
    height: 480px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 20%;
    transition: opacity 0.8s ease-in-out;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--bg-main) 0%, rgba(10, 13, 20, 0.65) 50%, rgba(10, 13, 20, 0.3) 100%),
                linear-gradient(90deg, var(--bg-main) 0%, rgba(10, 13, 20, 0.8) 40%, transparent 100%);
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 700px;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #818cf8;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    width: fit-content;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 0.8rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    color: var(--text-sub);
    margin-bottom: 1rem;
}

.hero-meta .rating {
    color: var(--accent-gold);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.hero-overview {
    font-size: 0.95rem;
    color: #cbd5e1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.8rem;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    width: fit-content;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

/* Filter & Controls Bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.genre-list {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 4px;
    max-width: 75%;
}

.genre-badge {
    padding: 0.35rem 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-sub);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.genre-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.genre-badge.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    font-weight: 600;
}

.sort-select {
    padding: 0.5rem 1rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.sort-select option {
    background: #0f172a;
    color: #fff;
}

/* Movies Grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.8rem;
}

/* Movie Card */
.movie-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.movie-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-glow);
}

.poster-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    width: 100%;
    overflow: hidden;
    background: #1e293b;
}

.poster-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.movie-card:hover .poster-img {
    transform: scale(1.08);
}

/* Badges */
.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.badge-dday {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: #fff;
}

.badge-now {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.badge-upcoming {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
}

.card-rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--accent-gold);
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    backdrop-filter: blur(8px);
    z-index: 2;
}

.bookmark-toggle {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 3;
}

.bookmark-toggle:hover, .bookmark-toggle.active {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    transform: scale(1.1);
}

.card-info {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-sub);
    margin-bottom: 0.5rem;
}

.card-genres {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Window */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 13, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 950px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: var(--accent-red);
}

.modal-hero {
    position: relative;
    height: 320px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 2rem;
}

.modal-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.3) 0%, #0f172a 100%);
}

.modal-body {
    padding: 0 2rem 2.5rem;
    display: flex;
    gap: 2rem;
    margin-top: -80px;
    position: relative;
    z-index: 2;
}

.modal-poster {
    width: 200px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    border: 2px solid var(--border-color);
}

.modal-poster img {
    width: 100%;
    display: block;
}

.modal-info {
    flex-grow: 1;
}

.modal-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.modal-tagline {
    font-size: 1rem;
    color: var(--accent-primary);
    font-style: italic;
    margin-bottom: 1rem;
}

.modal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-pill {
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-sub);
}

.stat-pill strong {
    color: var(--text-main);
}

.modal-overview {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.7;
    margin-bottom: 1.8rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    color: var(--text-main);
}

.section-title i {
    color: var(--accent-primary);
}

/* Cast Grid */
.cast-slider {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.cast-card {
    width: 100px;
    flex-shrink: 0;
    text-align: center;
}

.cast-img {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-full);
    object-fit: cover;
    margin: 0 auto 0.5rem;
    border: 2px solid var(--border-color);
    background: #1e293b;
}

.cast-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cast-character {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Trailer Video */
.trailer-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect */
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.trailer-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading & Pagination */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
    color: var(--text-sub);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-btn {
    padding: 0.6rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-sub);
    font-size: 0.9rem;
    padding: 0 1rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .hero-title {
        font-size: 2.2rem;
    }
    .modal-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: -100px;
    }
    .modal-poster {
        width: 170px;
    }
    .modal-stats {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.8rem 1rem;
    }
    .nav-container {
        flex-wrap: wrap;
    }
    .nav-categories {
        order: 3;
        width: 100%;
        justify-content: space-around;
        overflow-x: auto;
    }
    .search-box {
        width: 180px;
    }
    .search-input:focus {
        width: 200px;
    }
    .hero-section {
        height: 380px;
    }
    .hero-title {
        font-size: 1.8rem;
    }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .genre-list {
        max-width: 100%;
    }
}
