:root {
  --bg: #0f1115;
  --bg-elevated: #181a20;
  --bg-elevated-soft: #21242d;
  --border-subtle: #2a2d36;
  --accent: #f1403c;
  --accent-soft: rgba(241, 64, 60, 0.15);
  --accent-strong: rgba(241, 64, 60, 0.7);
  --text-main: #ffffff;
  --text-muted: #a0a3ad;
  --text-soft: #777b86;
  --danger: #ff5252;
  --danger-soft: rgba(255, 82, 82, 0.1);
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-subtle: 0 0 0 1px rgba(255, 255, 255, 0.03);
  --transition-fast: 0.18s ease-out;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: radial-gradient(circle at top left, #20263a 0, #050609 55%, #000 100%);
  color: var(--text-main);
}

body {
  display: flex;
}

.app-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */

.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(9, 10, 14, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-circle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #ffb19f, #f1403c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 0 0 2px rgba(241, 64, 60, 0.5);
}

.topbar-title .brand {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
}

.topbar-title .brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.user-label {
  color: var(--text-muted);
}

/* Generic */

.screen {
  flex: 1;
  display: none;
}

.screen.active {
  display: block;
}

.center-wrapper {
  height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Card */

.card {
  background: linear-gradient(145deg, #161820, #11131a);
  border-radius: 20px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow-soft);
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.card-title {
  margin: 0 0 4px;
  font-size: 22px;
}

.card-subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Login */

.login-card {
  position: relative;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  color: var(--text-muted);
}

.form-group input {
  background: #0c0d11;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 9px 11px;
  color: var(--text-main);
  outline: none;
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.error-text {
  font-size: 12px;
  color: var(--danger);
  padding-top: 2px;
}

.hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-soft);
}

/* Buttons */

.btn {
  border-radius: 999px;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-fast), color var(--transition-fast), opacity 0.15s;
  font-weight: 500;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6a4c, #f1403c);
  color: white;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.btn-link {
  background: transparent;
  color: var(--text-muted);
  padding: 0;
}

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

.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}

.full-width {
  width: 100%;
}

/* Studio layout */

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 20px;
  padding: 20px 24px 22px;
}

.panel {
  background: linear-gradient(145deg, #191b25, #11131a);
  border-radius: var(--radius-lg);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
}

.panel-subtitle {
  margin: 2px 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.panel-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

/* Drop zone */

.drop-zone {
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  padding: 22px 18px;
  text-align: center;
  background: radial-gradient(circle at top, rgba(241, 64, 60, 0.12), rgba(9, 10, 14, 0.9));
  transition: border-color var(--transition-fast), background-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: radial-gradient(circle at top, rgba(241, 64, 60, 0.18), rgba(9, 10, 14, 0.95));
  transform: translateY(-1px);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7);
}

.drop-icon {
  font-size: 26px;
  margin-bottom: 6px;
}

.drop-text-main {
  font-size: 14px;
  font-weight: 500;
}

.drop-text-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

/* Queue */

.queue-container {
  margin-top: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 10px 10px 8px;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.queue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 170px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12px;
}

.queue-thumb {
  width: 40px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.queue-thumb img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: cover;
}

.queue-info {
  flex: 1;
  min-width: 0;
}

.queue-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-meta {
  font-size: 11px;
  color: var(--text-soft);
}

/* Progress */

.progress-wrapper {
  margin-top: 16px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.progress-bar {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff6a4c, #f1403c);
  transition: width 0.15s ease-out;
}

/* Upload actions */

.upload-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-text {
  font-size: 12px;
  color: var(--text-soft);
}

/* History */

.table-wrapper {
  flex: 1;
  margin-top: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table thead {
  background: rgba(0, 0, 0, 0.55);
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: left;
}

.table th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.thumb-cell {
  width: 76px;
}

.thumb-preview {
  width: 64px;
  height: 36px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 20px;
}

.thumb-preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: cover;
}

.title-cell-main {
  font-size: 13px;
}

.title-cell-sub {
  font-size: 11px;
  color: var(--text-soft);
}

.tag-video {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(65, 150, 255, 0.15);
  color: #96c4ff;
  font-size: 11px;
}

.tag-image {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(53, 194, 130, 0.15);
  color: #84e0ad;
  font-size: 11px;
}

.badge-deleted {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
}

/* Empty state */

.empty-state {
  flex: 1;
  display: flex;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 18px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-soft);
}

/* Utilities */

.hidden {
  display: none !important;
}

/* Responsive */

@media (max-width: 960px) {
  .studio-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 14px;
  }
  .studio-layout {
    padding: 16px 14px;
  }
  .panel {
    padding: 14px 12px;
  }
}
