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

/* CSS Variables for easy theming */
:root {
    --primary-color: #ff4444;
    --primary-hover: #e63939;
    --bg-color: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --text-color: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --transition: all 0.3s ease;
}

/* Base Styles */
html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

body {
    padding: 20px;
}

/* WhatsApp Banner - Redesigned */
.whatsapp-banner {
    background: linear-gradient(90deg, #075E54 0%, #25D366 50%, #128C7E 100%);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
}

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

.whatsapp-link {
    display: block;
    text-decoration: none;
    padding: 15px 20px;
    transition: all 0.3s ease;
}

.whatsapp-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.whatsapp-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.whatsapp-logo {
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: rotate 20s linear infinite;
}

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

.whatsapp-link:hover .whatsapp-logo {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.whatsapp-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: white;
}

.whatsapp-text strong {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.whatsapp-text small {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.whatsapp-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    color: #25D366;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.whatsapp-cta:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: #f0f0f0;
}

.arrow-icon {
    animation: slideArrow 1.5s infinite;
    color: #25D366;
}

@keyframes slideArrow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

/* Mobile responsive for WhatsApp banner */
@media (max-width: 768px) {
    .whatsapp-banner {
        padding: 10px 15px;
    }
    
    .whatsapp-link {
        padding: 6px 12px;
        gap: 10px;
    }
    
    .whatsapp-icon {
        font-size: 1.5rem;
    }
    
    .whatsapp-text strong {
        font-size: 0.95rem;
    }
    
    .whatsapp-text small {
        font-size: 0.75rem;
    }
    
    .whatsapp-arrow {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .whatsapp-text small {
        display: none;
    }
    
    .whatsapp-text strong {
        font-size: 0.9rem;
    }
}

/* Header with Logo and Search */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo::before {
    content: "📺";
    font-size: 2.5rem;
}

/* Search Form Styling */
.search-container {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 25px;
    padding: 5px 10px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    min-width: 300px;
}

.search-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.1);
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 12px 15px;
    font-size: 1rem;
    outline: none;
    flex: 1;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.search-btn::before {
    content: "🔍";
}

/* Video Grid Layout */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

/* Individual Video Card */
.video {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
}

.video:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

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

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

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

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

/* Recommendation Score Badge */
.score-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 2;
}

.score-badge.high-score {
    background: #00ff00;
    color: #000;
}

/* Duration Badge */
.duration-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    backdrop-filter: blur(10px);
}

/* Play Button Overlay */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.video:hover .play-overlay {
    opacity: 1;
}

.play-overlay::before {
    content: "▶";
    color: white;
    font-size: 1.5rem;
    margin-left: 3px;
}

/* Video Info */
.video-info {
    padding: 15px;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.8em;
}

.video-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.video-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.published-date {
    opacity: 0.8;
}

.recommendation-reason {
    background: rgba(255, 68, 68, 0.1);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Personalization Stats */
.personalization-stats {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

/* Bottom Stats - Estatísticas no final da página */
.personalization-stats.bottom-stats {
    margin-top: 50px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 68, 68, 0.05) 100%);
    border: 2px solid var(--border-color);
}

.personalization-stats h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 68, 68, 0.1);
    color: var(--primary-color);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* High Recommendation Styling */
.video.high-recommendation {
    border: 2px solid var(--primary-color);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 68, 68, 0.05) 100%);
}

.video.high-recommendation::before {
    content: "⭐ RECOMENDADO";
    position: absolute;
    top: -10px;
    left: 15px;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 3;
}

/* Enhanced Video Cards */
.video {
    overflow: visible;
}

.video-info {
    padding: 20px;
}

.video-stats {
    margin-top: 10px;
}

/* Loading State */
.video[style*="opacity: 0"] {
    opacity: 0 !important;
    transform: translateY(20px) !important;
}

/* Enhanced Score Badge */
.score-badge {
    font-size: 0.75rem;
    padding: 6px 10px;
    min-width: 45px;
    text-align: center;
}

.score-badge.high-score {
    background: linear-gradient(45deg, #00ff00, #32cd32);
    color: #000;
    font-weight: 900;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Enhanced Hover Effects */
.video:hover {
    transform: translateY(-12px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.video.high-recommendation:hover {
    box-shadow: 0 8px 25px rgba(255, 68, 68, 0.3);
}

/* Better Typography */
.video-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.video-description {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Enhanced Search */
.search-container {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Search Results Styling */
.search-results-header {
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.search-results-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

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

/* Search Relevant Videos */
.video.search-relevant {
    border-left: 4px solid var(--primary-color);
}

/* Highlighted Search Terms */
mark {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* Enhanced No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.no-results p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.no-results a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.no-results a:hover {
    text-decoration: underline;
}

/* Smooth Animations */
.video,
.search-container,
.search-btn {
    will-change: transform;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .search-container {
        min-width: 100%;
        max-width: 400px;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .logo {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .search-container {
        min-width: 100%;
    }
    
    .search-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* WhatsApp Banner Compact (for watch.php) */
.whatsapp-banner-compact {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.whatsapp-link-compact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.whatsapp-link-compact:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
}

.arrow-compact {
    font-size: 1rem;
    animation: slideArrow 1.5s infinite;
}

/* Video Player Styles (for watch.php) */
.video-page {
    background-color: black;
    overflow: hidden;
    height: 100vh;
}

.video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    z-index: 1000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    z-index: 1002;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
    backdrop-filter: blur(10px);
}

.back-button.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-button:hover {
    background: rgba(255, 68, 68, 0.8);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Video Controls */
.video-controls {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 10px;
    z-index: 1002;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.video-controls.visible {
    opacity: 1;
    transform: translateY(0);
}

.control-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 68, 68, 0.8);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Notification */
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1rem;
    z-index: 1003;
    backdrop-filter: blur(10px);
    animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
button:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-color: #000000;
        --bg-secondary: #111111;
        --text-color: #ffffff;
        --border-color: #666666;
    }
}