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

:root {
    --max-width: 1200px;
    --logo-size: clamp(1.8rem, 4vw, 3rem);
    --subtitle-size: 1.1rem;
    --poster-height: 375px;
    --poster-height-sm: 225px;
    --accent: #00ff00;
    --accent-rgb: 0,255,0;
    --bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #1a4d2e 100%);
    --bg-light-gradient: linear-gradient(135deg, #f7f7f8 0%, #e6f0ea 100%);
    --text-color: #ffffff;
    --text-color-light: #0a0a0a;
    --card-bg: rgba(0,0,0,0.4);
    --card-bg-light: rgba(255,255,255,0.9);
    --glass: rgba(0,0,0,0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* Light theme overrides */
body[data-theme="light"] {
    background: var(--bg-light-gradient);
    color: var(--text-color-light);
}

#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 2;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin-bottom: 40px;
    border: 1px solid rgba(0, 255, 0, 0.1);
}

.logo {
    font-size: var(--logo-size);
    font-weight: bold;
    background: linear-gradient(45deg, #00ff00, #00aa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
}

.subtitle {
    font-size: var(--subtitle-size);
    color: var(--accent);
    opacity: 0.9;
}

.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(var(--accent-rgb), 0.12);
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.5);
    color: inherit;
    font-size: 16px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.filter-box {
    min-width: 200px;
}

.filter-box select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.5);
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-box select:focus {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

.filter-box select option {
    background: #1a1a1a;
    color: #fff;
}

.lang-toggle {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lang-btn {
    padding: 15px 30px;
    border: 2px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.5);
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.lang-btn.active {
    background: linear-gradient(45deg, var(--accent), #00aa00);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.35);
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 0, 0.3);
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.movie-card {
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(0, 255, 0, 0.1);
}

.movie-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 255, 0, 0.3);
    border-color: #00ff00;
}

.movie-poster {
    width: 100%;
    height: var(--poster-height);
    object-fit: cover;
    display: block;
}

.movie-info {
    padding: 20px;
}

.movie-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--accent);
}

.movie-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating {
    color: #00ff00;
    font-weight: bold;
}

.movie-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.play-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent), #00aa00);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.5);
}

.play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 50px rgba(0, 255, 0, 0.8);
}

.play-btn::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 22px solid #000;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    margin-left: 4px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: var(--accent);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    font-size: 1.3em;
    color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
    .logo {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    .controls {
        flex-direction: column;
    }

    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .movie-poster {
        height: var(--poster-height-sm);
    }
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
}

.theme-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 2px solid rgba(var(--accent-rgb), 0.2);
    background: rgba(0,0,0,0.35);
    color: inherit;
    cursor: pointer;
    font-size: 18px;
}

/* Light theme specific tweaks */
body[data-theme="light"] .controls,
body[data-theme="light"] .header,
body[data-theme="light"] .movie-card {
    background: var(--card-bg-light);
}

body[data-theme="light"] .search-box input,
body[data-theme="light"] .filter-box select,
body[data-theme="light"] .lang-btn {
    background: rgba(255,255,255,0.9);
    color: var(--text-color-light);
}

[dir="rtl"] .play-btn::before {
    border-left: none;
    border-right: 25px solid #000;
    margin-left: 0;
    margin-right: 5px;
}

/* Trailer Modal */
.trailer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.trailer-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 70vh;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid #00ff00;
    box-shadow: 0 0 50px rgba(0, 255, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--accent);
    border-radius: 50px;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.fullscreen-btn {
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.close-btn:hover,
.fullscreen-btn:hover {
    background: var(--accent);
    color: #000;
    transform: scale(1.1);
}

.movie-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    padding: 0 20px;
}

.action-btn {
    padding: 15px 30px;
    border: 2px solid #00ff00;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.9);
    color: #00ff00;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.action-btn:hover {
    background: #00ff00;
    color: #000;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 255, 0, 0.6);
}

.watch-btn {
    background: linear-gradient(45deg, #00ff00, #00aa00);
    color: #000;
    border: none;
    font-size: 18px;
}

.watch-btn:hover {
    background: linear-gradient(45deg, #00ff00, #00ff00);
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.8);
}

.trailer-btn {
    background: rgba(0, 0, 0, 0.9);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 2px solid #00ff00;
}

.player-title {
    color: #00ff00;
    font-size: 1.3em;
    margin: 0;
    flex: 1;
}

.player-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.server-select {
    padding: 10px 20px;
    border: 2px solid #00ff00;
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.server-select:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.server-select option {
    background: #1a1a1a;
    color: #00ff00;
}

@media (max-width: 768px) {
    .trailer-content {
        width: 95%;
        height: 50vh;
    }

    .close-btn {
        top: 10px;
        right: 10px;
        padding: 8px 16px;
        font-size: 14px;
    }

    .fullscreen-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Fullscreen styles */
#player-content:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
}

#player-content:fullscreen .player-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
}