/* ============================================
   KANALISANDO FILMES - ESTÉTICA VHS
   ============================================ */

/* Reset e base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Paleta VHS desbotada */
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    
    --text-primary: #e8e6e3;
    --text-secondary: #a8a5a0;
    --text-muted: #6b6864;
    
    /* Cores VHS */
    --vhs-red: #c73e3e;
    --vhs-cyan: #3e8fc7;
    --vhs-white: #f5f5f0;
    --vhs-yellow: #c7b33e;
    
    /* Efeitos */
    --chromatic-offset: 2px;
    --scanline-opacity: 0.08;
    --grain-opacity: 0.04;
    
    /* Fontes */
    --font-display: 'VT323', monospace;
    --font-body: 'Inter', system-ui, sans-serif;
    
    /* Espaçamento */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Bordas */
    --radius-sm: 4px;
    --radius-md: 8px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ============================================
   EFEITOS VHS
   ============================================ */

/* Scanlines */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, var(--scanline-opacity)),
        rgba(0, 0, 0, var(--scanline-opacity)) 1px,
        transparent 1px,
        transparent 4px
    );
}

/* Grain/film noise */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   HEADER
   ============================================ */

.site-header {
    padding: var(--space-2xl) var(--space-md);
    text-align: center;
    border-bottom: 1px solid var(--bg-secondary);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--vhs-white);
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
    text-shadow: 
        2px 0 var(--vhs-red),
        -2px 0 var(--vhs-cyan);
    animation: flicker 4s infinite;
}

.title-k {
    color: var(--vhs-red);
    font-size: 1.2em;
}

.site-tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md);
}

/* ============================================
   BUSCA
   ============================================ */

.search-section {
    margin-bottom: var(--space-2xl);
}

.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    padding-right: 3.5rem;
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 2px solid var(--text-muted);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--vhs-cyan);
    box-shadow: 
        0 0 0 1px var(--vhs-cyan),
        0 0 20px rgba(62, 143, 199, 0.2);
}

.search-button {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.search-button:hover {
    color: var(--vhs-cyan);
}

/* Filtros */
.filters-container {
    max-width: 700px;
    margin: var(--space-md) auto 0;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-md);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.filter-toggle:hover {
    border-color: var(--vhs-cyan);
    color: var(--vhs-cyan);
}

.filter-toggle svg {
    transition: transform 0.2s ease;
}

.filter-toggle.active svg {
    transform: rotate(180deg);
}

.filters-panel {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding: var(--space-md);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-card);
}

.filters-panel.active {
    display: grid;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.filter-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
}

.filter-select:focus {
    border-color: var(--vhs-cyan);
}

/* ============================================
   SEÇÃO DE FILMES
   ============================================ */

.movies-section {
    margin-top: var(--space-2xl);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--bg-secondary);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--vhs-white);
    letter-spacing: 0.02em;
}

.results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* No results message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.no-results p:first-child {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.no-results-hint {
    font-size: 0.9rem;
}

/* Grid de filmes */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
}

/* Card de filme */
.movie-card {
    position: relative;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: block;
}

.movie-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
    mix-blend-mode: screen;
}

.movie-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--vhs-cyan);
}

.movie-card:hover::before {
    opacity: 1;
    background: linear-gradient(
        90deg,
        rgba(199, 62, 62, 0.1) 0%,
        transparent 50%,
        rgba(62, 143, 199, 0.1) 100%
    );
}

.movie-poster {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: saturate(0.9) contrast(1.05);
    background-color: var(--bg-card);
}

.movie-poster img[src*="data:image"] {
    object-fit: contain;
    padding: var(--space-md);
}

.movie-card:hover .movie-poster img {
    transform: scale(1.05);
    filter: saturate(1) contrast(1.1);
}

/* Efeito chromatic aberration no poster */
.movie-poster::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: 
        linear-gradient(
            90deg,
            rgba(199, 62, 62, 0.15) 0%,
            transparent 30%,
            transparent 70%,
            rgba(62, 143, 199, 0.15) 100%
        );
    mix-blend-mode: screen;
}

.movie-card:hover .movie-poster::after {
    opacity: 1;
}

.movie-info {
    padding: var(--space-md);
}

.movie-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.2;
}

.movie-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.movie-year {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-muted);
}

.movie-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--vhs-yellow);
}

.movie-rating::before {
    content: '★';
    font-size: 0.8rem;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    margin-top: var(--space-2xl);
    padding: var(--space-xl) var(--space-md);
    text-align: center;
    border-top: 1px solid var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 768px) {
    .site-header {
        padding: var(--space-lg) var(--space-md);
    }
    
    .main-content {
        padding: var(--space-lg) var(--space-md);
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--space-md);
    }
    
    .filters-panel {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
}

@media (max-width: 480px) {
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .movie-title {
        font-size: 1.1rem;
    }
}
