/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme Colors */
    --primary-color: #ff0000;
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --bg-hover: #f2f2f2;
    --text-primary: #030303;
    --text-secondary: #606060;
    --border-color: #e5e5e5;
    --sidebar-width: 240px;
    --header-height: 56px;
}

body.dark-theme {
    /* Dark Theme Colors */
    --bg-primary: #0f0f0f;
    --bg-secondary: #212121;
    --bg-hover: #3f3f3f;
    --text-primary: #f1f1f1;
    --text-secondary: #aaaaaa;
    --border-color: #3f3f3f;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease;
}

/* Header Styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.logo i {
    color: var(--primary-color);
    font-size: 32px;
}

.logo sup {
    font-size: 10px;
    color: var(--text-secondary);
}

.icon-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--bg-hover);
}

.header-center {
    flex: 1;
    max-width: 640px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 40px;
}

.search-form {
    flex: 1;
    display: flex;
    height: 40px;
}

.search-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-right: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 0 16px;
    font-size: 16px;
    outline: none;
    border-radius: 40px 0 0 40px;
}

.search-input:focus {
    border-color: #1c62b9;
}

.search-btn {
    width: 64px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0 40px 40px 0;
    transition: background-color 0.2s;
}

.search-btn:hover {
    background-color: var(--bg-hover);
}

.voice-btn {
    background-color: var(--bg-secondary) !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notifications-btn {
    position: relative;
}

.notification-count {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: var(--primary-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    margin-left: 8px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Container */
.container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--bg-primary);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    transition: transform 0.3s ease;
    z-index: 999;
    border-right: 1px solid var(--border-color);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.nav-section {
    padding: 8px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-hover);
}

.nav-link.active {
    background-color: var(--bg-hover);
    font-weight: 500;
}

.nav-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.channel-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.nav-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

.nav-heading {
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

/* Category Chips */
.chips-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.chips-wrapper::-webkit-scrollbar {
    height: 6px;
}

.chips-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.chips-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chip {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.chip:hover {
    background-color: var(--bg-hover);
}

.chip.active {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Videos Grid */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px 16px;
}

.video-card {
    cursor: pointer;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: scale(1.02);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.video-info {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.channel-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.channel-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-details {
    flex: 1;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.channel-name {
    display: block;
}

.video-stats {
    display: flex;
    gap: 4px;
}

/* Responsive Design */
@media (max-width: 1312px) {
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-center {
        margin: 0 16px;
    }
    
    .voice-btn {
        display: none;
    }
    
    .create-btn {
        display: none;
    }
    
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px 8px;
    }
    
    .main-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .header-center {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        max-width: 100%;
        margin: 0;
        padding: 8px 16px;
        background-color: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        display: none;
    }
    
    .header-center.active {
        display: flex;
    }
    
    .videos-grid {
        grid-template-columns: 1fr;
    }
    
    .chips-wrapper {
        margin-bottom: 16px;
    }
    
    .logo span {
        display: none;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Smooth Transitions */
* {
    transition-property: background-color, color, border-color;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

button,
a,
.video-card {
    transition-property: background-color, color, transform;
}
