:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #e1e5eb;
    --accent-blue: #4a6fa5;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 18px;
    white-space: nowrap;
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 500px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--bg-secondary);
    border-radius: 20px 0 0 20px;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    min-width: 120px;
}

.search-button {
    width: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-secondary);
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-container {
    padding: 20px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.video-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.thumbnail-container {
    position: relative;
    width: 100%;
    background-color: var(--bg-secondary);
}

.thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

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

.video-info {
    padding: 12px;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
}

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

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

.loading {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.player-container {
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16/9;
    background: black;
}

.player-close {
    margin-top: 20px;
    padding: 8px 16px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.speed-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 15px;
    }
    
    .search-bar {
        width: 100%;
        max-width: none;
    }
    
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
}