:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --primary-color: #ff4757;
    --header-bg: #2d2d2d;
    --card-bg: #2d2d2d;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--text-color);
    text-decoration: none;
}

/* Header */
header {
    background-color: var(--header-bg);
    padding: 15px 0;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.search-bar form {
    display: flex;
}

.search-bar input {
    padding: 8px 15px;
    border: none;
    border-radius: 4px 0 0 4px;
    background: #444;
    color: #fff;
    width: 300px;
}

.search-bar button {
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: bold;
}

.search-bar button:hover {
    background-color: #ff6b81;
}

/* Search Suggestions */
.search-container {
    position: relative;
    display: flex;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #444;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    border-bottom: 1px solid #555;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: var(--primary-color);
}

/* Main Navigation (Categories) */
.main-nav {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid #444;
}

.main-nav a {
    color: #bbb;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 15px;
    transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    background-color: var(--primary-color);
    color: white;
}

/* Sorting and Filter Controls */
.sorting-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.sort-options,
.filter-options {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sort-btn,
.filter-btn {
    padding: 5px 12px;
    background-color: #333;
    color: #ccc;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
}

.sort-btn:hover,
.sort-btn.active,
.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.filter-label {
    font-size: 13px;
    color: #888;
    margin-right: 5px;
}

.filter-divider {
    color: #444;
    margin: 0 5px;
}


.filter-divider {
    color: #444;
    margin: 0 5px;
}

/* Load More Button */
.load-more-btn {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.load-more-btn:hover {
    background-color: var(--primary-color);
}

/* Grid Layout */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.video-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background-color: #000;
}

.video-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 5px;
    font-size: 12px;
    border-radius: 2px;
}

.video-info {
    padding: 15px;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    font-size: 13px;
    color: #aaa;
    display: flex;
    justify-content: space-between;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
}

.pagination a {
    padding: 8px 16px;
    background-color: var(--card-bg);
    border-radius: 4px;
}

.pagination a.active {
    background-color: var(--primary-color);
}

/* Footer */
footer {
    background-color: var(--header-bg);
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
    /* Push to bottom if content is short */
    color: #aaa;
}

/* Watch Page */
.video-player-container {
    background: #000;
    margin-bottom: 20px;
}

.video-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
}

.video-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-details h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.tags {
    margin-top: 15px;
}

.tag {
    display: inline-block;
    background: #444;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

/* Mobile Responsiveness */
.mobile-filter-toggle {
    display: none;
    /* Hidden on desktop */
    margin-bottom: 15px;
}

#toggle-filters-btn {
    width: 100%;
    padding: 10px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    text-align: left;
}

#toggle-filters-btn::after {
    content: ' \25BE';
    /* Down arrow */
    float: right;
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 Columns on mobile */
        gap: 10px;
    }

    .video-thumb {
        padding-top: 56.25%;
    }

    .video-title {
        font-size: 13px;
        /* Smaller font */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
    }

    .video-details h1 {
        font-size: 18px;
    }

    /* Filters as Dropdown */
    .mobile-filter-toggle {
        display: block;
    }

    .sorting-controls {
        display: none;
        /* Hidden by default on mobile */
        flex-direction: column;
        align-items: stretch;
        background: #222;
        padding: 15px;
        border-radius: 8px;
        margin-top: -10px;
    }

    .sorting-controls.show-mobile {
        display: flex;
    }

    .sorting-controls h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .sort-options,
    .filter-options {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .main-nav {
        padding-bottom: 5px;
    }

    /* Mobile Header */
    header .container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .logo {
        text-align: center;
        margin-bottom: 5px;
    }

    .search-bar form {
        width: 100%;
        display: flex;
    }

    .search-container {
        flex-grow: 1;
    }

    .search-bar input {
        width: 100%;
        /* Full width */
        min-width: 0;
        /* Prevent overflow */
    }
}