/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #d32f2f;
    --primary-dark: #9a0007;
    --secondary-color: #1976d2;
    --text-primary: #212121;
    --text-secondary: #757575;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.logo a {
    color: white;
}

.tagline {
    font-size: 14px;
    opacity: 0.9;
}

/* ==================== NAVIGATION & SEARCH ==================== */
.nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box {
    padding: 10px 16px;
    border: none;
    border-radius: 25px;
    width: 300px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-box:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.search-btn {
    padding: 10px 24px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.search-btn:hover {
    background-color: #1565c0;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.back-btn {
    color: white;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

/* ==================== STATS BAR ==================== */
.stats-bar {
    background: var(--bg-white);
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-item strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* ==================== VIDEO GRID ==================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.video-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.video-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background-color: #000;
    overflow: hidden;
}

.thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.video-card:hover .thumbnail {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 30px;
    height: 30px;
    margin-left: 4px;
}

.video-stats {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-info {
    padding: 16px;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.video-date {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 40px;
}

.page-btn {
    padding: 10px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 44px;
    text-align: center;
}

.page-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==================== VIDEO PAGE ==================== */
.video-page {
    padding: 30px 0;
}

.video-player-wrapper {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}

#video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-details {
    padding: 24px;
}

.video-title-large {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.meta-item svg {
    flex-shrink: 0;
}

.video-description {
    margin-bottom: 24px;
}

.video-description h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.video-description p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ==================== SHARE SECTION ==================== */
.share-section {
    margin-top: 24px;
}

.share-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.share-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.share-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.share-btn svg {
    flex-shrink: 0;
}

/* ==================== RELATED SECTION ==================== */
.related-section {
    margin-top: 40px;
}

.related-section h2 {
    font-size: 22px;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
}

.footer-links {
    margin-top: 12px;
}

.footer-links a {
    color: white;
    opacity: 0.8;
    margin: 0 10px;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        align-items: stretch;
    }

    .logo {
        text-align: center;
    }

    .nav {
        flex-direction: column;
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }

    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .video-title-large {
        font-size: 20px;
    }

    .video-meta {
        flex-direction: column;
        gap: 8px;
    }

    .share-buttons {
        flex-direction: column;
    }

    .share-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 22px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        gap: 4px;
    }

    .page-btn {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 38px;
    }
}

/* ==================== UTILITIES ==================== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* Video player más pequeño en desktop */
@media (min-width: 768px) {
    .video-player-wrapper {
        max-width: 900px;
        margin: 0 auto;
    }
    
    .video-container {
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    }
}

@media (min-width: 1200px) {
    .video-player-wrapper {
        max-width: 800px;
    }
}

/* ==================== RELATED VIDEOS GRID (AGREGADO) ==================== */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    justify-items: center;
}

.related-card {
    background: var(--bg-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    width: 100%;
    max-width: 350px;
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.related-card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.related-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.related-card h3 {
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 80px;
}

/* Tablets - Related Videos */
@media (max-width: 1024px) {
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

/* Mobile - Related Videos */
@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .related-card h3 {
        font-size: 14px;
        padding: 12px;
        min-height: 70px;
    }
}

/* Small Mobile - Related Videos */
@media (max-width: 480px) {
    .related-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .related-card {
        max-width: 100%;
    }
    
    .related-card h3 {
        -webkit-line-clamp: 2;
        min-height: 60px;
    }
}

/* Separador de paginación */
.page-separator {
    padding: 10px 8px;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
}
