:root {
  --bg-dark: #070B14;
  --surface: #0E1626;
  --surface-alt: #131E33;
  --border: #1E2D4A;
  --border-focus: #38BDF8;
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --accent-cyan: #38BDF8;
  --accent-blue: #0284C7;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Header */
header {
  height: 52px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

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

.brand-badge {
  background: linear-gradient(135deg, #0284C7, #38BDF8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

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

.wallet-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
}

.wallet-balance {
  font-weight: 700;
  color: var(--accent-emerald);
}

.wallet-days {
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 10px;
  font-size: 12px;
}

.btn-key-manage {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-key-manage:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

/* App Container 3 Cột */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* CỘT 1: PROJECT SIDEBAR */
.project-sidebar {
  width: 250px;
  background: #090E1A;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.btn-icon-add {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--accent-cyan);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}

.btn-icon-add:hover {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-cyan);
}

.project-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s;
}

.project-item:hover {
  background: var(--surface);
}

.project-item.active {
  background: var(--surface-alt);
  border-color: var(--accent-cyan);
}

.project-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
}

.btn-single-mode {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-single-mode:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

/* CỘT 2: STUDIO WORKSTATION (SIÊU TINH GỌN, KHÔNG CẦN SCROLL) */
.studio-column {
  width: 530px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  gap: 12px;
  flex-shrink: 0;
  overflow-y: auto;
}

.project-banner {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.project-badge {
  background: var(--accent-blue);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

.project-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-desc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* KHO TÀI NGUYÊN (ASSET POOL) - THU NHỎ COMPACT */
.asset-pool-container {
  background: #090E1A;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-toggles {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px;
  gap: 1px;
}

.btn-view-toggle {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-view-toggle.active {
  background: var(--surface-alt);
  color: var(--accent-cyan);
}

.badge-count {
  background: var(--surface-alt);
  color: var(--accent-cyan);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
}

/* OPTION 2: DẠNG GRID (COMPACT 90px max-height) */
.asset-grid.view-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 105px;
  overflow-y: auto;
  padding-right: 2px;
}

.asset-grid.view-grid .asset-thumb-wrapper {
  width: 100%;
  height: 52px;
  background: #060A12;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.asset-grid.view-grid .asset-info {
  padding: 3px 4px;
  display: flex;
  flex-direction: column;
}

.asset-grid.view-grid .asset-card-title {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-grid.view-grid .asset-card-size {
  display: none;
}

.asset-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.15s;
  position: relative;
}

.asset-card:hover {
  border-color: var(--accent-cyan);
}

.asset-card.selected {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--accent-cyan), 0 0 8px rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

/* OPTION 1: DẠNG LIST (COMPACT 115px max-height, thoáng chữ không đè nhau) */
.asset-grid.view-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 115px;
  overflow-y: auto;
  padding-right: 2px;
}

.asset-grid.view-list .asset-card {
  flex-direction: row;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  gap: 8px;
  min-height: 38px;
}

.asset-grid.view-list .asset-thumb-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.asset-grid.view-list .asset-type-badge {
  display: none;
}

.asset-grid.view-list .asset-info {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  line-height: 1.2;
}

.asset-list-row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

.asset-list-badge {
  font-size: 8px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.asset-card-size {
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.2;
  margin-top: 1px;
}

.asset-tick-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #10B981;
  color: #070B14;
  font-size: 8px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

.asset-tick-badge-list {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.asset-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.asset-type-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(2px);
  color: var(--accent-cyan);
  font-size: 8px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* MODEL SELECTION HÀNG ĐƠN COMPACT */
.render-config-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.input-select {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  height: 32px;
}

.input-select:focus {
  border-color: var(--accent-cyan);
}

/* CỘT 3: QUEUE & TIMELINE */
.queue-column {
  flex: 1;
  background-color: var(--bg-dark);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  gap: 16px;
}

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 6px;
}

.tab-group {
  display: flex;
  gap: 6px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.tab-btn.active {
  background: var(--accent-blue);
  color: #fff;
  font-weight: 600;
}

/* SKU Selector Cards */
.sku-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sku-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sku-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.sku-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
}

.sku-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.sku-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.sku-card-desc {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Prompt Box */
.composer-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.director-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-magic {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-magic:hover {
  background: rgba(56, 189, 248, 0.2);
}

textarea {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
}

textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Dropzone */
.dropzone-container {
  display: flex;
  gap: 10px;
}

.dropzone {
  flex: 1;
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 90px;
  text-align: center;
}

.dropzone:hover {
  border-color: var(--accent-cyan);
}

.dropzone-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
}

.dropzone-sub {
  font-size: 9px;
  color: var(--text-dim);
}

/* Submit Bar */
.submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.cost-preview {
  font-size: 12px;
  color: var(--text-muted);
}

.cost-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.btn-generate {
  background: linear-gradient(135deg, #0284C7, #0EA5E9);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-generate:hover {
  filter: brightness(1.1);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Queue List */
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s;
}

.job-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.job-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.job-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
}

.status-held, .status-dispatched, .status-processing {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.status-succeeded {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.status-failed, .status-refunded {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.job-prompt {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-main);
}

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

.btn-action {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-action:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* NÚT GHÉP NỐI & KHUNG VIDEO THÀNH PHẨM */
.btn-stitch-export {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-stitch-export:hover {
  filter: brightness(1.15);
}

.stitched-player-box {
  background: #090E1A;
  border: 1px solid var(--accent-emerald);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.stitched-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stitched-badge {
  background: var(--accent-emerald);
  color: #070B14;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
}

.stitched-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.stitched-video {
  width: 100%;
  max-height: 240px;
  border-radius: 6px;
  background: #000;
  border: 1px solid var(--border);
}

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

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  width: 440px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.input-key, .input-text {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
}

.input-key:focus, .input-text:focus {
  outline: none;
  border-color: var(--accent-cyan);
}
