/* ===========================================
   Core 通用样式
   =========================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: #0D0D0D; color: #E8E8E8; font-size: 13px;
}
input, select, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2A2A2A; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3A3A3A; }

/* --- Top Bar --- */
#topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: #141414;
  border-bottom: 0.5px solid #2A2A2A; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 28px; height: 28px; border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(0,212,255,0.3);
}
.logo-img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 6px;
}
.app-title { font-size: 14px; font-weight: 500; color: #E8E8E8; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* --- Buttons --- */
.btn-primary {
  padding: 6px 14px; font-size: 13px; border: none;
  background: linear-gradient(135deg, #00D4FF, #7B2FFF);
  border-radius: 8px; color: #0D0D0D; font-weight: 500;
  box-shadow: 0 0 16px rgba(0,212,255,0.25); transition: box-shadow 0.2s;
}
.btn-primary:hover { box-shadow: 0 0 24px rgba(0,212,255,0.4); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-secondary {
  padding: 6px 14px; font-size: 13px;
  border: 0.5px solid #3A3A3A; background: #1A1A1A;
  border-radius: 8px; color: #AAA; transition: background 0.2s;
}
.btn-secondary:hover { background: #252525; }
.btn-secondary:disabled { opacity: 0.4; cursor: default; }

/* --- Main Layout --- */
#main {
  display: flex; height: calc(100vh - 52px);
}

/* --- Module Nav (72px) --- */
#module-nav {
  width: 72px; background: #141414;
  border-right: 0.5px solid #2A2A2A;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 12px; gap: 4px; flex-shrink: 0;
}
.nav-item {
  width: 56px; height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer;
  border: 0.5px solid transparent; transition: all 0.2s;
}
.nav-item.active {
  background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.3);
}
.nav-item.active span { color: #00D4FF; font-weight: 500; }
.nav-item.disabled { opacity: 0.35; cursor: default; }
.nav-item span { font-size: 10px; color: #666; margin-top: 2px; }
.nav-item:not(.disabled):hover:not(.active) { background: rgba(255,255,255,0.03); }

/* --- Slots --- */
#slot-left {
  width: 220px; background: #1A1A1A;
  border-right: 0.5px solid #2A2A2A;
  display: flex; flex-direction: column; flex-shrink: 0;
}
#slot-center {
  flex: 1; background: #111; display: flex;
  flex-direction: column; align-items: stretch; justify-content: flex-start;
  position: relative; overflow: hidden;
}
#slot-right {
  width: 200px; background: #141414;
  border-left: 0.5px solid #2A2A2A;
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}

/* --- Panel Header --- */
.panel-header {
  padding: 12px 12px 8px; display: flex;
  align-items: center; justify-content: space-between;
}
.panel-title { font-size: 13px; font-weight: 500; color: #E8E8E8; }
.panel-actions { display: flex; align-items: center; gap: 6px; }
.panel-btn {
  background: none; border: none; color: #888; font-size: 11px;
  cursor: pointer; padding: 2px 4px; border-radius: 3px;
  transition: all 0.15s;
}
.panel-btn:hover { color: #00D4FF; background: rgba(0,212,255,0.08); }
.panel-count { font-size: 11px; color: #666; }

/* --- Props 通用 --- */
.props-header {
  padding: 16px 16px 12px;
  border-bottom: 0.5px solid #2A2A2A;
}
.props-title { font-size: 14px; font-weight: 500; color: #E8E8E8; }
.props-subtitle { font-size: 11px; color: #666; margin-top: 2px; display: block; }

.props-section {
  padding: 12px 16px;
  border-bottom: 0.5px solid #2A2A2A;
}
.props-label { font-size: 12px; color: #888; margin-bottom: 8px; }

.props-tabs { display: flex; gap: 4px; }
.tab {
  flex: 1; padding: 5px 0; font-size: 11px; text-align: center;
  background: #1A1A1A; color: #888; border-radius: 4px;
  cursor: pointer; border: 0.5px solid #2A2A2A; transition: all 0.2s;
}
.tab:hover { border-color: #3A3A3A; }
.tab.active {
  background: rgba(0,212,255,0.1); color: #00D4FF;
  border-color: rgba(0,212,255,0.3); font-weight: 500;
}

.props-field {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.field-label { font-size: 12px; color: #AAA; width: 28px; flex-shrink: 0; }

.props-field input[type="number"] {
  flex: 1; padding: 5px 8px; font-size: 12px;
  border: 0.5px solid #2A2A2A; border-radius: 4px;
  background: #1A1A1A; color: #E8E8E8; outline: none;
  text-align: center; -moz-appearance: textfield;
}
.props-field input[type="number"]:focus { border-color: #00D4FF; }
.props-field input[type="number"]::-webkit-inner-spin-button,
.props-field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}

.props-field input[type="text"] {
  flex: 1; padding: 5px 8px; font-size: 12px;
  border: 0.5px solid #2A2A2A; border-radius: 4px;
  background: #1A1A1A; color: #E8E8E8; outline: none; text-align: center;
}
.props-field input[type="text"]:focus { border-color: #00D4FF; }

.field-unit { font-size: 11px; color: #666; width: 14px; flex-shrink: 0; }

.props-field select {
  flex: 1; padding: 5px 8px; font-size: 12px;
  border: 0.5px solid #2A2A2A; border-radius: 4px;
  background: #1A1A1A; color: #E8E8E8; outline: none;
  cursor: pointer; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666' stroke-width='1.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.props-field select:focus { border-color: #00D4FF; }

.props-checkbox {
  display: flex; align-items: center; gap: 6px; cursor: pointer; margin-top: 4px;
}
.checkbox-box {
  width: 14px; height: 14px; border: 1.5px solid #2A2A2A;
  border-radius: 3px; display: flex; align-items: center; justify-content: center;
  background: #1A1A1A; transition: all 0.2s;
}
.props-checkbox.checked .checkbox-box {
  border-color: #00D4FF; background: rgba(0,212,255,0.1);
}
.props-checkbox span { font-size: 11px; color: #AAA; }

.checkbox-box svg {
  display: none;
}
.checkbox-box.checked svg,
.props-checkbox.checked .checkbox-box svg {
  display: block;
}

.props-actions {
  padding: 16px; display: flex; flex-direction: column; gap: 8px; margin-top: auto;
}
.props-actions .btn-primary { width: 100%; padding: 8px 0; }
.props-actions .btn-secondary { width: 100%; padding: 8px 0; }

/* --- Toast --- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1F1F1F; color: #E8E8E8; font-size: 13px;
  padding: 8px 16px; border-radius: 8px;
  border: 0.5px solid #2A2A2A;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 1000; transition: opacity 0.3s;
}
#toast.hidden { opacity: 0; pointer-events: none; }

/* --- Modal --- */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
#modal-overlay[hidden] { display: none; }
#modal-overlay.hidden { display: none; }
#modal {
  background: #1A1A1A; border-radius: 12px;
  border: 0.5px solid #2A2A2A;
  padding: 24px; min-width: 360px; max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
#modal-title { font-size: 15px; font-weight: 500; color: #E8E8E8; margin-bottom: 12px; }
#modal-body { font-size: 13px; color: #AAA; line-height: 1.6; margin-bottom: 16px; }
#modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
#modal-actions .btn-primary, #modal-actions .btn-secondary { padding: 6px 16px; }

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

/* ===========================================
   通用图片列表组件样式
   被多个模块共用（crop、remove-bg、atlas-packer 等）
   =========================================== */

/* 通用图片列表项 */
.img-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: #1F1F1F;
  border-radius: 8px;
  border: 0.5px solid #2A2A2A;
  cursor: pointer;
  transition: border-color 0.2s;
  margin-bottom: 6px;
  position: relative;
}

.img-list-item:hover { border-color: #3A3A3A; }

.img-list-item.active {
  border-color: #00D4FF;
  box-shadow: 0 0 0 1px rgba(0,212,255,0.3), 0 0 16px rgba(0,212,255,0.08);
}

.img-list-item.selected .img-checkbox {
  background: #00D4FF;
  border-color: #00D4FF;
  box-shadow: 0 0 8px rgba(0,212,255,0.4);
}

/* 通用缩略图 */
.img-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: #252525;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* 通用信息区域 */
.img-info {
  flex: 1;
  min-width: 0;
}

.img-name {
  font-size: 11px;
  color: #E8E8E8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.img-size {
  font-size: 10px;
  color: #666;
}

/* 通用复选框 */
.img-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #3A3A3A;
  transition: all 0.2s;
  cursor: pointer;
}

.img-checkbox:hover { border-color: #555; }

/* 通用删除按钮 */
.img-delete-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FF4444;
  border: 1.5px solid #1A1A1A;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.15s;
  z-index: 2;
  padding: 0;
}

.img-delete-btn:hover {
  transform: scale(1.1);
  background: #FF6666;
}

.img-list-item:hover .img-delete-btn {
  opacity: 1;
}

/* --- FFmpeg Loading Overlay --- */
#ffmpeg-loading {
  position: fixed; inset: 0; background: rgba(0,0,0,0.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 3000; gap: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#ffmpeg-loading.hidden { display: none; }
#ffmpeg-loading .spinner {
  width: 40px; height: 40px;
  border: 3px solid #2A2A2A; border-top-color: #00D4FF;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  box-shadow: 0 0 16px rgba(0,212,255,0.25);
}
#ffmpeg-loading-text {
  color: #E8E8E8; font-size: 14px; font-weight: 400;
  max-width: 320px; text-align: center; line-height: 1.5;
}
