:root {
  --bg-primary: #0a0c10;
  --bg-secondary: #12161f;
  --bg-card: #181e2a;
  --bg-input: #0f131a;
  
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-pink: #f857a6;
  --accent-gold: #ffb347;
  --accent-green: #00e676;
  --accent-red: #ff5252;

  --text-main: #f0f4f8;
  --text-muted: #8a99ad;
  --text-dark: #505f75;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(0, 242, 254, 0.3);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.25);

  --nav-height: 65px;
  --header-height: 60px;
}

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

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

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
  animation: fadeIn 0.25s ease-out forwards;
}

.hidden {
  display: none !important;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1a2233 0%, #0a0c10 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  background: rgba(24, 30, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-glow);
  text-align: center;
}

.login-brand .brand-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  color: #000;
  box-shadow: var(--shadow-glow);
}

.login-brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
}

.login-brand h2 span {
  color: var(--accent-cyan);
}

.login-brand p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 24px;
}

/* App Shell Structure */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
  background: var(--bg-primary);
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* Header */
.app-header {
  height: var(--header-height);
  background: rgba(18, 22, 31, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo-badge {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 16px;
  font-weight: 700;
}

.app-title-box h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.app-title-box h1 span {
  color: var(--accent-cyan);
  font-size: 11px;
  background: rgba(0, 242, 254, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.sub-status {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Main Content & Page Switcher */
.app-main-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 20px);
}

.app-page {
  display: none;
}

.app-page.active {
  display: block;
  animation: fadeIn 0.25s ease-out forwards;
}

/* Cards */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.app-card.inner-card {
  background: rgba(15, 19, 26, 0.6);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

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

.card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-red { color: var(--accent-red); }
.icon-cyan { color: var(--accent-cyan); }
.icon-gold { color: var(--accent-gold); }
.icon-green { color: var(--accent-green); }

/* Forms & Inputs */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .col {
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline {
  background: transparent;
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-xl {
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn.danger {
  background: rgba(255, 82, 82, 0.15);
  color: var(--accent-red);
}

/* URL Input & Warning */
.url-input-wrapper {
  display: flex;
  gap: 8px;
}

.duplicate-warning {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(255, 179, 71, 0.15);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  color: var(--accent-gold);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.video-preview-bar img {
  width: 80px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.video-meta h4 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

/* Metadata Box & Poster */
.metadata-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.thumb-poster-box {
  width: 100%;
  text-align: center;
}

.thumb-poster-box img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.label-with-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-copy-sm {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy-sm.highlight {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.code-text {
  font-family: monospace;
  font-size: 12px;
  line-height: 1.4;
  color: #64b5f6;
  resize: vertical;
}

.gemini-prompt-field {
  color: #ffd54f;
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 213, 79, 0.3);
}

/* File Upload */
.file-upload-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.help-text {
  font-size: 12px;
  margin-top: 6px;
}

.text-success { color: var(--accent-green); }

/* Range Slider & Presets */
.label-with-val {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.val-badge {
  font-size: 12px;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.range-slider {
  width: 100%;
  accent-color: var(--accent-cyan);
  margin: 10px 0;
}

.preset-buttons {
  display: flex;
  gap: 8px;
}

.preset-btn {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.preset-btn.active {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Steps Pipeline */
.steps-pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}

.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.step-item.active .step-icon {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.step-item.completed .step-icon {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
}

.step-line {
  height: 2px;
  background: var(--border-color);
  flex: 1;
  margin-bottom: 18px;
}

/* Progress Stats */
.job-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-title {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.stat-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.text-sm { font-size: 12px; }

/* Clips List Rows */
.clips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.clip-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.clip-title-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.clip-tag {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.clip-filename {
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* History Native Cards List */
.history-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card-item {
  background: rgba(15, 19, 26, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease;
}

.history-card-item:active {
  transform: scale(0.99);
}

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

.history-card-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.job-status-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
}

.job-status-pill.completed { background: rgba(0, 230, 118, 0.15); color: var(--accent-green); }
.job-status-pill.failed { background: rgba(255, 82, 82, 0.15); color: var(--accent-red); }
.job-status-pill.queued { background: rgba(255, 179, 71, 0.15); color: var(--accent-gold); }
.job-status-pill.downloading,
.job-status-pill.splitting,
.job-status-pill.uploading { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); }

.history-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.history-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* Detail View Hero */
.detail-hero-box {
  display: flex;
  gap: 14px;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.detail-thumb-img {
  width: 100px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.detail-meta-info h4 {
  font-size: 15px;
  font-weight: 600;
}

/* System Hardware Card */
.hardware-info-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.hw-item {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.hw-title { color: var(--text-muted); }
.hw-val { font-weight: 600; }

/* Bottom Mobile Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  height: var(--nav-height);
  background: rgba(18, 22, 31, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  cursor: pointer;
  position: relative;
  flex: 1;
  padding: 8px 0;
  transition: color 0.2s ease;
}

.nav-tab i {
  font-size: 18px;
}

.nav-tab.active {
  color: var(--accent-cyan);
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 28%;
  background: var(--accent-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 480px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(24, 30, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.toast.success { border-color: var(--accent-green); color: var(--accent-green); }
.toast.warning { border-color: var(--accent-gold); color: var(--accent-gold); }
.toast.error { border-color: var(--accent-red); color: var(--accent-red); }

.divider {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
}
