* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

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

header {
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    padding: 20px 0;
    margin-bottom: 40px;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav a {
    color: #666;
    text-decoration: none;
}

.nav a:hover {
    color: #d4af37;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

h1, h2 {
    margin-bottom: 20px;
    color: #222;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="file"] {
    padding: 8px;
}

button, .btn {
    background: #d4af37;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover {
    background: #c19b2f;
}

.btn-secondary {
    background: #666;
}

.btn-secondary:hover {
    background: #555;
}

.btn-danger {
    background: #dc3545;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c82333;
}

.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.media-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.media-info {
    padding: 15px;
}

.media-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.media-view {
    text-align: center;
    padding: 40px 0;
}

.media-view img,
.media-view video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.share-url {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    font-family: monospace;
    word-break: break-all;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #666;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

footer {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* Upload progress bar */
.upload-progress {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #d4af37, #f0d060);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-weight: 500;
    color: #666;
}

/* Media size display */
.media-size {
    color: #888;
    font-size: 12px;
}

/* Video thumbnails */
.video-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

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

.video-placeholder {
    background: #1a1a2e;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
}

.play-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
}

/* Popular clips page */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.popular-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popular-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.popular-info {
    padding: 15px;
}

.popular-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px 0;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

/* Toggle visibility buttons */
.btn-toggle {
    font-size: 12px;
    padding: 6px 12px;
}

.btn-public {
    background: #28a745;
}

.btn-public:hover {
    background: #218838;
}

.btn-private {
    background: #6c757d;
}

.btn-private:hover {
    background: #5a6268;
}

/* Processing animation */
.processing-animation {
    text-align: center;
    padding: 30px 0;
}

.processing-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #d4af37;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.processing-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.processing-subtext {
    font-size: 14px;
    color: #888;
}

/* ======================================================
   POPULAR PAGE REDESIGN - Dark + Gold theme
   ====================================================== */

.page-popular {
    --pop-bg: #0f0f14;
    --pop-surface: #1a1a24;
    --pop-surface-hover: #24243a;
    --pop-gold: #d4af37;
    --pop-gold-light: #f0d060;
    --pop-gold-dim: rgba(212, 175, 55, 0.15);
    --pop-text: #e8e8f0;
    --pop-text-muted: #8888a0;
    background: var(--pop-bg);
}

/* Header : accent doré sur la page populaire */
.page-popular header {
    border-bottom-color: var(--pop-gold);
    box-shadow: 0 2px 20px rgba(212, 175, 55, 0.1);
}

/* Footer adapté au dark */
.page-popular footer {
    color: var(--pop-text-muted);
}

/* Container élargi pour la page populaire */
.popular-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* ---- Hero section ---- */
.popular-hero {
    position: relative;
    padding: 60px 20px 50px;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.12) 0%, transparent 70%),
        var(--pop-bg);
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    margin-bottom: 40px;
    overflow: hidden;
}

.popular-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.popular-hero-content {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.popular-hero-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--pop-gold), var(--pop-gold-light));
    color: #0f0f14;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.popular-hero-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: var(--pop-text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.popular-hero-subtitle {
    font-size: 1.1rem;
    color: var(--pop-text-muted);
    margin-bottom: 30px;
    line-height: 1.5;
}

.popular-hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.popular-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.popular-hero-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--pop-gold);
}

.popular-hero-stat-label {
    font-size: 0.85rem;
    color: var(--pop-text-muted);
    margin-top: 2px;
}

/* ---- Grille repensée ---- */
.page-popular .popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 0;
}

@media (min-width: 1000px) {
    .page-popular .popular-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---- Cards ---- */
.page-popular .popular-item {
    position: relative;
    background: var(--pop-surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    color: var(--pop-text);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.page-popular .popular-item:hover {
    transform: translateY(-6px);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(212, 175, 55, 0.15);
}

/* Glow doré pour le top 3 */
.page-popular .popular-item--top {
    border-color: rgba(212, 175, 55, 0.2);
}

.page-popular .popular-item--top:hover {
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(212, 175, 55, 0.15),
        0 0 0 1px rgba(212, 175, 55, 0.3);
}

/* ---- Badge de rang ---- */
.popular-rank {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--pop-text-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.popular-rank--gold {
    background: linear-gradient(135deg, var(--pop-gold), var(--pop-gold-light));
    color: #0f0f14;
    border: none;
    font-size: 14px;
    padding: 5px 12px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* ---- Thumbnail ---- */
.popular-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #12121a;
}

.popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-popular .popular-item:hover .popular-thumb img {
    transform: scale(1.05);
}

.popular-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Overlay sombre au hover */
.popular-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.page-popular .popular-item:hover .popular-thumb-overlay {
    background: rgba(0, 0, 0, 0.25);
}

/* Play icon doré, visible uniquement au hover */
.page-popular .popular-thumb .play-icon {
    width: 52px;
    height: 52px;
    background: rgba(212, 175, 55, 0.9);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -26px;
    margin-left: -26px;
}

.page-popular .popular-item:hover .popular-thumb .play-icon {
    opacity: 1;
    transform: scale(1);
}

.page-popular .popular-thumb .play-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #0f0f14;
}

/* Badge de vues */
.popular-views-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
}

.popular-views-badge svg {
    flex-shrink: 0;
}

/* ---- Zone d'info sous la thumbnail ---- */
.page-popular .popular-info {
    padding: 14px 16px 16px;
}

.popular-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--pop-text);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pop-text-muted);
}

.popular-uploader {
    font-weight: 500;
    color: var(--pop-gold);
}

.popular-date::before {
    content: '\00b7';
    margin-right: 8px;
}

/* ---- Pagination numérotée ---- */
.popular-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 48px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.popular-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--pop-text-muted);
    background: var(--pop-surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
}

.popular-page-btn:hover {
    color: var(--pop-text);
    background: var(--pop-surface-hover);
    border-color: rgba(212, 175, 55, 0.2);
}

.popular-page-current {
    background: linear-gradient(135deg, var(--pop-gold), var(--pop-gold-light));
    color: #0f0f14;
    font-weight: 700;
    border-color: transparent;
    cursor: default;
}

.popular-page-current:hover {
    background: linear-gradient(135deg, var(--pop-gold), var(--pop-gold-light));
    color: #0f0f14;
    border-color: transparent;
}

.popular-page-ellipsis {
    color: var(--pop-text-muted);
    padding: 0 4px;
    font-size: 14px;
    user-select: none;
}

.popular-page-prev,
.popular-page-next {
    font-size: 18px;
}

/* ---- État vide ---- */
.page-popular .empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--pop-text-muted);
}

.page-popular .empty-state p:first-child {
    font-size: 1.1rem;
    color: var(--pop-text);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .popular-hero {
        padding: 40px 16px 36px;
    }

    .popular-hero-stats {
        gap: 24px;
    }

    .popular-hero-stat-value {
        font-size: 1.4rem;
    }

    .page-popular .popular-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
    }

    .popular-container {
        padding: 0 16px 32px;
    }
}

@media (max-width: 480px) {
    .popular-hero {
        padding: 32px 16px 28px;
    }

    .popular-hero-title {
        font-size: 1.6rem;
    }

    .popular-hero-subtitle {
        font-size: 0.95rem;
    }

    .page-popular .popular-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .popular-pagination {
        gap: 4px;
    }

    .popular-page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}
