/**
 * StreamHub - Styles CSS personnalisés
 * Version: 1.0
 * Date: 2025-01-24
 */

/* ========================================
   Variables CSS
   ======================================== */
:root {
    --color-primary: #ef4444;
    --color-primary-hover: #dc2626;
    --color-secondary: #3b82f6;
    --color-dark: #111827;
    --color-dark-lighter: #1f2937;
    --color-dark-card: #374151;
    --transition-speed: 0.3s;
    --border-radius: 0.5rem;
}

/* ========================================
   Global Reset - Prevent horizontal scroll
   ======================================== */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Fix container width issues */
.container {
    max-width: 100%;
}

/* ========================================
   Animations et transitions globales
   ======================================== */
.transition-all-smooth {
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

/* ========================================
   Composants vidéo
   ======================================== */
.video-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

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

/* Category card styles */
.category-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
}

/* Author card styles */
.author-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.author-card:hover {
    transform: translateY(-8px) scale(1.02);
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.video-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-thumbnail img {
    transition: transform var(--transition-speed) ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badges sur les thumbnails */
.video-badge {
    position: absolute;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

.badge-duration {
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.badge-like-ratio {
    top: 0.5rem;
    left: 0.5rem;
    background: #3b82f6;
    color: white;
}

.badge-viewed {
    top: 0.5rem;
    right: 0.5rem;
    background: #9333ea;
    color: white;
    border-radius: 9999px;
}

.badge-hot {
    top: 0.5rem;
    left: 0.5rem;
    background: #eab308;
    color: white;
    animation: pulse 2s infinite;
}

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

/* ========================================
   Grilles responsives
   ======================================== */
.video-grid {
    display: grid;
    gap: 1rem;
}

/* Mobile */
@media (max-width: 640px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet */
@media (min-width: 640px) and (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop small */
@media (min-width: 768px) and (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop medium */
@media (min-width: 1024px) and (max-width: 1280px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop large */
@media (min-width: 1280px) {
    .video-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .video-grid.max-4-columns {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Carousel horizontal
   ======================================== */
.video-carousel {
    position: relative;
}

.video-carousel-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}

.video-carousel-container::-webkit-scrollbar {
    height: 8px;
}

.video-carousel-container::-webkit-scrollbar-track {
    background: #1f2937;
    border-radius: 4px;
}

.video-carousel-container::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

.video-carousel-container::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.video-carousel-item {
    flex: 0 0 auto;
    width: 250px;
}

@media (max-width: 640px) {
    .video-carousel-item {
        width: 200px;
    }
}

/* ========================================
   Formulaires et inputs
   ======================================== */
.form-input {
    background-color: var(--color-dark-lighter);
    border: 1px solid #374151;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ========================================
   Boutons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: #4b5563;
    color: white;
}

.btn-secondary:hover {
    background-color: #6b7280;
}

/* ========================================
   Navigation et Header
   ======================================== */
.header-sticky {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background-color: rgba(17, 24, 39, 0.95);
}

.nav-link {
    color: #d1d5db;
    transition: color var(--transition-speed) ease;
}

.nav-link:hover {
    color: white;
}

.nav-link.active {
    color: var(--color-primary);
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pagination-link {
    padding: 0.5rem 0.75rem;
    background-color: var(--color-dark-lighter);
    color: #9ca3af;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
}

.pagination-link:hover {
    background-color: #4b5563;
    color: white;
}

.pagination-link.active {
    background-color: var(--color-primary);
    color: white;
}

/* ========================================
   Utilitaires
   ======================================== */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.aspect-video {
    aspect-ratio: 16/9;
}

.aspect-square {
    aspect-ratio: 1/1;
}

/* Scrollbar personnalisée globale */
* {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: #1f2937;
}

*::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ========================================
   Aspect Ratios
   ======================================== */
.aspect-16-9 {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.aspect-16-9 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ========================================
   Custom Select Styling
   ======================================== */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(156, 163, 175, 1)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.2em 1.2em;
    padding-right: 2rem !important;
}

select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(239, 68, 68, 1)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* ========================================
   Carousel Specific
   ======================================== */
.carousel-container {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.carousel-container::-webkit-scrollbar {
    height: 6px;
}

/* Tags carousel */
.tags-carousel {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Scrollbar hide utility - Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
    width: 0;
    height: 0;
}

/* ========================================
   Header & Navigation
   ======================================== */
#mobileMenu {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobileMenuOverlay {
    transition: opacity 0.3s ease;
}

/* Fix FontAwesome width */
i[class*="fa-"].w-5 {
    width: 1.25rem;
}

/* Language selector hover effect */
.language-selector button:hover {
    transform: scale(1.05);
}

/* Mobile language grid */
#mobileLanguageBar {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RTL Support
   ======================================== */
[dir="rtl"] .fa-chevron-down {
    transform: rotate(180deg);
}

[dir="rtl"] .space-x-1 > * + * {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* ========================================
   Filter Section (search page)
   ======================================== */
.filter-section {
    transition: max-height 0.3s ease-out;
}

.filter-collapsed {
    max-height: 0;
    overflow: hidden;
}

.filter-expanded {
    max-height: 1000px;
}

/* ========================================
   Loading et Skeleton
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    border: 2px solid #374151;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Tooltips
   ======================================== */
.tooltip {
    position: relative;
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 0.5rem;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
    margin-bottom: 0.25rem;
}

.tooltip:hover .tooltip-content {
    opacity: 1;
}

/* ========================================
   Mobile Menu
   ======================================== */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.mobile-menu-content {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80%;
    max-width: 300px;
    background-color: var(--color-dark);
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease;
    z-index: 50;
}

.mobile-menu-content.active {
    transform: translateX(0);
}

/* ========================================
   Dark mode support
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --color-text: #f3f4f6;
        --color-text-secondary: #9ca3af;
    }
}

/* ========================================
   Print styles
   ======================================== */
@media print {
    .no-print,
    header,
    footer,
    .pagination,
    .filters {
        display: none !important;
    }
}