:root {
    --bg-color: #0f0f0f;
    --card-bg: rgba(30, 30, 30, 0.65);
    /* Transparent for glassmorphism */
    --primary: #bb86fc;
    --secondary: #03dac6;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    /* Midnight Mist: Deep Indigo + Dark Violet + Black base */
    background-image:
        radial-gradient(at 0% 0%, rgba(30, 30, 46, 0.4) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(45, 0, 54, 0.4) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(30, 30, 46, 0.4) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(45, 0, 54, 0.4) 0px, transparent 50%);
    background-size: 200% 200%;
    /* Enough for subtle movement */
    animation: gradient-animation 20s ease infinite;
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    display: flex;
    gap: 10px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px;
    border-radius: 50px;
    border: var(--glass-border);
    width: 60%;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(187, 134, 252, 0.2);
}

input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    width: 100%;
    padding: 0 15px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
}

/* Fix for browser autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--card-bg) inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

button#fetchBtn {
    background: var(--primary);
    border: none;
    color: #000;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

button#fetchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.4);
}

/* Main Content */
.hidden {
    display: none !important;
}

/* Video Player */
.video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: transparent;
    /* Changed from #000 to allow glow if needed, though canvas is inside */
}

#ambientCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Center it */
    width: 110%;
    /* Slightly larger to fill edges with blur */
    height: 110%;
    filter: blur(60px);
    /* Heavy blur for ambient effect */
    opacity: 0.6;
    /* Subtle intensity */
    z-index: 1;
    /* Behind player */
    pointer-events: none;
    /* Ignore clicks */
    transition: opacity 0.5s ease;
}

.artplayer-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    z-index: 2;
    /* Content on top */
    background: #000;
    /* Ensure player has background */
}

.video-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
    border-radius: 12px;
    border: var(--glass-border);
}

h2#videoTitle {
    font-size: 1.2rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: var(--glass-border);
}

.file-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.thumbnail-wrapper {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
}

.thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: var(--transition);
}

.file-card:hover .thumbnail-wrapper img {
    opacity: 1;
    transform: scale(1.05);
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.info-wrapper {
    padding: 15px;
}

.file-name {
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quality-badge {
    background: var(--secondary);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    margin-top: 100px;
    opacity: 0.5;
}

.empty-state i {
    font-size: 5rem;
    margin-bottom: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        padding: 0;
        width: 100%;
        overflow-x: hidden;
        /* Prevent horizontal scroll from ambient */
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px 20px;
        margin-bottom: 10px;
        /* Reduced margin */
    }

    .logo {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Edge-to-Edge Player */
    .video-wrapper {
        width: 100%;
        border-radius: 0;
        margin-bottom: 0;
        box-shadow: none;
        background: #000;
        /* Fallback */
    }

    .artplayer-app {
        border-radius: 0;
        /* Square corners for player */
    }

    /* Adjust ambient canvas for mobile */
    #ambientCanvas {
        width: 100%;
        height: 100%;
        filter: blur(40px);
        /* Reduce blur slightly for performance/mobile */
        opacity: 0.5;
    }

    .video-info {
        border-radius: 0;
        margin: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(30, 30, 30, 0.4);
        /* Slightly improved contrast on mobile */
    }

    /* Edge-to-Edge Thumbnails */
    .file-grid {
        padding: 0;
        grid-template-columns: 100%;
        /* Force single column */
        gap: 0;
        display: block;
        /* Stack blocking */
    }

    .file-card {
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 0;
        width: 100%;
        background: transparent;
        /* Cleaner look on list */
    }

    .thumbnail-wrapper {
        border-radius: 0;
        /* Square corners */
        width: 100%;
    }

    .info-wrapper {
        padding: 12px 15px;
        /* Comfortable touch padding */
    }

    .file-card:hover {
        transform: none;
    }

    .search-box {
        width: 100%;
    }
}

/* FAQ Page Styles */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 50px;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    background: linear-gradient(to right, #fff, #b0b0b0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.faq-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.faq-item {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.faq-item[open] {
    background: rgba(40, 40, 40, 0.8);
    border-color: var(--primary);
}

.faq-item summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    list-style: none;
    /* Remove default triangle */
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary .icon {
    transition: transform 0.3s ease;
    color: var(--primary);
}

.faq-item[open] summary .icon {
    transform: rotate(180deg);
}

.faq-item .answer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-btn {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    border: var(--glass-border);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

footer {
    text-align: center;
    margin-top: 50px;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-bottom: 20px;
}