:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --sidebar-bg: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    /* Blue 500 */
    --accent-hover: #2563eb;
    /* Blue 600 */
    --border-color: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: var(--accent-color);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 5px;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.nav-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
}

/* Upload Area */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background-color: rgba(30, 41, 59, 0.3);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover {
    border-color: var(--accent-color);
    background-color: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    transition: transform 0.3s;
}

.upload-zone:hover .upload-icon {
    transform: translateY(-5px);
    color: var(--accent-color);
}

.upload-text h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-text p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Pending Files List */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.file-card:hover {
    transform: translateX(4px);
    border-color: var(--accent-color);
}

.file-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.file-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

.file-status.tmdb-found {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    border: none;
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.btn:hover {
    background-color: var(--border-color);
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-icon {
    padding: 8px;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Floating Actions */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 10px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: var(--card-bg);
    border-radius: 16px;
    width: 500px;
    max-width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.search-results {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.search-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-poster {
    width: 40px;
    border-radius: 4px;
}

/* Google Sign-In */
.g-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: white;
    color: #333;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.g-signin-btn:hover {
    background-color: #f1f1f1;
}

/* Library Grid */
.library-section {
    display: none;
    /* Hidden by default */
    animation: fadeIn 0.3s ease-out;
}

.library-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.library-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.library-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}

.poster-wrapper {
    width: 100%;
    aspect-ratio: 2/3;
    background-color: #000;
    position: relative;
}

.poster-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.card-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease-out;
}

.toast.success {
    border-color: var(--success);
}

.toast.success i {
    color: var(--success);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Upload Mode Tabs */
.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tab-btn i {
    font-size: 18px;
}

.tab-btn:hover {
    background: var(--bg-color);
    color: white;
}

.tab-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Series Config Panel */
.series-config {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.series-config h4 {
    margin-bottom: 15px;
    color: white;
    font-weight: 600;
}

.config-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

/* Storage Metrics */
.storage-metrics {
    display: flex;
    align-items: center;
    gap: 10px;
}

.storage-bar {
    width: 120px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--accent-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Card Actions (Delete Button) */
.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.library-card:hover .card-actions {
    opacity: 1;
}

.btn-delete {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--danger);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-delete:hover {
    transform: scale(1.1);
    background: #dc2626;
}

/* Selectable Cards */
.library-card.selectable {
    cursor: pointer;
}

.library-card.selectable:hover {
    outline: 2px solid var(--accent-color);
}

.library-card.selected {
    outline: 3px solid var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.library-card.selected .card-actions {
    opacity: 1;
}

/* Warning Toast */
.toast.warning {
    border-color: #f59e0b;
}

.toast.warning i {
    color: #f59e0b;
}