/**
 * Stylesheet chuyên biệt chuẩn 100% cho giao diện CapCut Web Video Editor
 * Tone màu: Đen tuyền Studio (#0e0e11, #141418), Accent Xanh Neon CapCut (#00d26a), Tím CapCut (#5b58ff)
 */

#view-capcut {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #0e0e11;
  color: #f4f4f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
}

#view-capcut.active {
  display: flex;
  flex-direction: column;
}

/* ========================================================================== */
/* 1. HEADER CAPCUT                                                          */
/* ========================================================================== */
.cc-header {
  height: 48px;
  background-color: #121215;
  border-bottom: 1px solid #232328;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

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

.cc-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.cc-project-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #27272f;
  font-size: 12px;
  color: #e4e4e7;
}

.cc-menu-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cc-menu-nav span {
  font-size: 12px;
  color: #a1a1aa;
  cursor: pointer;
  transition: color 0.15s ease;
}

.cc-menu-nav span:hover {
  color: #ffffff;
}

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

.cc-switch-theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1c1c22;
  border: 1px solid #2e2e38;
  color: #a1a1aa;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.cc-switch-theme-btn:hover {
  color: #ffffff;
  border-color: #00d26a;
}

.cc-btn-export {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #00d26a 0%, #00b85c 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 18px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 210, 106, 0.35);
  transition: opacity 0.15s ease;
}

.cc-btn-export:hover {
  opacity: 0.92;
}

.cc-btn-panic {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

/* ========================================================================== */
/* 2. WORKSPACE CAPCUT: TRÊN (SIDEBAR + MEDIA + PREVIEW)                     */
/* ========================================================================== */
.cc-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.cc-workspace-top {
  flex: 1;
  display: flex;
  border-bottom: 1px solid #232328;
  min-height: 0;
  overflow: hidden;
}

/* CỘT CÔNG CỤ DỌC TRÁI CAPCUT (64px) */
.cc-left-sidebar {
  width: 64px;
  background-color: #121215;
  border-right: 1px solid #232328;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 6px;
  flex-shrink: 0;
}

.cc-nav-item {
  width: 54px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #8e8e93;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cc-nav-item span {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

.cc-nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.cc-nav-item.active {
  color: #00d26a;
  background: rgba(0, 210, 106, 0.1);
  font-weight: 600;
}

/* NGĂN KÉO MEDIA POOL CAPCUT (320px) */
.cc-media-panel {
  width: 320px;
  background-color: #18181c;
  border-right: 1px solid #232328;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.cc-media-tabs {
  display: flex;
  border-bottom: 1px solid #232328;
  background: #141418;
}

.cc-media-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 11px;
  font-weight: 600;
  color: #8e8e93;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.cc-media-tab.active {
  color: #ffffff;
  border-bottom-color: #00d26a;
  background: rgba(255, 255, 255, 0.02);
}

.cc-search-box-wrap {
  padding: 10px;
  display: flex;
  gap: 6px;
  background: #18181c;
  border-bottom: 1px solid #232328;
}

.cc-search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.cc-search-input-wrap input {
  width: 100%;
  height: 32px;
  background: #24242c;
  border: 1px solid #33333d;
  border-radius: 6px;
  padding: 0 10px 0 30px;
  font-size: 11px;
  color: #ffffff;
  outline: none;
}

.cc-search-input-wrap input:focus {
  border-color: #00d26a;
}

.cc-search-icon {
  position: absolute;
  left: 8px;
  pointer-events: none;
  fill: #71717a;
}

.cc-search-btn {
  height: 32px;
  padding: 0 12px;
  background: #00d26a;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

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

.cc-asset-card {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: #222228;
  border: 1px solid #2d2d35;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cc-asset-card:hover {
  background: #2b2b34;
  border-color: #00d26a;
}

.cc-asset-thumb-box {
  width: 90px;
  height: 52px;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}

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

.cc-asset-badge-dur {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 9px;
  font-family: monospace;
  padding: 1px 4px;
  border-radius: 2px;
}

.cc-asset-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.cc-asset-meta .cc-filename {
  font-size: 11px;
  font-weight: 700;
  color: #00d26a;
  font-family: monospace;
  margin-bottom: 2px;
}

.cc-asset-meta .cc-title {
  font-size: 11px;
  color: #e4e4e7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

/* KHUNG PREVIEW CHÍNH CAPCUT */
.cc-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #08080a;
  min-height: 0;
  overflow: hidden;
}

.cc-preview-topbar {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #121215;
  border-bottom: 1px solid #232328;
  font-size: 11px;
  color: #8e8e93;
  flex-shrink: 0;
}

/* Nút phóng to / thu nhỏ toàn màn hình CapCut */
.cc-preview-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #d4d4d8;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cc-preview-tool-btn:hover {
  background: rgba(0, 210, 106, 0.15);
  border-color: #00d26a;
  color: #00d26a;
}

.cc-preview-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  position: relative;
  background: radial-gradient(circle at center, #181820 0%, #08080a 100%);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.cc-screen-frame {
  height: 100%;
  max-height: 100%;
  width: auto;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background-color: #000000;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.9), 0 0 0 1px #2a2a32;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

/* TRẠNG THÁI PHÓNG TO TOÀN MÀN HÌNH (FULLSCREEN ACTIVE) */
.cc-screen-frame.fullscreen-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  z-index: 999999 !important;
  background: #000000 !important;
  box-shadow: none !important;
}

/* Nút nổi thu nhỏ lại khi đang toàn màn hình */
.cc-fs-exit-overlay-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 30;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.cc-fs-exit-overlay-btn:hover {
  background: rgba(220, 38, 38, 0.85);
  border-color: #ef4444;
}

.cc-screen-frame.fullscreen-active .cc-fs-exit-overlay-btn {
  display: inline-flex;
}

.cc-player-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000000;
}

.cc-player-iframe iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

.cc-stealth-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  background: transparent;
  cursor: pointer;
}

/* ========================================================================== */
/* LỚP PHỦ TẢI (LOADING) VÀ THÔNG BÁO LỖI (ERROR) CAPCUT                    */
/* ========================================================================== */
.cc-player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  box-sizing: border-box;
}

.cc-loading-overlay {
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cc-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(34, 211, 238, 0.2);
  border-top-color: #22d3ee;
  border-right-color: #00d26a;
  border-radius: 50%;
  animation: ccSpin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes ccSpin {
  to { transform: rotate(360deg); }
}

.cc-loading-text {
  font-size: 13px;
  font-weight: 500;
  color: #e4e4e7;
  letter-spacing: 0.5px;
}

.cc-error-overlay {
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.cc-error-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.cc-error-title {
  font-size: 15px;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 6px;
}

.cc-error-desc {
  font-size: 12px;
  color: #d1d5db;
  max-width: 320px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.cc-error-btn {
  padding: 6px 18px;
  background: #27272a;
  color: #ffffff;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cc-error-btn:hover {
  background: #3f3f46;
  border-color: #00d26a;
  color: #00d26a;
}

/* ========================================================================== */
/* 3. WORKSPACE CAPCUT: DƯỚI (INSPECTOR GỌN + TIMELINE CAPCUT TRACKS)         */
/* ========================================================================== */
.cc-workspace-bottom {
  height: 200px;
  min-height: 200px;
  max-height: 200px;
  flex-shrink: 0;
  display: flex;
  background-color: #121216;
  border-top: 1px solid #232328;
  overflow: hidden;
}

/* BẢNG ĐIỀU KHIỂN INSPECTOR GỌN TRÁI */
.cc-inspector-panel {
  width: 270px;
  background-color: #18181c;
  border-right: 1px solid #232328;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.cc-inspector-header {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #141418;
  border-bottom: 1px solid #232328;
  font-size: 11px;
  font-weight: 700;
  color: #f4f4f5;
  flex-shrink: 0;
}

.cc-inspector-body {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cc-ctrl-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #a1a1aa;
}

.cc-ctrl-label span:last-child {
  font-family: monospace;
  color: #00d26a;
}

.cc-slider {
  width: 100%;
  height: 4px;
  accent-color: #00d26a;
  cursor: pointer;
}

/* TIMELINE CAPCUT */
.cc-timeline-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #121216;
  overflow: hidden;
  position: relative;
}

/* THANH CÔNG CỤ PHỤ CAPCUT (DAO LAM, THÙNG RÁC, TÁCH ÂM THANH) */
.cc-timeline-toolbar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #18181c;
  border-bottom: 1px solid #232328;
  flex-shrink: 0;
}

.cc-transport-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cc-btn-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #00d26a;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cc-timecode-box {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  background: #000000;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #2e2e38;
}

.cc-timecode-box .curr {
  color: #00d26a;
}

/* CÁC NÚT TÁCH DAO LAM CAPCUT */
.cc-subtools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cc-subtool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #a1a1aa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.cc-subtool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* RÃNH TRACKS CAPCUT */
.cc-timeline-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: crosshair;
}

/* THƯỚC ĐO THỜI GIAN CAPCUT (DYNAMIC RULER) */
.cc-ruler {
  height: 22px;
  background: #111114;
  border-bottom: 1px solid #232328;
  position: relative;
  display: block;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 9px;
  color: #71717a;
  flex-shrink: 0;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

/* Từng vạch mốc thời gian trên thước đo */
.cc-ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 2px;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
}

/* Vạch kẻ chỉ số ở đáy thước */
.cc-ruler-tick::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 1px;
  height: 5px;
  background: #27272a;
}

/* Mốc thời gian chính (có kèm nhãn chữ) */
.cc-ruler-tick.major::after {
  height: 8px;
  background: #52525b;
}

/* Vạch phụ nhỏ (không kèm nhãn chữ) */
.cc-ruler-tick.minor {
  padding: 0;
}
.cc-ruler-tick.minor::after {
  height: 4px;
  background: #27272a;
}

/* Canh lề cho mốc đầu tiên ở sát góc trái */
.cc-ruler-tick:first-child {
  transform: translateX(0);
  padding-left: 4px;
}
.cc-ruler-tick:first-child::after {
  left: 0;
}

/* Canh lề cho mốc cuối cùng ở sát góc phải */
.cc-ruler-tick:last-child {
  transform: translateX(-100%);
  padding-right: 4px;
}
.cc-ruler-tick:last-child::after {
  left: 100%;
}

/* Nhãn hiển thị chuỗi thời gian mm:ss hoặc hh:mm:ss */
.cc-ruler-label {
  font-size: 9px;
  line-height: 1;
  color: #82828e;
  letter-spacing: -0.2px;
  font-weight: 500;
}

.cc-tracks-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
  position: relative;
}

.cc-track-row {
  height: 38px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  position: relative;
}

.cc-track-tag {
  width: 50px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: monospace;
  border-right: 1px solid #232328;
  background: #18181c;
  color: #a1a1aa;
  flex-shrink: 0;
}

.cc-track-body {
  flex: 1;
  height: 100%;
  position: relative;
}

.cc-clip-video {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 100%;
  background: linear-gradient(135deg, #5b58ff 0%, #7952f5 100%);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.cc-clip-audio {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 100%;
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  border-radius: 4px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.cc-playhead-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 2px;
  background-color: #00d26a;
  z-index: 20;
  pointer-events: none;
}

.cc-playhead-head {
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 12px;
  background-color: #00d26a;
  clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
  pointer-events: none;
}

/* BẢNG THÔNG BÁO NHANH PHÍM TẮT VIDEO (HUD TOAST: SPACE, <, >) */
.video-action-hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(18, 18, 22, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.5px;
}

.video-action-hud.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

