:root {
    --bg-color: #0d0f17;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background effects */
.background-grid {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    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: 30px 30px;
    z-index: -2;
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    animation: float 20s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}

.blob-1 {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 70%);
}

.blob-2 {
    bottom: -10%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(236,72,153,0.1) 0%, rgba(0,0,0,0) 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 10%) scale(1.1); }
}

/* Base styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
}

/* Header & Search */
.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 4rem;
    gap: 2rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.gradient-text {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
}

#searchInput {
    width: 100%;
    padding: 1rem 1.5rem;
    padding-right: 4rem;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 2rem;
    color: white;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

#searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    background: rgba(255, 255, 255, 0.12);
}

#searchBtn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    border: none;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

#searchBtn:hover {
    background: #4f46e5;
    transform: translateY(-50%) scale(1.05);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform-origin: top;
    transition: opacity 0.2s, transform 0.2s;
}

.search-dropdown.hidden {
    opacity: 0;
    transform: scaleY(0);
    pointer-events: none;
}

#searchHistoryList {
    list-style: none;
}

#searchHistoryList li {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s, color 0.2s;
}

#searchHistoryList li:last-child {
    border-bottom: none;
}

#searchHistoryList li:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

/* Sections */
.section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Results Table */
.results-table-container {
    overflow-x: auto;
    border-radius: 1rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.results-table th {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-weight: 600;
}

.results-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    vertical-align: middle;
}

.results-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.results-table tr:last-child td {
    border-bottom: none;
}

.seeders { color: #10b981; }
.leechers { color: #ef4444; }

.btn-play {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-play:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.movie-card {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    aspect-ratio: 2/3;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.movie-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.movie-card .title-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 2rem 1rem 0.8rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s;
}

.movie-card .title-overlay .btn-play {
    opacity: 0;
    transition: opacity 0.3s;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2.5rem;
    text-align: center;
    z-index: 101;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1.5rem;
}

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

.links-container {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vlc-link {
    display: block;
    background: rgba(255,165,0,0.2);
    color: #ffb700;
    text-decoration: none;
    padding: 0.8rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: 1px solid rgba(255,165,0,0.4);
    transition: all 0.2s;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: left;
    font-size: 0.85rem;
}

.vlc-link:hover {
    background: #ffb700;
    color: #000;
}

.copy-link {
    display: block;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    text-decoration: none;
    padding: 0.5rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    word-break: break-all;
}

.copy-link:hover {
    background: rgba(99, 102, 241, 0.3);
}

.file-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.source-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close {
    background: rgba(255,255,255,0.1);
    color: white;
}

.btn-close:hover {
    background: rgba(255,255,255,0.2);
}

.pt-6 { padding-top: 3rem; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    border-color: #ef4444;
}

.btn-copy {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}

/* Responsive Table */
@media (max-width: 768px) {
    .results-table thead {
        display: none;
    }
    .results-table, .results-table tbody, .results-table tr, .results-table td {
        display: block;
        width: 100%;
    }
    .results-table tr {
        margin-bottom: 1.5rem;
        background: rgba(255,255,255,0.02);
        border-radius: 1rem;
        padding: 1rem;
        border: 1px solid var(--glass-border);
    }
    .results-table td {
        border-bottom: none;
        padding: 0.5rem 0;
        text-align: left;
    }
    .results-table td:nth-child(1) {
        font-size: 1.1rem;
        font-weight: bold;
    }
    .results-table td:last-child {
        margin-top: 1rem;
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-top: 1rem;
    }
}

/* Video Player Overlay */
.video-player-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.video-player-overlay.hidden { display: none; }

.video-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.2rem;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 10;
    width: min(90vw, 900px);
    border-radius: 0.75rem 0.75rem 0 0;
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom: none;
}

.video-close-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-close-btn:hover {
    background: rgba(239,68,68,0.6);
    border-color: rgba(239,68,68,0.8);
}

#videoPlayer {
    width: 100%;
    background: #000;
    outline: none;
}

/* Plyr wrapper inside overlay */
.video-player-overlay .plyr {
    width: min(90vw, 900px);
    border-radius: 0 0 0.75rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: none;
    overflow: hidden;
}

.video-player-overlay .plyr__video-wrapper {
    max-height: 70vh;
}

/* Plyr dark theme overrides */
.plyr {
    --plyr-color-main: #10b981;
    --plyr-video-background: #000;
}
.plyr__menu__container {
    background: rgba(20, 20, 30, 0.95) !important;
    backdrop-filter: blur(10px);
}

/* Watch in Browser button */
.btn-watch {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0.35rem 0.7rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}
.btn-watch:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}
