/**
 * 🎬 CinemaCloud — Стили
 * Современный кинотеатр с Lampac API
 */

/* === Переменные === */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    
    --accent: #00d4aa;
    --accent-glow: rgba(0, 212, 170, 0.3);
    --accent-secondary: #7c3aed;
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    
    --font-display: 'Unbounded', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* === Фоновые эффекты === */
.bg-gradient {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 170, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 0% 100%, rgba(0, 212, 170, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -2;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -1;
}

/* === Header === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
    transition: transform 0.3s;
}

.logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    border-radius: var(--radius-md);
    font-size: 1rem;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.logo-text {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Navigation === */
.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.active {
    color: var(--bg-primary);
    background: var(--accent);
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* === Search === */
.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s;
}

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

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card-hover);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    font-size: 1rem;
    transition: all 0.3s;
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* === Search Results Dropdown === */
.search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
}

.search-results.active {
    display: block;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover {
    background: var(--bg-card-hover);
}

.search-item img {
    width: 45px;
    height: 65px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.search-item-info {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-loading,
.search-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

/* === Main === */
.main {
    padding-top: 80px;
    min-height: 100vh;
}

/* === Hero Section === */
.hero {
    padding: 60px 30px 40px;
    text-align: center;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 30px;
}

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

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Movies Section === */
.movies-section {
    padding: 20px 30px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
}

/* === Movies Grid === */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

/* === Movie Card === */
.movie-card {
    cursor: pointer;
    transition: transform 0.3s;
}

.movie-card:hover {
    transform: translateY(-8px);
}

.movie-poster {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.movie-card:hover .movie-poster img {
    transform: scale(1.08);
}

.movie-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.movie-card:hover .movie-overlay {
    opacity: 1;
}

.play-btn {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--bg-primary);
    box-shadow: 0 10px 30px var(--accent-glow);
    transform: scale(0.8);
    transition: transform 0.3s;
}

.movie-card:hover .play-btn {
    transform: scale(1);
}

.movie-rating {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(10px);
}

.movie-rating.high {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.movie-rating.medium {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
}

.movie-rating.low {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    font-size: 1rem;
    transition: all 0.3s;
    opacity: 0;
}

.movie-card:hover .fav-btn {
    opacity: 1;
}

.fav-btn:hover {
    transform: scale(1.15);
}

.fav-btn.active {
    opacity: 1;
    background: rgba(239, 68, 68, 0.8);
}

/* === Movie Info === */
.movie-info {
    padding: 15px 5px 5px;
}

.movie-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.movie-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Loader === */
.loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loader p {
    color: var(--text-muted);
}

/* === Empty State === */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state.error {
    color: #ef4444;
}

.empty-icon {
    display: block;
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-hint {
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0.6;
}

/* === Footer === */
.footer {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* === Responsive === */
@media (max-width: 900px) {
    .header {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 15px;
    }
    
    .logo {
        order: 1;
        flex-shrink: 0;
    }
    
    .logo-text {
        display: none;
    }
    
    .logo-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .search-box {
        order: 2;
        flex: 1;
        min-width: 0;
        max-width: none;
    }
    
    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .hero {
        padding: 10px 20px 30px;
    }
    
    .hero-stats {
        gap: 25px;
    }
    
    .movies-section {
        padding: 15px 20px 40px;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .main {
        padding-top: 140px;
    }
}

@media (max-width: 600px) {
    .logo-text {
        display: none;
    }
    
    .nav-link {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-stats {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .movie-title {
        font-size: 0.85rem;
    }
    
    .play-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

