:root {
    --bg-color: #0f111a;
    --glass-bg: rgba(25, 28, 41, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Dynamic Background */
.app-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 25%);
    filter: blur(60px);
    animation: bg-pulse 10s infinite alternate;
}

@keyframes bg-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border-radius: 0 16px 16px 0;
    border-left: none;
    z-index: 10;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    font-weight: 500;
}

.nav-links li i {
    font-size: 1.25rem;
}

.nav-links li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-links li.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(236,72,153,0.1));
    color: var(--primary);
    border: 1px solid rgba(99,102,241,0.3);
}

.sidebar-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Storage Widget */
.storage-widget {
    margin-top: auto;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.storage-header i {
    color: var(--primary);
    font-size: 1.1rem;
}

.progress-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 0.5s ease;
}

#update-gallery-dl-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 2.5rem;
    flex: 1;
    max-width: 1200px;
}

.tab-pane {
    display: none;
    animation: fade-in 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Downloader Box */
.download-box {
    padding: 2rem;
    margin-bottom: 3rem;
}

.textarea-wrapper {
    display: flex;
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem;
    transition: var(--transition);
}

.textarea-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.textarea-wrapper .icon {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin: 0 1rem 0 0.5rem;
    margin-top: 2px;
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    resize: vertical;
    min-height: 80px;
}

.textarea-wrapper .btn {
    margin-left: 1rem;
    align-self: flex-end;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Supported Hosts Tile */
.supported-hosts {
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.supported-hosts h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.supported-hosts h3 i {
    color: var(--warning);
}

.hosts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.host-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    cursor: default;
}

.host-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.host-badge i {
    font-size: 1.1rem;
    color: var(--primary);
}

.adult-heading {
    font-size: 1.1rem;
    color: var(--danger);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.adult-badge:hover {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    color: white;
}

/* Jobs List */
.jobs-container h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.badge {
    background: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.jobs-list {
    display: grid;
    gap: 1rem;
}

.job-item {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.job-item:hover {
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.15);
}

.job-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
}

.job-url {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

.job-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
}

.job-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.status-downloading { background: rgba(99, 102, 241, 0.1); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.2); }
.status-completed { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-failed { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

.job-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    padding: 0.6rem;
    border-radius: 8px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* File Manager */
.file-manager-container {
    overflow: hidden;
}

.fm-toolbar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.breadcrumbs {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.95rem;
}

.crumb {
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.crumb:hover {
    color: var(--primary);
}

.crumb-separator {
    color: var(--glass-border);
}

.fm-table-wrapper {
    overflow-x: auto;
}

.fm-table {
    width: 100%;
    border-collapse: collapse;
}

.fm-table th, .fm-table td {
    padding: 1rem 1.5rem;
    text-align: left;
}

.fm-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.fm-table tr {
    border-bottom: 1px solid rgba(255,255,255,0.02);
    transition: var(--transition);
}

.fm-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.file-name-cell i {
    font-size: 1.5rem;
    color: var(--accent);
}

.file-name-cell i.bx-folder {
    color: var(--primary);
}

.delete-btn {
    color: var(--danger);
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.rename-btn {
    color: var(--accent);
}

.rename-btn:hover {
    background: rgba(236, 72, 153, 0.1);
}

.extract-btn {
    color: var(--warning);
}

.extract-btn:hover {
    background: rgba(245, 158, 11, 0.1);
}

.active-view {
    background: rgba(255,255,255,0.15) !important;
    color: var(--primary) !important;
}

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

.fm-grid-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: var(--transition);
}

.fm-grid-item:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.grid-thumb {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    overflow: hidden;
}

.grid-thumb i {
    font-size: 4rem;
    color: var(--accent);
}

.grid-thumb i.bx-folder {
    color: var(--primary);
}

.grid-thumb img, .grid-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-info {
    padding: 0.6rem;
    background: rgba(0,0,0,0.7);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    backdrop-filter: blur(5px);
}

.grid-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.grid-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.grid-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
    flex-direction: column;
}

.fm-grid-item:hover .grid-actions {
    opacity: 1;
    transform: translateY(0);
}

.grid-actions .icon-btn {
    padding: 6px;
    font-size: 1rem;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.close-modal:hover { color: var(--danger); }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-body pre {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

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

.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--success); }

/* Login Page */
.login-body {
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-container h2 { margin-bottom: 0.5rem; }
.login-container p { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.9rem; }

.login-container .input-group {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 1.5rem;
}

.login-container input {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    text-align: center;
}

.login-container button { width: 100%; justify-content: center; }

.error-msg {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox.show {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2010;
}

.lightbox-close:hover {
    color: var(--danger);
}

.lightbox-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 85vh;
    position: relative;
}

.lightbox-media {
    max-width: 80vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-media img, .lightbox-media video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: contain;
}

.lightbox-prev, .lightbox-next {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 3rem;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: var(--transition);
    z-index: 2010;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev:hover, .lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev { left: 5%; }
.lightbox-next { right: 5%; }

.lightbox-footer {
    position: absolute;
    bottom: 20px;
    color: white;
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
}

/* Plyr Customization */
:root {
    --plyr-color-main: var(--primary);
    --plyr-video-background: transparent;
    --plyr-menu-background: rgba(15, 23, 42, 0.95);
    --plyr-menu-color: var(--text-main);
}

.plyr {
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    overflow: hidden;
}
