﻿/* YouTube Clone Styles */

:root {
    --yt-red: #ff0000;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --header-height: 56px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: #ffffff;
    overflow-x: hidden;
}

/* Header Styles */
.navbar {
    height: var(--header-height);
    z-index: 1030;
}

.youtube-logo {
    font-size: 1.5rem;
}

.search-input {
    border-right: none;
    box-shadow: none;
    border-color: #d0d7de;
}

    .search-input:focus {
        border-color: #0969da;
        box-shadow: none;
    }

.search-btn {
    border: 1px solid #d0d7de;
    border-left: none;
    background-color: #f8f9fa;
    color: #656c76;
}

    .search-btn:hover {
        background-color: #f1f3f4;
    }

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 40px;
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    margin-top: 1px;
}

    .search-suggestions.show {
        display: block;
    }

.suggestion-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #0f0f0f;
    font-size: 14px;
}

    .suggestion-item:hover {
        background-color: #f8f9fa;
    }

    .suggestion-item i {
        color: #606060;
        font-size: 12px;
    }

/* Main Container */
.main-container {
    /*display: flex;*/
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid #e5e5e5;
    position: fixed;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1020;
}

    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

.sidebar-content {
    padding: 12px 0;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: #0f0f0f;
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

    .sidebar-item:hover {
        background-color: #f8f9fa;
        color: #0f0f0f;
        text-decoration: none;
    }

    .sidebar-item.active {
        background-color: #f8f9fa;
        font-weight: 500;
    }

    .sidebar-item i {
        width: 24px;
        margin-right: 24px;
        font-size: 16px;
        text-align: center;
    }

.sidebar-header {
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #0f0f0f;
}

.sidebar-divider {
    margin: 12px 0;
    border-color: #e5e5e5;
}

@media (min-width: 767.98px) {
    .sidebar.collapsed .sidebar-item span,
    .sidebar.collapsed .sidebar-header {
        display: none;
    }
}

/*.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 16px 12px;
}*/

    .sidebar.collapsed .sidebar-item i {
        margin-right: 0;
    }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - var(--header-height));
}

    .main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed-width);
    }

/* Category Filter */
.category-filter {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 12px 24px;
    z-index: 10;
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

.category-tab {
    border: 1px solid #d0d7de;
    background-color: #f8f9fa;
    color: #0f0f0f;
    border-radius: 32px;
    padding: 6px 12px;
    white-space: nowrap;
    font-size: 14px;
    transition: all 0.2s ease;
}

    .category-tab:hover {
        background-color: #e5e5e5;
        border-color: #e5e5e5;
    }

    .category-tab.active {
        background-color: #0f0f0f;
        color: #ffffff;
        border-color: #0f0f0f;
    }

.category-nav {
    border: none;
    background: none;
    color: #606060;
    padding: 8px;
    border-radius: 50%;
}

    .category-nav:hover {
        background-color: #f8f9fa;
    }

/* Search Results Header */
.search-results-header {
    padding: 20px 24px;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 24px;
}

.video-card {
    cursor: pointer;
    transition: transform 0.2s ease;
}

    .video-card:hover {
        transform: translateY(-2px);
    }

.video-thumbnail {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    background-color: #f8f9fa;
    margin-bottom: 12px;
}

    .video-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.2s ease;
    }

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-info {
    display: flex;
    gap: 12px;
}

.video-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.video-details {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: #0f0f0f;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card:hover .video-title {
    color: #065fd4;
}

.video-channel {
    font-size: 13px;
    color: #606060;
    margin-bottom: 2px;
}

.video-meta {
    font-size: 13px;
    color: #606060;
}

.verified-badge {
    color: #606060;
    font-size: 12px;
    margin-left: 4px;
}

.video-menu {
    opacity: 0;
    transition: opacity 0.2s ease;
    background: none;
    border: none;
    color: #606060;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-card:hover .video-menu {
    opacity: 1;
}

.video-menu:hover {
    background-color: #f8f9fa;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 24px;
}

/* Video Player Modal */
.modal-fullscreen .modal-content {
    /*background-color: #0f0f0f;*/
    color: white;
}

.modal-fullscreen .modal-header {
    background-color: transparent;
}

.modal-fullscreen .btn-close {
    filter: invert(1);
}

.video-player {
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
}

.video-info {
    background-color: white;
    color: #0f0f0f;
    padding-left: 5px;
    border-radius: 12px;
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    /*margin-bottom: 16px;*/
}

.video-description {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
}

.comments-section {
    background-color: white;
    color: #0f0f0f;
}

.add-comment textarea {
    resize: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

    .add-comment textarea:focus {
        box-shadow: none;
        border-bottom-color: #065fd4;
    }

.comment-item {
    padding: 16px 0;
    border-bottom: 1px solid #f1f1f1;
}

.comment-author {
    font-size: 13px;
    font-weight: 500;
    color: #0f0f0f;
}

.comment-time {
    font-size: 12px;
    color: #606060;
    margin-left: 8px;
}

.comment-text {
    font-size: 14px;
    color: #0f0f0f;
    margin: 4px 0 8px 0;
    line-height: 1.4;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.comment-action {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #606060;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 18px;
    transition: background-color 0.2s ease;
}

    .comment-action:hover {
        background-color: #f8f9fa;
    }

    .comment-action.liked {
        color: #065fd4;
    }

/* Suggested Videos */
.suggested-videos {
    background-color: white;
    color: #0f0f0f;
    padding: 20px;
    border-radius: 12px;
    height: fit-content;
}

.suggested-video {
    display: flex;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    margin-bottom: 8px;
}

    .suggested-video:hover {
        background-color: #f8f9fa;
    }

.suggested-video-thumbnail {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

    .suggested-video-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.suggested-video-info {
    flex: 1;
    min-width: 0;
}

.suggested-video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: #0f0f0f;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.suggested-video:hover .suggested-video-title {
    color: #065fd4;
}

.suggested-video-channel {
    font-size: 12px;
    color: #606060;
    margin-bottom: 2px;
}

.suggested-video-meta {
    font-size: 12px;
    color: #606060;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
        padding: 16px 20px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
        --sidebar-collapsed-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.show {
            transform: translateX(0);
            width: 250px;
            z-index: 1040;
        }

    .main-content {
        margin-left: 0;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 16px;
    }

    .category-filter {
        padding: 12px 16px;
    }

    .search-results-header {
        padding: 16px;
    }

    .suggested-video {
        flex-direction: column;
    }

    .suggested-video-thumbnail {
        width: 100%;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .navbar .container-fluid {
        padding: 0 12px;
    }

    .navbar .flex-grow-1 {
        margin: 0 12px;
    }

    .video-info {
        /*flex-direction: column;*/
        gap: 12px;
    }

    .video-meta-actions {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Hover Effects */
.btn:hover {
    transform: translateY(-1px);
}

.video-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 12px;
}

/* Focus States */
.btn:focus,
.sidebar-item:focus {
    outline: 2px solid #065fd4;
    outline-offset: 2px;
}

/* Dark Theme Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Dark theme styles can be added here */
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 3px;
}

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: #999999;
    }

.plyr {
    height: 100%;
}

.suggestion-item:hover {
    background-color: #f2f2f2;
}

.suggestion-item:first-child:hover {
    border-radius: 0 0 12px 12px;
}

@media (max-width: 767.98px) {
    #searchContainer {
        display: none; /* hidden until user clicks search */
    }

    #backArrow {
        display: none; /* shown dynamically with JS */
    }
}

#suggestionBox {
    position: absolute;
    top: 100%;
    left: 0;
    right: 40px;
    background: white;
    border-radius: 12px;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    /* 👇 New additions */
    max-height: 300px; /* limits height */
    overflow-y: auto; /* makes it scrollable */
    scrollbar-width: thin; /* modern browsers */
    scrollbar-color: #ccc transparent;
}

    /* 👇 Optional: nice-looking scrollbar for Chrome/Edge */
    #suggestionBox::-webkit-scrollbar {
        width: 6px;
    }

    #suggestionBox::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 10px;
    }

        #suggestionBox::-webkit-scrollbar-thumb:hover {
            background-color: #999;
        }


.login-popup {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border-radius: 16px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#loginPopup {
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.15s ease;
}

    #loginPopup.show {
        opacity: 1;
        transform: translateY(0);
    }