:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --success: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --card-radius: 14px;
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* Header */
.header {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 20px 24px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.logo-icon {
  font-size: 36px;
  background: rgba(56, 189, 248, 0.1);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 0.8rem;
  background: var(--accent);
  color: #0f172a;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

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

.vm-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

@media (max-width: 820px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.05);
  box-shadow: 0 0 16px var(--accent-glow);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  color: var(--accent);
  margin-bottom: 12px;
}

.dropzone-text {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.dropzone-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
}

.pill {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-text {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Forms & Sliders */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.val-badge {
  background: var(--bg-tertiary);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.range-slider {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
}

.text-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.help-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tabs */
.section-header-tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header-tabs h2 {
  margin-bottom: 0;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--accent);
  color: #0f172a;
  border-color: var(--accent);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.batch-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.radio-card {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.05);
}

.radio-card input {
  position: absolute;
  top: 14px;
  right: 14px;
  accent-color: var(--accent);
}

.radio-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.radio-card strong {
  font-size: 0.9rem;
}

.radio-card span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.extra-config {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}

/* Individual list */
.individual-list-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
}

.individual-item-row {
  display: grid;
  grid-template-columns: 60px 1.5fr 2fr;
  align-items: center;
  gap: 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.thumb-preview {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  border-radius: 10px;
  padding: 14px 24px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #0f172a;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Progress bar */
.progress-area {
  margin-top: 16px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

/* Previews Grid */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.preview-item-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.preview-thumb-box {
  width: 100%;
  height: 173px; /* 3:2 ratio */
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.preview-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-info {
  padding: 10px 12px;
  font-size: 0.8rem;
}

.preview-info .filename {
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden, .hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  max-width: 900px;
  width: 90%;
  z-index: 101;
  overflow: hidden;
}

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

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

.canvas-preview-box {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 500px;
  overflow: hidden;
}

.canvas-preview-box img {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
}

.modal-meta {
  padding: 14px 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-primary);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 16px 0;
}
