:root {
    /* Colors - Premium Theme */
    --primary-hue: 221;
    --primary-sat: 83%;
    --primary-light: 53%;

    --primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light));
    --primary-hover: hsl(var(--primary-hue), var(--primary-sat), 45%);

    --accent: #8b5cf6;
    /* Violet */
    --accent-hover: #7c3aed;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #f1f5f9;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --danger: #ef4444;
    --success: #22c55e;
    --radius: 1rem;
}

[data-theme="dark"] {
    --bg-body: #020617;
    --bg-card: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --input-bg: #1e293b;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Navbar */
.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    text-decoration: none;
}

.logo .highlight {
    color: var(--primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background-color: var(--input-bg);
}

/* Hero */
.main-content {
    flex: 1;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Input Section */
.input-section {
    max-width: 600px;
    margin: 0 auto 3rem;
}

.card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 1rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-muted);
}

input[type="text"] {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-ghost {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.btn-ghost:hover {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

/* Button Overhaul */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.2);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(139, 92, 246, 0.3);
}

.btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--border);
    color: var(--text-main);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background-color: var(--input-bg);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.825rem;
    border-radius: 0.5rem;
}


/* Results */
.results-section {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breadcrumbs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb-item {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.breadcrumb-item:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--border);
}

.breadcrumb-active {
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    cursor: default;
}

/* File Card Overhaul */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.file-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.file-thumb {
    height: 140px;
    background-color: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.file-card:hover .file-thumb img {
    transform: scale(1.05);
}

.file-type-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    letter-spacing: 0.05em;
    z-index: 2;
}

.file-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-header {
    margin-bottom: 0.1rem;
}

.file-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.file-size {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.file-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-row {
    display: flex;
    gap: 0.5rem;
}

.action-row .btn {
    flex: 1;
}

/* Loader */
.loader-container {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Error */
.error-container {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: var(--danger);
    margin-bottom: 2rem;
}

.error-content h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.error-content p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Embedded Player */
.player-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s ease-out;
}

.player-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--input-bg);
}

.video-wrapper {
    background: black;
    width: 100%;
    aspect-ratio: 16/9;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
}

.player-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--text-main);
    color: var(--bg-card);
    padding: 0.75rem 1.25rem;
    border-radius: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
    z-index: 2000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .file-grid {
        grid-template-columns: 1fr;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        justify-content: center;
    }
}