/* ============================================
   YouTube Clone - Styles CSS
   Palette exacte du mode sombre YouTube
   ============================================ */

/* CSS Variables - Couleurs YouTube Dark Mode */
:root {
    --yt-bg-primary: #0f0f0f;
    --yt-bg-secondary: #272727;
    --yt-bg-hover: #3f3f3f;
    --yt-bg-elevated: #212121;
    --yt-text-primary: #f1f1f1;
    --yt-text-secondary: #aaaaaa;
    --yt-red: #ff0000;
    --yt-red-hover: #cc0000;
    --yt-border: #3f3f3f;
}

/* Reset et base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: var(--yt-bg-primary);
    color: var(--yt-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Zone de contenu principale */
.content-area {
    min-height: 100vh;
    width: 100%;
    padding: 24px;
}

/* ============================================
   Barre de filtres
   ============================================ */

.filters-bar {
    display: flex;
    gap: 12px;
    padding: 12px 0 24px 0;
    max-width: 2400px;
    margin: 0 auto;
}

.filter-btn {
    padding: 10px 16px;
    background-color: var(--yt-bg-secondary);
    color: var(--yt-text-primary);
    border: none;
    border-radius: 8px;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.filter-btn:hover {
    background-color: var(--yt-bg-hover);
}

.filter-btn.active {
    background-color: var(--yt-text-primary);
    color: var(--yt-bg-primary);
}

/* ============================================
   États de chargement / vide / erreur
   ============================================ */

.loading-state,
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80vh;
    padding: 40px;
}

/* Spinner de chargement */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--yt-bg-secondary);
    border-top-color: var(--yt-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1rem;
    color: var(--yt-text-secondary);
}

/* État vide */
.empty-state {
    max-width: 500px;
    margin: 0 auto;
    padding: 60px 40px;
    border-radius: 12px;
    background-color: var(--yt-bg-secondary);
}

.empty-icon,
.error-icon {
    width: 120px;
    height: 120px;
    color: var(--yt-text-secondary);
    margin-bottom: 32px;
    opacity: 0.6;
}

.empty-title,
.error-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--yt-text-primary);
    margin-bottom: 12px;
}

.empty-description,
.error-description {
    font-size: 0.9rem;
    color: var(--yt-text-secondary);
    line-height: 1.5;
}

/* État erreur */
.error-state {
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    color: var(--yt-red);
    opacity: 0.8;
}

.retry-button {
    margin-top: 24px;
    padding: 10px 24px;
    background-color: var(--yt-bg-secondary);
    color: var(--yt-text-primary);
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-button:hover {
    background-color: var(--yt-bg-hover);
}

/* ============================================
   Grille de vidéos (style YouTube)
   ============================================ */

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px 16px;
    max-width: 2400px;
    margin: 0 auto;
}

/* Carte vidéo */
.video-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
}

.video-card:hover .video-thumbnail {
    border-radius: 0;
}

/* Container thumbnail */
.video-thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--yt-bg-secondary);
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: border-radius 0.2s;
}

/* Badge durée */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* Info vidéo */
.video-info {
    display: flex;
    gap: 12px;
    padding: 12px 4px;
}

/* Avatar chaîne */
.channel-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--yt-red), #ff5722);
    display: flex;
    align-items: center;
    justify-content: center;
}

.channel-initial {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.channel-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Métadonnées */
.video-meta {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--yt-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.video-channel {
    font-size: 0.8rem;
    color: var(--yt-text-secondary);
    margin-bottom: 2px;
}

.video-channel:hover {
    color: var(--yt-text-primary);
}

.video-stats {
    font-size: 0.8rem;
    color: var(--yt-text-secondary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1200px) {
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 16px;
    }

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

    .video-info {
        padding: 10px 2px;
    }

    .channel-avatar {
        width: 32px;
        height: 32px;
    }

    .video-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .videos-grid {
        grid-template-columns: 1fr;
    }

    .empty-state {
        padding: 40px 24px;
        margin: 0 8px;
    }

    .empty-icon,
    .error-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 24px;
    }

    .empty-title,
    .error-title {
        font-size: 1.25rem;
    }
}