:root {
    --bg-dark: #090a10;
    --bg-card: rgba(17, 19, 32, 0.65);
    --border-glass: rgba(255, 255, 255, 0.07);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --secondary: #ec4899;
    --secondary-glow: rgba(236, 72, 153, 0.35);
    --cyan: #06b6d4;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

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

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

/* Background Glowing Blobs */
.glow-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.45;
}

.glow-blob-1 {
    background: var(--primary);
    width: 450px;
    height: 450px;
    top: -100px;
    left: -100px;
    animation: drift 25s infinite alternate;
}

.glow-blob-2 {
    background: var(--secondary);
    width: 400px;
    height: 400px;
    bottom: -50px;
    right: -100px;
    animation: drift 20s infinite alternate-reverse;
}

.glow-blob-3 {
    background: var(--cyan);
    width: 300px;
    height: 300px;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    opacity: 0.15;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(120px, 80px) scale(1.15); }
}

/* Container */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    background: linear-gradient(135deg, var(--primary), rgba(99, 102, 241, 0.6));
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.queue-badge {
    background-color: var(--secondary);
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    position: absolute;
    top: -6px;
    right: -6px;
    box-shadow: 0 0 8px var(--secondary-glow);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 760px;
    margin: 0 auto;
}

.glass-card.full-width {
    max-width: 100%;
}

.card-header {
    margin-bottom: 28px;
}

.card-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 8px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

/* Drag and Drop Zone */
.drag-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.01);
}

.drag-zone:hover, .drag-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.08);
}

.drag-icon {
    font-size: 54px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    transition: transform 0.3s ease, color 0.3s ease;
}

.drag-zone:hover .drag-icon {
    transform: translateY(-5px);
    color: var(--primary);
}

.drag-zone h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.drag-zone p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-browse {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}

.drag-zone:hover .btn-browse {
    background: rgba(255, 255, 255, 0.12);
}

/* Metadata Form */
.metadata-form {
    margin-top: 28px;
    animation: slideDown 0.3s ease-out;
}

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

.metadata-form h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    padding: 14px 16px 14px 44px;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    transition: all 0.3s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.input-help {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* File Details Card */
.file-details {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.file-info i {
    font-size: 28px;
    color: var(--primary);
}

.file-info h4 {
    font-size: 15px;
    font-weight: 600;
    max-width: 400px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.file-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
    padding: 4px;
}

.btn-remove:hover {
    color: var(--error);
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 16px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Progress State UI */
.progress-state {
    margin-top: 28px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    animation: fadeIn 0.4s;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.progress-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.progress-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.progress-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--cyan));
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

.progress-footer {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

#progress-percent {
    color: var(--cyan);
}

/* Table Design */
.table-container {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.1);
}

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

.history-table th {
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 18px 20px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.history-table tbody tr {
    transition: background-color 0.2s;
}

.history-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-queued {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-uploading {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    animation: pulsing 1.5s infinite;
}

.badge-transcoding {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    animation: pulsing 1.5s infinite;
}

.badge-uploading-r2 {
    background: rgba(236, 72, 153, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(236, 72, 153, 0.2);
    animation: pulsing 1.5s infinite;
}

.badge-completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes pulsing {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Integrity Check Badges */
.badge-integrity {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

.badge-integrity-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge-integrity-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 8px;
}

/* Modal Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal {
    background: #111322;
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    width: 90%;
    max-width: 550px;
    padding: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    max-height: 350px;
    overflow-y: auto;
}

/* Progress Mini Tracker (for active processing in list) */
.progress-mini {
    margin-top: 8px;
}

.progress-mini-bar {
    height: 4px;
    width: 120px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.progress-mini-fill {
    height: 100%;
    background: var(--cyan);
    border-radius: 2px;
}

.progress-mini span {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

/* Responsive */
@media(max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .nav-tabs {
        width: 100%;
    }
    
    .nav-tab {
        flex: 1;
        justify-content: center;
    }
    
    .glass-card {
        padding: 20px;
    }
}

/* R2 Storage Custom Styles */
#panel-r2 .history-table td {
    word-break: break-all;
}

#panel-r2 .btn-browse {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

#panel-r2 .btn-browse:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--cyan);
}
