:root {
    --bg-color: #0f0f0f;
    --text-color: #f1f1f1;
    --text-muted: #aaaaaa;
    --accent-color: #facc15;
    --card-bg: #0f0f0f;
    --hover-bg: #272727;
    --sidebar-width: 240px;
    --header-height: 56px;
    --border-color: #3f3f3f;
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: var(--hover-bg);
}

.logo {
    font-size: 22px;
    font-weight: bold;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 720px;
    margin: 0 40px;
}

.search-container {
    display: flex;
    width: 100%;
    position: relative;
    max-width: 600px;
}

#search-input {
    flex: 1;
    padding: 2px 16px;
    height: 40px;
    border: 1px solid #303030;
    border-right: none;
    border-radius: 20px 0 0 20px;
    background-color: #121212;
    color: var(--text-color);
    font-size: 16px;
}

#search-input:focus {
    outline: none;
    border-color: #1c62b9;
    margin-left: 0;
}

#search-btn {
    width: 64px;
    height: 40px;
    background-color: #222222;
    border: 1px solid #303030;
    border-radius: 0 20px 20px 0;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-btn:hover {
    background-color: #303030;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    width: calc(100% - 64px);
    background-color: #212121;
    border: 1px solid #303030;
    border-radius: 12px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 200;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
}

.suggestion-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
}

.suggestion-item:hover {
    background-color: #3d3d3d;
}

.hidden {
    display: none !important;
}

/* Layout */
.main-container {
    display: flex;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.sidebar {
    width: 0;
    background-color: var(--bg-color);
    overflow-x: hidden;
    overflow-y: hidden;
    transition: width 0.2s ease;
    flex-shrink: 0;
}

.sidebar.open {
    width: var(--sidebar-width);
    overflow-y: auto;
}

.sidebar nav {
    padding: 12px 12px;
    width: var(--sidebar-width);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 40px;
    border-radius: 10px;
    gap: 24px;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background-color: var(--hover-bg);
}

.nav-item.active {
    background-color: #272727;
    font-weight: bold;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 12px 0;
}

.nav-title {
    padding: 8px 12px;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
}

.content {
    flex: 1;
    padding: 0 24px 24px;
    overflow-y: auto;
    background-color: var(--bg-color);
}

.category-chips {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 24px;
    overflow-x: auto;
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.category-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 6px 12px;
    background-color: #272727;
    color: var(--text-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
    text-decoration: none;
}

.chip:hover {
    background-color: #3f3f3f;
}

.chip.active {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Video Grid */
.video-section {
    margin-bottom: 40px;
}

.video-section h2 {
    margin-bottom: 20px;
    font-size: 20px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px 16px;
}

.video-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
}

.video-preview {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background-color: #222;
    border-radius: 12px;
    overflow: hidden;
    transition: border-radius 0.2s;
}

.video-card:hover .video-preview {
    border-radius: 0;
}

.video-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    pointer-events: none;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10;
    cursor: pointer;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 20;
    pointer-events: none;
    line-height: 1;
}

.video-details {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.video-info {
    display: flex;
    flex-direction: column;
}

.video-info h3 {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 4px;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-actors {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.channel-name {
    transition: color 0.2s;
}

.channel-name:hover {
    color: var(--text-color);
}

/* Watch Page */
.watch-layout {
    display: flex;
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
}

.primary-column {
    flex: 1;
    min-width: 0;
}

.secondary-column {
    width: 400px;
    flex-shrink: 0;
}

.player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-info h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.video-description-box {
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    margin-top: 16px;
}

.video-description-box p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.related-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.related-grid .video-card {
    flex-direction: row;
}

.related-grid .video-preview {
    width: 160px;
    padding-top: 90px;
    flex-shrink: 0;
    border-radius: 8px;
}

/* Admin Page */
.admin-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height));
    padding: 20px;
    margin-top: var(--header-height);
}

.admin-box {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
}

.admin-box h2 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    background-color: #121212;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

button {
    background-color: var(--accent-color);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    opacity: 0.9;
}

#json-output {
    width: 100%;
    height: 200px;
    margin-top: 20px;
    background-color: #121212;
    color: #00ff00;
    border: 1px solid var(--border-color);
    padding: 10px;
    font-family: monospace;
}

.error {
    color: #ff4444;
    margin-top: 10px;
}

@media (max-width: 1000px) {
    .watch-layout {
        flex-direction: column;
    }
    .secondary-column {
        width: 100%;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--header-height));
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 800;
}

.sidebar-overlay.active {
    display: block;
}

@media (min-width: 769px) {
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        width: var(--sidebar-width);
        height: calc(100vh - var(--header-height));
        z-index: 900;
        transition: left 0.2s ease;
    }
    .sidebar.open {
        left: 0;
    }
}
