/* ==========================================================================
   FIGMA MOBILE PROTOTYPE STUDIO (#view-figma)
   Giao diện ngụy trang phần mềm thiết kế UI/UX đồ họa Figma Canvas
   Mô phỏng Artboard iPhone 15 Pro phát video ngắn YouTube Shorts / Reels 9:16
   ========================================================================== */

#view-figma {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background-color: #1e1e1e;
  color: #e0e0e0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ==========================================================================
   1. FIGMA TOP NAVIGATION & TOOLBAR (HEADER)
   ========================================================================== */
.figma-header {
  height: 48px;
  background-color: #2c2c2c;
  border-bottom: 1px solid #383838;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 60;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

/* Logo Figma 5 màu chuẩn */
.figma-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.figma-logo-wrap:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Breadcrumb tên file dự án */
.figma-file-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.figma-project-folder {
  color: #8c8c8c;
  font-weight: 500;
}

.figma-breadcrumb-divider {
  color: #555555;
  font-size: 11px;
}

.figma-file-name {
  color: #ffffff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.figma-save-badge {
  background: rgba(13, 153, 255, 0.15);
  color: #0d99ff;
  border: 1px solid rgba(13, 153, 255, 0.3);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Toolbar trung tâm các công cụ thiết kế Figma (V, F, R, P, T, H, C) */
.figma-tools-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #242424;
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 2px;
}

.figma-tool-item {
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b3b3b3;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
}

.figma-tool-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.figma-tool-item.active {
  background: #0d99ff;
  color: #ffffff;
}

.figma-tool-item svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Header bên phải: Cộng tác viên, Chuyển đổi giao diện, Share, Present, Boss Key */
.figma-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Avatar cộng tác viên live */
.figma-collab-avatars {
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.figma-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #2c2c2c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  margin-left: -6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.figma-avatar:first-child {
  margin-left: 0;
}

.figma-avatar.av-1 { background: #f24e1e; }
.figma-avatar.av-2 { background: #a259ff; }
.figma-avatar.av-3 { background: #0acf83; }

/* Nút tiện ích Figma */
.figma-btn-action {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid #383838;
  background: #383838;
  color: #ffffff;
  transition: all 0.15s ease;
}

.figma-btn-action:hover {
  background: #444444;
  border-color: #555555;
}

.figma-btn-share {
  background: #0d99ff;
  border-color: #0d99ff;
  color: #ffffff;
}

.figma-btn-share:hover {
  background: #007be5;
  border-color: #007be5;
}

.figma-btn-present {
  background: #0acf83;
  border-color: #0acf83;
  color: #ffffff;
}

.figma-btn-present:hover {
  background: #09b874;
}

.figma-btn-panic {
  background: #c5221f;
  border-color: #c5221f;
  color: #ffffff;
}

.figma-btn-panic:hover {
  background: #d93025;
}

/* ==========================================================================
   2. FIGMA WORKSPACE: 3 PANELS (LAYERS | CANVAS | INSPECTOR)
   ========================================================================== */
.figma-workspace {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* ==========================================================================
   A. CỘT TRÁI: LAYERS & ASSETS PANEL
   ========================================================================== */
.figma-layers-panel {
  background-color: #2c2c2c;
  border-right: 1px solid #383838;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.figma-panel-tabs {
  display: flex;
  border-bottom: 1px solid #383838;
  background: #242424;
}

.figma-tab-btn {
  flex: 1;
  padding: 9px 0;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: #8c8c8c;
  background: transparent;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.figma-tab-btn:hover {
  color: #ffffff;
}

.figma-tab-btn.active {
  color: #ffffff;
  border-bottom-color: #0d99ff;
}

/* Ô tìm kiếm Layer / Shorts */
.figma-search-layers {
  padding: 8px 10px;
  border-bottom: 1px solid #383838;
  display: flex;
  gap: 6px;
}

.figma-search-input {
  flex: 1;
  background: #1e1e1e;
  border: 1px solid #383838;
  border-radius: 4px;
  color: #ffffff;
  font-size: 11px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s ease;
}

.figma-search-input:focus {
  border-color: #0d99ff;
}

.figma-search-btn {
  background: #383838;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  padding: 0 8px;
  font-size: 11px;
}

.figma-search-btn:hover {
  background: #444;
}

/* Danh mục Filter tags nhanh */
.figma-filter-tags {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  overflow-x: auto;
  border-bottom: 1px solid #383838;
  scrollbar-width: none;
}

.figma-tag-chip {
  background: #242424;
  border: 1px solid #383838;
  color: #a0a0a0;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.figma-tag-chip:hover {
  background: #383838;
  color: #ffffff;
}

.figma-tag-chip.active {
  background: rgba(13, 153, 255, 0.2);
  border-color: #0d99ff;
  color: #0d99ff;
  font-weight: 600;
}

/* Danh sách cây layer (Layers Treeview) */
.figma-layers-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.figma-layers-tree::-webkit-scrollbar {
  width: 5px;
}

.figma-layers-tree::-webkit-scrollbar-thumb {
  background: #383838;
  border-radius: 3px;
}

.figma-layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: #cccccc;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.figma-layer-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.figma-layer-item.active {
  background: rgba(13, 153, 255, 0.2);
  color: #ffffff;
  font-weight: 500;
  border-left: 2px solid #0d99ff;
}

.figma-layer-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #a259ff;
}

.figma-layer-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.figma-layer-badge {
  font-size: 9px;
  color: #888;
  background: #242424;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Nút tải thêm component / video */
.figma-btn-load-more {
  margin: 8px;
  padding: 7px;
  background: #242424;
  border: 1px dashed #444444;
  color: #8c8c8c;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.figma-btn-load-more:hover {
  border-color: #0d99ff;
  color: #0d99ff;
  background: rgba(13, 153, 255, 0.05);
}

/* ==========================================================================
   B. KHU VỰC TRUNG TÂM: FIGMA INFINITE CANVAS
   ========================================================================== */
.figma-canvas-stage {
  position: relative;
  background-color: #1e1e1e;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Thẻ tên Frame Figma trên đầu Artboard */
.figma-frame-header-tag {
  position: absolute;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(36, 36, 36, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid #383838;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  color: #a259ff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10;
}

.figma-frame-header-tag .dim-size {
  color: #888888;
  font-weight: 400;
}

/* Khung Artboard iPhone 15 Pro tinh xảo */
.figma-artboard-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.figma-phone-frame {
  position: relative;
  width: 380px;
  height: 760px;
  max-height: calc(100vh - 110px);
  aspect-ratio: 9 / 16;
  background-color: #000000;
  border-radius: 44px;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 25px 70px -10px rgba(0, 0, 0, 0.7),
    0 10px 25px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  border: 8px solid #2b2b2b;
}

/* Dynamic Island trên đỉnh thu gọn tinh xảo */
.figma-dynamic-island {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 18px;
  background: #000000;
  border-radius: 14px;
  z-index: 40;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  pointer-events: none;
}

.figma-camera-lens {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0f1924;
  border: 1px solid #1c2738;
}

.figma-sensor-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #111a24;
}

/* Thanh Status bar iOS mỏng trong suốt không che video */
.figma-ios-status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  z-index: 30;
  pointer-events: none;
  opacity: 0.85;
}

.figma-ios-status-bar .status-icons {
  display: flex;
  gap: 5px;
  font-size: 10px;
}

/* Viewport phát video Shorts 9:16 */
.figma-video-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000000;
}

.figma-video-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
}

/* Lớp kính bắt tương tác vuốt / lướt chuột */
.figma-touch-gesture-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  cursor: grab;
}

.figma-touch-gesture-layer:active {
  cursor: grabbing;
}

/* Ẩn hoàn toàn overlay text và các nút Like/Chat/Share đè lên màn hình điện thoại */
.figma-video-overlay-info {
  display: none !important;
}

.figma-mockup-actions {
  display: none !important;
}

.figma-mockup-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.figma-mockup-action-btn svg {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

/* Vạch Home Indicator ở đáy iPhone */
.figma-home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  z-index: 30;
  pointer-events: none;
}

/* Loading spinner */
.figma-screen-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
}

.figma-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(13, 153, 255, 0.2);
  border-top-color: #0d99ff;
  border-radius: 50%;
  animation: figmaSpin 0.7s linear infinite;
}

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

/* ==========================================================================
   C. CỘT PHẢI: FIGMA DESIGN & PROTOTYPE INSPECTOR
   ========================================================================== */
.figma-inspector-panel {
  background-color: #2c2c2c;
  border-left: 1px solid #383838;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-size: 11px;
}

.figma-inspector-panel::-webkit-scrollbar {
  width: 5px;
}

.figma-inspector-panel::-webkit-scrollbar-thumb {
  background: #383838;
  border-radius: 3px;
}

.figma-inspect-section {
  padding: 12px 14px;
  border-bottom: 1px solid #383838;
}

.figma-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.figma-prop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.figma-prop-field {
  display: flex;
  align-items: center;
  background: #1e1e1e;
  border: 1px solid #383838;
  border-radius: 4px;
  padding: 4px 8px;
  gap: 6px;
}

.figma-prop-label {
  color: #777777;
  font-weight: 600;
  font-size: 10px;
}

.figma-prop-val {
  color: #dddddd;
  font-weight: 500;
}

/* Phần điều khiển phát video (Shorts Interaction) */
.figma-nav-controls {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.figma-nav-btn {
  flex: 1;
  padding: 8px;
  background: #383838;
  border: 1px solid #444444;
  border-radius: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.figma-nav-btn:hover {
  background: #0d99ff;
  border-color: #0d99ff;
}

/* Thanh âm lượng & Mute */
.figma-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.figma-volume-slider {
  flex: 1;
  accent-color: #0d99ff;
  height: 4px;
  cursor: pointer;
}

/* Hướng dẫn tương tác Prototype */
.figma-prototype-tip {
  background: #242424;
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  color: #999999;
  line-height: 1.5;
}

.figma-prototype-tip b {
  color: #0d99ff;
}

/* Nút chuyển đổi sang Android Emulator / CapCut */
.figma-switch-theme-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.figma-switch-btn {
  padding: 8px 12px;
  background: #242424;
  border: 1px solid #383838;
  border-radius: 6px;
  color: #cccccc;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.figma-switch-btn:hover {
  background: #383838;
  color: #ffffff;
  border-color: #555555;
}

/* Responsive nhỏ hơn màn hình desktop lớn */
@media (max-width: 1100px) {
  .figma-workspace {
    grid-template-columns: 220px 1fr 240px;
  }
}

@media (max-width: 900px) {
  .figma-workspace {
    grid-template-columns: 1fr;
  }
  .figma-layers-panel,
  .figma-inspector-panel {
    display: none;
  }
}
