/* Custom styles for YouTube Clone */

/* General Styles */
body {
    background-color: #f8f9fa;
    padding-top: 56px; /* For fixed navbar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: padding-left 0.3s ease;
}

main {
    flex: 1;
    transition: margin-left 0.3s ease;
    position: relative;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1040;
}

/* Sidebar Styles */
.sidebar-container {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Hide scrollbar for all browsers */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.sidebar-container::-webkit-scrollbar {
    display: none;
}

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: calc(100vh - 56px);
}

.sidebar-scrollable {
    overflow-y: auto;
    flex: 1;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-scrollable::-webkit-scrollbar {
    display: none;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-item {
    color: #212529;
    transition: background-color 0.2s ease;
    border-radius: 0 20px 20px 0;
    margin: 0 12px;
}

.sidebar-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #212529;
}

.sidebar-item.active {
    background-color: rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.sidebar-item.active:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

.sidebar-label {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-header h6 {
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.sidebar-divider {
    border-color: rgba(0, 0, 0, 0.1);
    border-width: 1px;
    opacity: 0.5;
}

/* Sticky Footer */
.sidebar-sticky-footer {
    position: sticky;
    bottom: 0;
    background: inherit;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: auto;
    z-index: 2;
}

.sidebar-footer {
    padding-top: 16px !important;
    background: inherit;
}

.sidebar-footer a:hover {
    text-decoration: underline !important;
}

/* Show More button special styling */
.sidebar-item.show-more {
    color: #606060;
}

.sidebar-item.show-more:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #212529;
}

/* Main content adjustment with sidebar */
.main-content-with-sidebar {
    margin-left: 240px;
    padding-left: 24px;
    padding-right: 24px;
    transition: margin-left 0.3s ease, padding-left 0.3s ease;
    min-height: calc(100vh - 56px);
}

/* Categories Bar */
.categories-bar {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    margin-bottom: 1rem;
    padding-top: 8px;
}

.categories-bar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.categories-bar .btn {
    flex-shrink: 0;
}

/* Video Cards */
.video-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: transparent;
    border: none;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.video-card .card-img-top {
    border-radius: 10px;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.video-card .card-title {
    font-size: 0.95rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card .card-text {
    font-size: 0.85rem;
}

/* Thumbnail container */
.thumbnail-container {
    overflow: hidden;
    border-radius: 10px;
    position: relative;
}

.thumbnail-container img {
    transition: transform 0.3s ease;
    width: 100%;
    height: auto;
}

.thumbnail-container:hover img {
    transform: scale(1.05);
}

/* Video duration badge */
.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Related Videos */
.related-video {
    transition: background-color 0.2s ease;
    padding: 8px;
    border-radius: 8px;
}

.related-video:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.related-video h6 {
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Video Description */
.video-description {
    max-height: 200px;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.video-description p {
    margin-bottom: 0.5rem;
}

/* Video Stats */
.video-stats {
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 0;
}

.video-stats .btn-group {
    display: flex;
    gap: 0.5rem;
}

.video-stats .btn {
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.9rem;
}

/* Search Results */
.search-result-card {
    transition: background-color 0.2s ease;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.search-result-card:hover {
    background-color: rgba(0, 0, 0, 0.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.search-result-card img {
    aspect-ratio: 16/9;
    object-fit: cover;
    height: 100%;
}

/* Pagination */
.pagination .page-link {
    border-radius: 20px;
    margin: 0 2px;
    border: none;
}

.pagination .page-item.active .page-link {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* Comments */
.comment-item {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.comment-item:last-child {
    border-bottom: none;
}

/* Mobile sidebar overlay */
.mobile-sidebar-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100vh - 56px);
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1029;
    display: none;
}

.mobile-sidebar-overlay.show {
    display: block;
}

/* Responsive Adjustments */
@media (max-width: 1199.98px) {
    .main-content-with-sidebar {
        margin-left: 0;
        padding-left: 15px;
        padding-right: 15px;
    }

    .sidebar-container {
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    }

    .sidebar-container.show {
        transform: translateX(0);
    }

    .categories-bar .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.75rem;
    }

    .video-card .card-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .related-video {
        flex-direction: column;
    }

    .related-video > div:first-child {
        margin-bottom: 10px;
        width: 100%;
    }

    .related-video img {
        width: 100%;
        height: auto;
    }

    .video-stats {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-stats > div:first-child {
        margin-bottom: 0.5rem;
    }

    .search-result-card .row {
        flex-direction: column;
    }

    .search-result-card .col-md-4 {
        width: 100%;
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand span {
        font-size: 0.9rem;
    }

    .btn-outline-light {
        padding: 0.25rem 0.5rem;
    }

    .video-stats .btn-group {
        width: 100%;
        justify-content: space-between;
    }

    .video-stats .btn {
        flex: 1;
        text-align: center;
        margin: 2px;
    }

    .sidebar-item {
        margin: 0 8px;
        padding: 8px 12px;
    }

    .sidebar-label {
        font-size: 0.85rem;
    }

    .sidebar-footer {
        padding: 12px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #181818;
        color: #ffffff;
    }

    .card,
    .video-description {
        background-color: #212121;
        color: #ffffff;
    }

    .text-dark,
    .card-title a {
        color: #ffffff !important;
    }

    .text-muted {
        color: #aaaaaa !important;
    }

    .btn-outline-dark {
        color: #ffffff;
        border-color: #444;
    }

    .btn-outline-dark:hover {
        background-color: #444;
        color: #ffffff;
    }

    .video-description {
        background-color: #2d2d2d;
    }

    .search-result-card {
        background-color: #212121;
        border-color: #444;
    }

    .search-result-card:hover {
        background-color: #2d2d2d;
    }

    .sidebar-container {
        background-color: #212121;
        color: white;
    }

    .sidebar-item {
        color: #ffffff;
    }

    .sidebar-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .sidebar-item.active {
        background-color: rgba(255, 255, 255, 0.15);
    }

    .sidebar-item.active:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }

    .sidebar-divider {
        border-color: rgba(255, 255, 255, 0.1);
    }

    .sidebar-sticky-footer {
        border-top-color: rgba(255, 255, 255, 0.1);
        background-color: #212121;
    }

    .sidebar-footer {
        background-color: #212121;
    }

    .sidebar-item.show-more {
        color: #aaaaaa;
    }

    .sidebar-item.show-more:hover {
        color: #ffffff;
    }
}
