/* ==========================================================================
   AdPulse Admin — Vue 3 + Ant Design Vue 4 (Vben Admin 5.x Full Edition)
   ========================================================================== */

:root {
  --vben-bg-layout: #f0f2f5;
  --vben-bg-card: #ffffff;
  --vben-bg-header: #ffffff;
  --vben-border: #e5e7eb;
  --vben-text-main: #1f2937;
  --vben-text-secondary: #6b7280;
  --vben-primary: #1677ff;
}

body.theme-dark {
  --vben-bg-layout: #0a0a0a;
  --vben-bg-card: #141414;
  --vben-bg-header: #141414;
  --vben-border: #2e2e2e;
  --vben-text-main: #f3f4f6;
  --vben-text-secondary: #9ca3af;
  --vben-primary: #1677ff;
}

body {
  margin: 0;
  padding: 0;
  background: var(--vben-bg-layout);
  color: var(--vben-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

/* Vben 分栏式登录页 */
.vben-login-page {
  min-height: 100vh;
  display: flex;
  background: var(--vben-bg-card);
}

.vben-login-banner {
  flex: 1.15;
  background: linear-gradient(145deg, #001529 0%, #06284f 52%, #0960bd 100%);
  color: #ffffff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.vben-login-banner::after {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 119, 255, 0.3) 0%, transparent 70%);
  top: -120px;
  right: -120px;
}

.vben-login-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--vben-bg-card);
}

@media (max-width: 960px) {
  .vben-login-banner {
    display: none;
  }
}

/* Vben 顶栏与多标签页栏 */
.vben-sider-logo {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  white-space: nowrap;
}

.vben-logo-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1677ff 0%, #36cfc9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}

.vben-logo-title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.vben-top-header {
  height: 48px !important;
  line-height: 48px !important;
  padding: 0 16px !important;
  background: var(--vben-bg-header) !important;
  border-bottom: 1px solid var(--vben-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.vben-multi-tabs {
  height: 38px;
  background: var(--vben-bg-header);
  border-bottom: 1px solid var(--vben-border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 48px;
  z-index: 99;
  box-shadow: 0 1px 3px rgba(0, 21, 41, 0.04);
}

.vben-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--vben-border);
  color: var(--vben-text-secondary);
  cursor: pointer;
  margin-right: 6px;
  transition: all 0.15s;
  user-select: none;
}

.vben-tab-pill:hover {
  color: var(--vben-primary);
  border-color: var(--vben-primary);
}

.vben-tab-pill.active {
  background: var(--vben-primary);
  color: #ffffff;
  border-color: var(--vben-primary);
  font-weight: 500;
}

/* Vben PageWrapper 页头 */
.vben-page-header {
  background: var(--vben-bg-card);
  border-bottom: 1px solid var(--vben-border);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vben-page-body {
  padding: 16px;
}

/* Vben GrowCard 指标卡 */
.vben-grow-card .ant-card-head {
  min-height: 40px;
  padding: 0 16px;
  font-size: 13px;
}

.vben-grow-card .ant-card-body {
  padding: 14px 16px;
}

.vben-grow-footer {
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--vben-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--vben-text-secondary);
}

/* 移动端 H5 手机真机仿真预览器 */
.phone-preview-stage {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-mockup {
  background: #050811;
  border: 10px solid #1e293b;
  border-radius: 42px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: width 0.2s ease, height 0.2s ease;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.phone-status-bar {
  height: 30px;
  background: #0b0f19;
  color: #e2e8f0;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  position: relative;
  user-select: none;
}

.phone-dynamic-island {
  width: 82px;
  height: 18px;
  background: #000000;
  border-radius: 999px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.phone-webview-bar {
  height: 36px;
  background: #111827;
  color: #f8fafc;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.phone-webview-title {
  font-weight: 600;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.phone-screen {
  width: 100%;
  height: 640px;
  border: none;
  background: #0c0b0e;
  display: block;
}

.phone-home-indicator {
  height: 18px;
  background: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-home-bar {
  width: 118px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   可视化拖拽画布工作台 (WYSIWYG Visual Studio)
   ========================================================================== */
.studio-top-bar {
  background: var(--vben-bg-card);
  border: 1px solid var(--vben-border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.palette-card {
  border: 1px solid var(--vben-border);
  border-radius: 10px;
  background: var(--vben-bg-card);
  padding: 10px;
  cursor: grab;
  transition: all 0.18s ease;
  user-select: none;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.palette-card:hover {
  border-color: #1677ff;
  box-shadow: 0 6px 16px rgba(22, 119, 255, 0.14);
  transform: translateY(-2px);
}

.palette-card:active {
  cursor: grabbing;
}

.palette-thumb {
  height: 48px;
  border-radius: 7px;
  background: var(--vben-bg-layout);
  border: 1px dashed var(--vben-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  overflow: hidden;
}

/* 手机交互画布内部块包装器 */
.wysiwyg-phone-body {
  height: 640px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  /* 为上方跳转提示与选中组件的悬浮工具栏预留空间，避免首个组件被裁切。 */
  padding: 44px 13px 86px;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

.wysiwyg-phone-body::-webkit-scrollbar {
  width: 5px;
}

.wysiwyg-phone-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.canvas-block-item {
  position: relative;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all 0.16s ease;
  cursor: pointer;
  margin-bottom: 10px;
}

.canvas-block-item:hover {
  border-color: rgba(22, 119, 255, 0.65);
}

.canvas-block-item.is-selected {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.22);
}

.canvas-block-item.is-disabled {
  opacity: 0.42;
  filter: grayscale(0.5);
}

.canvas-block-toolbar {
  position: absolute;
  top: -26px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 30;
}

.canvas-block-badge {
  background: #1677ff;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px 6px 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(22, 119, 255, 0.35);
}

.canvas-block-actions {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 1px 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.canvas-action-btn {
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
}

.canvas-action-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.canvas-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.canvas-drop-indicator {
  height: 36px;
  border: 2px dashed #38bdf8;
  background: rgba(22, 119, 255, 0.18);
  border-radius: 10px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  animation: pulseDrop 1.2s infinite;
}

@keyframes pulseDrop {
  0%, 100% { background: rgba(22, 119, 255, 0.16); }
  50% { background: rgba(22, 119, 255, 0.3); }
}

.theme-swatch-card {
  border: 2px solid var(--vben-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.theme-swatch-card.active {
  border-color: #1677ff;
  background: rgba(22, 119, 255, 0.08);
}



/* 动态页面配置：按用途找组件，明确指定插入位置。 */
.studio-palette-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--vben-border); border-radius: 10px; background: var(--vben-bg-layout); }
.studio-palette-controls label { font-size: 12px; font-weight: 600; }
.studio-category-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-category-tabs button { font: inherit; font-size: 12px; padding: 5px 9px; border: 1px solid var(--vben-border); border-radius: 6px; background: var(--vben-bg-card); color: var(--vben-text-main); cursor: pointer; }
.studio-category-tabs button.active { border-color: #1677ff; color: #1677ff; background: rgba(22,119,255,.08); }
.studio-palette-hint { font-size: 12px; line-height: 1.6; color: var(--vben-text-secondary); overflow-wrap: anywhere; }
.studio-palette-empty { text-align: center; padding: 24px 12px; color: var(--vben-text-secondary); }
.palette-card:focus-visible, .studio-category-tabs button:focus-visible { outline: 2px solid #1677ff; outline-offset: 2px; }

/* ============================================================
   组件编辑体验增强：双击就地改字 / 可点击提示
   ============================================================ */
.inline-text-editor {
  position: fixed;
  z-index: 2000;
  background: #0f172a;
  border: 1px solid #38bdf8;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  animation: inlineEditorIn 0.14s ease-out;
}

@keyframes inlineEditorIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.inline-text-editor .ant-input,
.inline-text-editor .ant-input-affix-wrapper {
  background: #1e293b !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #f8fafc !important;
  font-size: 13px !important;
}

.inline-text-editor .ant-input:focus,
.inline-text-editor .ant-input-affix-wrapper-focused {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
}

/* 可双击编辑的文本：悬停时给出明确的可用性提示 */
.canvas-block-item [title="双击直接改字"] {
  border-radius: 4px;
  transition: background 0.15s ease;
}

.canvas-block-item [title="双击直接改字"]:hover {
  background: rgba(56, 189, 248, 0.12);
  outline: 1px dashed rgba(56, 189, 248, 0.55);
}

/* 外观覆盖容器不影响原有布局 */
.block-style-wrap {
  display: block;
}
