:root {
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #475569;
  --border-light: #334155;
  --track-bg: #1e293b;
  --clip-video: #2563eb;
  --clip-text: #059669;
  --clip-audio: #d97706;
  --clip-logo: #7c3aed;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

/* Header */
.studio-header {
  height: 56px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-brand .badge-pro {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.mode-tabs-group {
  display: flex;
  gap: 4px;
  background: var(--bg-dark);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.mode-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  border: none;
  transition: all 0.2s;
}

.mode-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.9);
  padding: 3px 6px 3px 12px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.auto-download-header-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.auto-download-header-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.btn-launch-header {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.5);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-launch-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(124, 58, 237, 0.7);
  background: linear-gradient(135deg, #1d4ed8, #6d28d9);
}

.btn-launch-header:active {
  transform: translateY(1px);
}

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

.credit-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.btn-upgrade {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-upgrade:hover {
  opacity: 0.9;
}

.user-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-admin-nav {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
  transition: all 0.2s;
  cursor: pointer;
}

.btn-admin-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.7);
  color: #000;
}

.btn-history-nav {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-history-nav:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.history-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s;
}

.history-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.history-card.expired {
  opacity: 0.6;
  border-style: dashed;
}


/* Studio Workspace Layout */
.studio-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left Configuration Panel */
.left-panel {
  width: 380px;
  min-width: 340px;
  max-width: 420px;
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group {
  margin-bottom: 12px;
}

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

.form-control, .form-select {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
}

.input-group {
  display: flex;
  gap: 6px;
}

.btn {
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: #475569; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: 0.9; }

.btn-launch {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  margin-top: 10px;
}

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

/* Center Stage: Video Canvas & Editor */
.center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #020617;
  overflow: hidden;
  position: relative;
}

.viewport-container {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  position: relative;
  overflow: auto;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
}

.canvas-wrapper {
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
  margin: auto;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-wrapper.ratio-9-16 {
  aspect-ratio: 9 / 16;
}

.canvas-wrapper.ratio-1-1 {
  aspect-ratio: 1 / 1;
}

.canvas-wrapper.fit-fill #videoPreview {
  object-fit: cover !important;
}

.canvas-wrapper.fit-contain #videoPreview {
  object-fit: contain !important;
}

.canvas-wrapper.fit-blur {
  background: #000;
}

#videoPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
}

/* CapCut Style Controls */
.capcut-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.capcut-btn:hover {
  background: var(--bg-card);
  color: #fff;
  border-color: #38bdf8;
}

.capcut-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.sub-preset-chip {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 0.74rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sub-preset-chip:hover {
  border-color: #38bdf8;
  transform: translateY(-1px);
  background: var(--bg-card);
}

#overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Toolbar on Top of Canvas (Collapsible) */
.canvas-toolbar-container {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 20;
  transition: all 0.25s ease;
}

.canvas-toolbar {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.canvas-toolbar.collapsed {
  display: none !important;
}

.canvas-toolbar-toggle-btn {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 3px 14px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.canvas-toolbar-toggle-btn:hover {
  background: var(--bg-card);
  color: #38bdf8;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.canvas-tool-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.canvas-tool-btn:hover {
  background: var(--bg-card);
}

.canvas-tool-btn.active {
  background: var(--primary);
  color: #fff;
}

.btn-palette {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
  outline: none;
}

.btn-palette:hover {
  transform: scale(1.2);
  border-color: #38bdf8;
}

/* Video Control Bar */
.video-controls {
  height: 44px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
}

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

.play-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timecode {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Timeline Resizer Bar (Between Video Viewport & Bottom Editor) */
.timeline-resizer {
  height: 28px;
  background: #0b1120;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
  cursor: ns-resize;
  position: relative;
  z-index: 15;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  transition: background 0.15s ease;
}

.timeline-resizer:hover,
.timeline-resizer.resizing {
  background: #1e293b;
  border-top-color: #38bdf8;
}

.timeline-resizer-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.15s ease;
}

.timeline-resizer:hover .timeline-resizer-line,
.timeline-resizer.resizing .timeline-resizer-line {
  background: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
}

.timeline-resizer-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
}

.timeline-quick-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.timeline-quick-btn:hover {
  background: var(--bg-card);
  color: #38bdf8;
  border-color: #38bdf8;
}

.timeline-preset-heights {
  display: flex;
  align-items: center;
  gap: 4px;
}

.timeline-preset-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timeline-preset-btn:hover,
.timeline-preset-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Bottom Editor Panel (Holds Controls & Timeline) */
.bottom-editor-panel {
  height: 260px;
  min-height: 44px;
  max-height: 650px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: height 0.15s ease-out;
}

.bottom-editor-panel.minimized {
  height: 44px !important;
}

.bottom-editor-panel.minimized .timeline-panel {
  display: none !important;
}

/* Multi-Track Timeline Panel */
.timeline-panel {
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.timeline-header {
  height: 36px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.timeline-tools {
  display: flex;
  gap: 8px;
}

.tool-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.tool-icon-btn:hover {
  color: #fff;
  background: var(--bg-card);
}

.timeline-body {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
  background: #090d16;
}

.timeline-ruler {
  height: 24px;
  background: #0f172a;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.timeline-tracks {
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-lane {
  height: 38px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 4px;
  position: relative;
  margin: 0 10px;
}

.track-label {
  position: absolute;
  left: 6px;
  top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  pointer-events: none;
  z-index: 5;
}

.timeline-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: #fff;
  cursor: move;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  user-select: none;
}

.clip-video { background: var(--clip-video); }
.clip-text { background: var(--clip-text); }
.clip-audio { background: var(--clip-audio); }
.clip-logo { background: var(--clip-logo); }

.timeline-clip.active-clip {
  outline: 2px solid #38bdf8 !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.9) !important;
  z-index: 10;
}

.timeline-clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255, 255, 255, 0.35);
  z-index: 12;
  transition: background 0.15s;
}

.timeline-clip-handle:hover {
  background: rgba(255, 255, 255, 0.9);
}

.timeline-clip-handle.left-handle {
  left: 0;
  cursor: ew-resize;
  border-radius: 4px 0 0 4px;
}

.timeline-clip-handle.right-handle {
  right: 0;
  cursor: ew-resize;
  border-radius: 0 4px 4px 0;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 50;
  pointer-events: none;
}

.playhead::after {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 12px;
  background: #ef4444;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 540px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  transform: scale(0.96);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

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

/* Modal Nạp Credits Chuyên Biệt (Cuộn mượt mà & Sắp xếp khoa học) */
.billing-modal-dialog {
  max-width: 820px !important;
  width: 92% !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.billing-modal-dialog .modal-header {
  padding: 18px 24px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
  margin-bottom: 0;
  flex-shrink: 0;
}

.billing-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  scroll-behavior: smooth;
}

/* Tùy biến thanh cuộn (Custom Scrollbar) cho modal nạp tiền */
.billing-modal-body::-webkit-scrollbar {
  width: 8px;
}
.billing-modal-body::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}
.billing-modal-body::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
.billing-modal-body::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

/* Banner Cơ Chế Nạp & Trừ Credits */
.credit-policy-banner {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.credit-policy-banner-title {
  font-weight: 800;
  color: #38bdf8;
  font-size: 0.85rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.credit-policy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.credit-policy-box {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.credit-policy-box.plus {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-left: 3px solid #10b981;
}

.credit-policy-box.minus {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-left: 3px solid #f59e0b;
}

.credit-policy-footer {
  font-size: 0.75rem;
  color: #94a3b8;
  border-top: 1px dashed #1e293b;
  padding-top: 8px;
  line-height: 1.4;
}

/* Pricing Grid & Modern Cards */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.plan-card {
  background: linear-gradient(180deg, #161f30 0%, #0d1322 100%);
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.18);
}

.plan-card.featured {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #1a2540 0%, #0f172a 100%);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.25);
}

.plan-badge {
  position: absolute;
  top: -10px;
  right: 14px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
}

.plan-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-price-box {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.plan-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: -0.5px;
}

.plan-credits-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #facc15;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 12px;
  width: fit-content;
}

.plan-features {
  list-style: none;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
  color: #cbd5e1;
}

.plan-features li::before {
  content: "✓";
  color: #34d399;
  font-weight: 800;
  flex-shrink: 0;
}

.plan-card .btn {
  width: 100%;
  padding: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 8px;
  margin-top: auto;
}

/* QR Code Modal */
.qr-container {
  text-align: center;
  padding: 16px 0;
}

.qr-image {
  max-width: 240px;
  border-radius: 8px;
  border: 4px solid #fff;
  margin-bottom: 14px;
}

.qr-info-table {
  width: 100%;
  font-size: 0.85rem;
  text-align: left;
  border-collapse: collapse;
  margin-top: 10px;
}

.qr-info-table td {
  padding: 6px;
  border-bottom: 1px solid var(--border-light);
}

.qr-info-table td:first-child {
  color: var(--text-muted);
  width: 35%;
}

.highlight-copy {
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

/* Progress Percent Animation & Launch Action Box */
.launch-action-box {
  transition: transform 0.2s, box-shadow 0.2s;
}

.launch-action-box:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

#progressPercentNum {
  letter-spacing: -1px;
  display: inline-block;
  transition: transform 0.2s ease;
}

/* Google Sign In & Auth Divider */
.btn-google-login {
  width: 100%;
  background: #ffffff;
  color: #1f2937;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #d1d5db;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.btn-google-login:hover {
  background: #f9fafb;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.btn-google-login:active {
  transform: translateY(1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Auth Tabs & Google Box */
.auth-tab-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab-btn:hover {
  color: #f8fafc;
}

.auth-tab-btn.active {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* High-Visibility Video Upload & Progress Card */
.video-status-card {
  margin-top: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.video-status-card.active-uploading {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.video-status-card.upload-success {
  border-color: rgba(34, 197, 94, 0.8);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.25);
}

.video-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.video-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
}

.video-status-percent-pill {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-size: 0.9rem;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 20px;
  line-height: 1.2;
}

.video-status-card.upload-success .video-status-percent-pill {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.progress-bar-track {
  background: #090d16;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  transition: width 0.25s ease;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.video-status-card.upload-success .progress-bar-fill {
  background: linear-gradient(90deg, #10b981, #059669);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.video-status-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.3;
}

/* Floating Status Pill on Video Canvas */
.canvas-status-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #38bdf8;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
  pointer-events: none;
  transition: all 0.3s ease;
}

.canvas-status-pill.success {
  border-color: rgba(34, 197, 94, 0.8);
  color: #4ade80;
  background: rgba(6, 78, 59, 0.85);
}

/* Progress Modal & Video Process Steps */
@keyframes stepPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}

@keyframes stepSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.step-flow-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 12px 0 8px 0;
}

@media (max-width: 600px) {
  .step-flow-container {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.step-flow-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 6px;
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.step-flow-item .step-icon {
  font-size: 1rem;
  line-height: 1;
}

.step-flow-item .step-name {
  font-weight: 600;
  line-height: 1.2;
}

.step-flow-item.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.step-flow-item.active .step-icon {
  animation: stepPulse 1.5s infinite;
}

.step-flow-item.completed {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.progress-console-box {
  background: #030712;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  margin-top: 10px;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  max-height: 130px;
  overflow-y: auto;
  text-align: left;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.8);
}

.progress-log-line {
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  line-height: 1.4;
  word-break: break-word;
}

.progress-log-line:last-child {
  border-bottom: none;
  color: #38bdf8;
  font-weight: 700;
}

/* ============================================================== */
/* TOÀN DIỆN RESPONSIVE: PC, LAPTOP, TABLET & MOBILE */
/* ============================================================== */

/* 1. MÀN HÌNH LAPTOP & MÀN HÌNH VỪA (<= 1280px) */
@media (max-width: 1280px) {
  .left-panel {
    width: 320px;
    min-width: 300px;
  }
  .btn-launch-header {
    padding: 7px 14px;
    font-size: 0.82rem;
  }
  .mode-tab {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
  .studio-header {
    padding: 0 14px;
    gap: 10px;
  }
}

/* 2. MÀN HÌNH LAPTOP NHỎ & MÁY TÍNH BẢNG NGANG (<= 1024px) */
@media (max-width: 1024px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .studio-header {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .header-center {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .header-right {
    gap: 8px;
  }
  .studio-body {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }
  .left-panel {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    overflow-y: visible;
  }
  .center-panel {
    width: 100%;
    min-height: 500px;
    overflow: visible;
  }
  .viewport-container {
    min-height: 380px;
    padding: 10px;
  }
  .bottom-editor-panel {
    height: 300px;
  }
}

/* 3. MÀN HÌNH ĐIỆN THOẠI DI ĐỘNG (MOBILE <= 768px) */
@media (max-width: 768px) {
  .studio-header {
    padding: 8px 10px;
  }
  .logo-brand {
    font-size: 1rem;
    gap: 6px;
  }
  .logo-brand .badge-pro {
    font-size: 0.65rem;
    padding: 1px 6px;
  }
  .header-right {
    gap: 6px;
  }
  .credit-badge {
    padding: 3px 8px;
    font-size: 0.78rem;
  }
  .btn-history-nav,
  #btnTermsPolicy {
    padding: 5px 8px;
    font-size: 0.78rem;
  }
  .btn-history-nav span,
  #btnTermsPolicy span {
    display: none;
  }
  .btn-upgrade {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
  .user-btn {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
  .btn-admin-nav {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  /* Header Controls Mobile */
  .header-center {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .mode-tabs-group {
    width: 100%;
    display: flex;
  }
  .mode-tab {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 0.78rem;
  }
  .header-action-group {
    width: 100%;
    justify-content: space-between;
    padding: 6px 10px;
  }
  .btn-launch-header {
    flex: 1;
    justify-content: center;
    padding: 10px;
    font-size: 0.85rem;
  }

  /* Left Panel form controls */
  .panel-section {
    padding: 14px 12px;
  }
  .canvas-toolbar {
    padding: 4px 10px;
    gap: 4px;
    max-width: 95vw;
    overflow-x: auto;
  }
  .canvas-tool-btn {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  /* Video Viewport Mobile */
  .viewport-container {
    min-height: 280px;
    padding: 8px;
  }
  .canvas-wrapper {
    max-width: 100%;
  }

  /* Modals Mobile */
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: 16px 14px !important;
    margin: 10px !important;
  }
  .modal-header {
    margin-bottom: 14px !important;
  }
  .modal-title {
    font-size: 1.05rem !important;
  }
  .pricing-grid {
    grid-template-columns: 1fr !important;
  }

  /* Video controls bar */
  .video-controls {
    padding: 0 8px;
    gap: 8px;
  }
  .timecode {
    font-size: 0.75rem;
  }

  /* Timeline Resizer Actions on Mobile */
  .timeline-resizer-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  .timeline-preset-heights {
    display: none;
  }
}

/* 4. MÀN HÌNH RẤT NHỎ (<= 480px) */
@media (max-width: 480px) {
  .logo-brand span:first-child {
    font-size: 0.9rem;
  }
  .btn-upgrade {
    display: none;
  }
  .form-control, .form-select {
    font-size: 0.82rem;
    padding: 7px 10px;
  }
  .btn {
    padding: 7px 12px;
    font-size: 0.82rem;
  }
}

