:root {
  --bg-dark: #0a0c10;
  --bg-card: rgba(18, 22, 31, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.3);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --radius: 14px;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  padding: 24px;
}

.app-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* Header */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-usa {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-stats {
  display: flex;
  gap: 16px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.stat-value.highlight {
  color: var(--accent-cyan);
}

.disk-progress-bar {
  background: rgba(255, 255, 255, 0.1);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.disk-progress-fill {
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  height: 100%;
  transition: width 0.3s ease;
}

/* Download Input Bar */
.add-download-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.section-title h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.url-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-wrapper {
  display: flex;
  gap: 12px;
}

input[type="url"], textarea {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="url"]:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 24px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--text-main);
}

.batch-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

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

/* Main Grid */
.main-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .main-content-grid {
    grid-template-columns: 1fr;
  }
}

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

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.badge-count {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.btn-icon-label {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-label:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

/* Queue List */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.task-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.task-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.task-name {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-all;
}

.task-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.task-error-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 8px;
  word-break: break-word;
}

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

.task-progress-fill {
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  height: 100%;
  transition: width 0.4s ease;
}

/* File Grid */
.file-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.file-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-accent);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.file-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon.video {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.file-title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.badge-risk {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-clean {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-remux {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-icon.btn-danger:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

.btn-stream {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-stream:hover {
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 8px;
}

.subtext {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Netflix Video Player Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 1000px;
  background: #0f131c;
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.btn-close:hover {
  color: white;
}

.resume-banner {
  background: rgba(99, 102, 241, 0.2);
  border-bottom: 1px solid var(--border-accent);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.resume-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-accent {
  background: var(--primary);
  color: white;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.video-wrapper {
  background: #000;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

video {
  width: 100%;
  height: 100%;
  max-height: 70vh;
}

.modal-footer {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-glass);
}

.security-tag {
  font-size: 0.82rem;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hidden {
  display: none !important;
}
