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

:root {
    --primary-color: #ff0000;
    --bg-dark: #0f0f0f;
    --bg-secondary: #212121;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #303030;
    --hover-bg: #3d3d3d;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 2560px;
    margin: 0 auto;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn, .icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: bold;
}

.logo i {
    color: var(--primary-color);
    font-size: 28px;
}

/* Search */
.nav-center {
    flex: 1;
    max-width: 728px;
    margin: 0 40px;
}

.search-form {
    display: flex;
    align-items: center;
}

.search-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-right: none;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    border-radius: 40px 0 0 40px;
}

.search-input:focus {
    border-color: #1c62b9;
}

.search-btn {
    height: 40px;
    width: 64px;
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 0 40px 40px 0;
    transition: background-color 0.2s;
}

.search-btn:hover {
    background-color: #3d3d3d;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    width: 240px;
    height: calc(100vh - 56px);
    background-color: var(--bg-secondary);
    overflow-y: auto;
    padding: 12px 0;
    z-index: 900;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s;
}

.sidebar-link:hover {
    background-color: var(--hover-bg);
}

.sidebar-link.active {
    background-color: var(--hover-bg);
    font-weight: 500;
}

.sidebar-link i {
    font-size: 20px;
    width: 24px;
}

.sidebar-divider {
    margin: 12px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    margin-left: 240px;
    margin-top: 56px;
    padding: 24px;
    min-height: calc(100vh - 56px);
}

/* Home Container */
.home-container {
    max-width: 2560px;
    margin: 0 auto;
}

.search-results-header {
    margin-bottom: 24px;
}

.search-results-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.search-results-header p {
    color: var(--text-secondary);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.video-card {
    cursor: pointer;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-4px);
}

.thumbnail-link {
    text-decoration: none;
}

.thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--bg-secondary);
}

.thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.video-card:hover .thumbnail {
    transform: scale(1.05);
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-info {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.video-details {
    flex: 1;
    min-width: 0;
}

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

.video-title:hover {
    color: var(--text-primary);
}

.channel-name {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 2px;
}

.video-stats {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    gap: 4px;
}

.dot {
    margin: 0 4px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding: 20px 0;
}

.page-link {
    padding: 8px 16px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.page-link:hover {
    background-color: var(--hover-bg);
}

.page-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Watch Page */
.watch-container {
    display: grid;
    grid-template-columns: 1fr 402px;
    gap: 24px;
    max-width: 2560px;
    margin: 0 auto;
}

.watch-main {
    min-width: 0;
}

.video-player {
    background-color: black;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.video-player video {
    width: 100%;
    height: auto;
    display: block;
}

.video-primary-info {
    margin-bottom: 16px;
}

.video-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
}

.video-metadata {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.channel-name-large {
    font-weight: 500;
    font-size: 16px;
}

.subscriber-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.subscribe-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 24px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 16px;
    transition: background-color 0.2s;
}

.subscribe-btn:hover {
    background-color: #cc0000;
}

.video-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    padding: 10px 16px;
    border-radius: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

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

.action-btn i {
    font-size: 18px;
}

.video-secondary-info {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.description-header {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.description-text {
    line-height: 1.6;
}

/* Comments */
.comments-section {
    margin-top: 24px;
}

.comments-header h3 {
    font-size: 20px;
    margin-bottom: 24px;
}

.add-comment {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.comment-form {
    flex: 1;
}

.comment-input-name {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 0;
    margin-bottom: 12px;
    font-size: 14px;
    outline: none;
}

.comment-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 0;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.comment-input:focus, .comment-input-name:focus {
    border-bottom-color: var(--text-primary);
}

.comment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.btn-cancel, .btn-submit {
    padding: 10px 16px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel {
    background: transparent;
    color: var(--text-secondary);
}

.btn-submit {
    background-color: #3ea6ff;
    color: white;
}

.btn-submit:hover {
    background-color: #2a8fdf;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.comment {
    display: flex;
    gap: 16px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 500;
    font-size: 14px;
}

.comment-time {
    color: var(--text-secondary);
    font-size: 12px;
}

.comment-text {
    line-height: 1.6;
    font-size: 14px;
}

/* Related Videos */
.watch-sidebar {
    position: sticky;
    top: 72px;
    height: fit-content;
}

.sidebar-title {
    font-size: 18px;
    margin-bottom: 16px;
}

.related-videos {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-video-item {
    display: flex;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.related-video-item:hover {
    background-color: var(--bg-secondary);
}

.related-thumbnail {
    position: relative;
    width: 168px;
    height: 94px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.related-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 12px;
}

.related-info {
    flex: 1;
    min-width: 0;
}

.related-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.related-channel {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 2px;
}

.related-stats {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px;
    margin-top: 48px;
}

.footer-content {
    max-width: 2560px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* No Results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.no-results h2 {
    margin: 20px 0 10px;
    font-size: 24px;
}

.no-results p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.btn-primary {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    text-decoration: none;
    font-weight: 500;
}

/* Responsive Styles */

/* Tablet & Small Desktop (1024px and below) */
@media (max-width: 1024px) {
    .watch-container {
        grid-template-columns: 1fr;
    }
    
    .watch-sidebar {
        position: static;
    }
    
    .related-videos {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 16px;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
    
    .main-content {
        padding: 16px;
    }
}

/* Mobile & Tablet (768px and below) */
@media (max-width: 768px) {
    /* Sidebar */
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        width: 240px;
        z-index: 2000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay when sidebar is open */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 240px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    .main-content {
        margin-left: 0;
        padding: 12px;
    }
    
    /* Navbar adjustments */
    .nav-center {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background-color: var(--bg-secondary);
        padding: 8px;
        z-index: 1500;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-center.active {
        display: block;
    }
    
    .search-toggle {
        display: flex !important;
    }
    
    .nav-container {
        padding: 0 8px;
    }
    
    .logo span {
        display: none;
    }
    
    .nav-right {
        gap: 8px;
    }
    
    /* Video Grid */
    .video-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .video-card {
        width: 100%;
    }
    
    /* Video Info */
    .video-info {
        gap: 8px;
    }
    
    .channel-avatar {
        width: 32px;
        height: 32px;
    }
    
    .video-title {
        font-size: 14px;
    }
    
    .channel-name, .video-stats {
        font-size: 12px;
    }
    
    /* Watch Page Mobile */
    .video-player {
        border-radius: 0;
        margin-bottom: 12px;
    }
    
    .video-title {
        font-size: 16px;
    }
    
    .video-metadata {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .channel-info {
        width: 100%;
    }
    
    .video-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .action-btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    /* Comments Mobile */
    .add-comment {
        gap: 8px;
    }
    
    .user-avatar, .comment-avatar {
        width: 32px;
        height: 32px;
    }
    
    .comment-input {
        font-size: 14px;
        min-height: 50px;
    }
    
    .comment-actions {
        flex-direction: row;
    }
    
    .btn-cancel, .btn-submit {
        flex: 1;
        text-align: center;
    }
    
    /* Related Videos Mobile */
    .related-video-item {
        padding: 8px 0;
    }
    
    .related-thumbnail {
        width: 140px;
        height: 79px;
    }
    
    .related-title {
        font-size: 13px;
    }
    
    .related-channel, .related-stats {
        font-size: 11px;
    }
    
    /* Pagination Mobile */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
        padding: 16px 0;
    }
    
    .page-link {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    /* Footer Mobile */
    .footer-content {
        padding: 16px;
    }
    
    .footer-links {
        flex-wrap: wrap;
        gap: 12px;
        font-size: 12px;
    }
}

/* Extra Small Mobile (480px and below) */
@media (max-width: 480px) {
    .navbar {
        height: 48px;
    }
    
    .sidebar {
        top: 48px;
        height: calc(100vh - 48px);
        width: 200px;
    }
    
    .main-content {
        margin-top: 48px;
        padding: 8px;
    }
    
    .logo i {
        font-size: 24px;
    }
    
    .menu-btn, .icon-btn {
        padding: 6px;
        font-size: 18px;
    }
    
    /* Video Grid Extra Small */
    .video-grid {
        gap: 12px;
    }
    
    .thumbnail-container {
        border-radius: 8px;
    }
    
    .video-duration {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    /* Watch Page Extra Small */
    .video-primary-info {
        margin-bottom: 12px;
    }
    
    .channel-info {
        flex-wrap: wrap;
    }
    
    .channel-avatar-large {
        width: 40px;
        height: 40px;
    }
    
    .channel-name-large {
        font-size: 14px;
    }
    
    .subscriber-count {
        font-size: 12px;
    }
    
    .subscribe-btn {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .video-actions {
        gap: 4px;
    }
    
    .action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .action-btn span {
        display: none;
    }
    
    .action-btn i {
        font-size: 16px;
        margin: 0;
    }
    
    /* Comments Extra Small */
    .comments-header h3 {
        font-size: 16px;
    }
    
    .comment {
        gap: 8px;
    }
    
    .comment-author {
        font-size: 13px;
    }
    
    .comment-text {
        font-size: 13px;
    }
    
    /* Related Videos Extra Small */
    .sidebar-title {
        font-size: 16px;
    }
    
    .related-video-item {
        flex-direction: column;
    }
    
    .related-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
    
    .related-info {
        padding: 8px 0;
    }
    
    /* Search Results */
    .search-results-header h2 {
        font-size: 18px;
    }
    
    .search-results-header p {
        font-size: 13px;
    }
    
    /* No Results */
    .no-results {
        padding: 40px 16px;
    }
    
    .no-results i {
        font-size: 48px !important;
    }
    
    .no-results h2 {
        font-size: 18px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .video-player {
        position: relative;
        width: 100%;
        height: 100vh;
        max-height: calc(100vh - 48px);
    }
    
    .video-player video {
        height: 100%;
        object-fit: contain;
    }
}

/* Touch Device Improvements */
@media (hover: none) and (pointer: coarse) {
    .icon-btn, .menu-btn, .action-btn, .page-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    .sidebar-link {
        padding: 14px 24px;
    }
    
    .video-card {
        touch-action: manipulation;
    }
}