:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-light: #1e1e1e;
    --text: #ffffff;
    --text-muted: #888888;
    --accent: #ffffff;
    --imdb: #f5c518;
    --kp: #ff6600;
    --rt: #fa320a;
    --border: #2a2a2a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Header */
header {
    background: var(--surface);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}
.logo img { height: 40px; }
nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
nav a:hover { color: var(--text); }

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

/* Categories */
.category-section {
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
}
.category-header {
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: var(--surface-light);
    transition: background 0.2s;
    user-select: none;
}
.category-header:hover { background: #252525; }
.category-header h2 { font-size: 1.3rem; font-weight: 600; }
.toggle-icon { transition: transform 0.3s; font-size: 0.9rem; color: var(--text-muted); }
.category-section.collapsed .toggle-icon { transform: rotate(-90deg); }
.category-content {
    padding: 1.5rem;
    transition: max-height 0.3s ease, padding 0.3s;
    max-height: 2000px;
    overflow: hidden;
}
.category-section.collapsed .category-content {
    max-height: 0;
    padding: 0 1.5rem;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}
.card {
    background: var(--surface-light);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: #1a1a1a;
}
.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.card:hover .poster img { transform: scale(1.05); }
.rating-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}
.rating-badge.imdb { color: var(--imdb); }

.info { padding: 1rem; }
.info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.ratings { display: flex; gap: 8px; }
.kp { color: var(--kp); }
.rt { color: var(--rt); }

/* Watch Page */
.watch-page { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.back-btn {
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
}
.logo-small { font-weight: 700; letter-spacing: 2px; }
.player-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
    aspect-ratio: 16/9;
    position: relative;
}
#player { width: 100%; height: 100%; }
.content-info h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.content-info .original {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
}
.ratings-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.rating-item { text-align: center; }
.rating-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.rating-item .value { font-size: 1.5rem; font-weight: 700; }
.rating-item.imdb .value { color: var(--imdb); }
.rating-item.kp .value { color: var(--kp); }
.rating-item.rt .value { color: var(--rt); }

.meta { color: var(--text-muted); margin-bottom: 1rem; }
.meta span { margin-right: 1rem; }
.description { color: #ccc; line-height: 1.7; margin-bottom: 1.5rem; }
.source-link {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--surface-light);
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: background 0.2s;
}
.source-link:hover { background: #2a2a2a; }

/* Admin */
.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-box {
    background: var(--surface);
    padding: 3rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
}
.login-box h1 { margin-bottom: 1.5rem; text-align: center; }
.login-box input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
}
.login-box button {
    width: 100%;
    padding: 1rem;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.error {
    background: rgba(255,0,0,0.1);
    color: #ff4444;
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.admin-body { background: var(--bg); }
.admin-header {
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    align-items: center;
}
.admin-main { max-width: 1400px; margin: 0 auto; padding: 2rem; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.admin-table th, .admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    background: var(--surface-light);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.admin-table img { border-radius: 4px; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn:hover { background: #2a2a2a; }
.btn-primary { background: var(--text); color: var(--bg); border: none; }
.btn-danger { background: rgba(255,0,0,0.1); color: #ff4444; border-color: rgba(255,0,0,0.2); }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.edit-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    max-width: 800px;
}
.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.active {
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
    margin: 0 0 20px 0;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: #444; }
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.empty { color: var(--text-muted); padding: 2rem; text-align: center; }

@media (max-width: 768px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
    .container { padding: 1rem; }
    .ratings-bar { gap: 1rem; flex-wrap: wrap; }
    .form-row { grid-template-columns: 1fr; }
}
.meta-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-muted);
}
.meta-details .badge {
    background: var(--surface-light);
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
}
.meta-details .genre {
    color: var(--kp);
}
.crew, .actors {
    margin-bottom: 1rem;
    color: #ccc;
    line-height: 1.7;
}
.crew strong, .actors strong {
    color: var(--text);
}