/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f9f9f9;
    color: #030303;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 0;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo h1 {
    color: #ff0000;
    font-size: 24px;
    font-weight: 500;
}

.logo span {
    color: #606060;
    font-size: 12px;
    display: block;
    margin-top: -5px;
}

.search-container {
    display: flex;
    flex: 1;
    max-width: 600px;
    margin: 0 40px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #cccccc;
    border-radius: 2px 0 0 2px;
    font-size: 16px;
    outline: none;
}

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

.search-btn {
    padding: 10px 20px;
    background-color: #f8f8f8;
    border: 1px solid #cccccc;
    border-left: none;
    border-radius: 0 2px 2px 0;
    cursor: pointer;
    font-size: 16px;
}

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

.preferences-btn {
    background-color: #065fd4;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.preferences-btn:hover {
    background-color: #4c8bf5;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 30px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.preference-section {
    margin: 20px 0;
}

.preference-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.preference-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 16px;
}

.save-btn {
    background-color: #065fd4;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-top: 20px;
}

.save-btn:hover {
    background-color: #4c8bf5;
}

/* Main Content Sections */
.main-content {
    padding: 32px 0;
}

section {
    margin-bottom: 48px;
}

section h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 16px;
    color: #030303;
}

/* Featured Videos Grid */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.featured-video {
    position: relative;
    cursor: pointer;
}

.featured-video.large {
    grid-column: span 2;
}

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

.video-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    background-color: #000;
    overflow: hidden;
}

.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: 2px 4px;
    border-radius: 2px;
    font-size: 12px;
}

.video-info {
    padding: 12px;
}

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

.video-channel {
    color: #606060;
    font-size: 13px;
    margin-bottom: 2px;
}

.video-meta {
    color: #606060;
    font-size: 13px;
}

/* Video Player Modal */
.video-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.video-modal-content {
    background-color: #fff;
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    border-radius: 8px;
    overflow: hidden;
}

.video-close {
    color: #fff;
    position: absolute;
    top: 15px;
    right: 35px;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.video-close:hover {
    opacity: 0.7;
}

.video-player-container {
    display: flex;
    flex-direction: column;
}

#videoPlayer {
    width: 100%;
    height: 60vh;
    background-color: #000;
}

.video-info {
    padding: 20px;
    background-color: #fff;
}

.video-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.video-info p {
    color: #606060;
    line-height: 1.5;
}

.suggested-videos {
    padding: 20px;
    background-color: #f9f9f9;
}

.suggested-videos h4 {
    margin-bottom: 16px;
    font-size: 16px;
}

.suggested-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.suggested-video {
    display: flex;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.suggested-video:hover {
    background-color: #e5e5e5;
}

.suggested-thumbnail {
    width: 120px;
    height: 68px;
    background-color: #000;
    border-radius: 4px;
    margin-right: 8px;
    overflow: hidden;
}

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

.suggested-info {
    flex: 1;
}

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

.suggested-channel {
    font-size: 11px;
    color: #606060;
}

/* Banner Ad */
.banner-ad {
    min-height: 90px;
    background-color: #f0f0f0;
    margin: 20px 0;
    border-radius: 4px;
    display: none; /* Hidden until ads are implemented */
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-container {
        margin: 0;
        width: 100%;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .featured-video.large {
        grid-column: span 1;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .video-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .suggested-grid {
        grid-template-columns: 1fr;
    }
    
    .suggested-video {
        flex-direction: column;
        text-align: center;
    }
    
    .suggested-thumbnail {
        width: 100%;
        height: 120px;
        margin-right: 0;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #606060;
}

.loading::after {
    content: "Loading...";
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}