/* ==========================================================================
   所见即所得 (WYSIWYG) 前台可视化编辑模式样式 (Inline Editor Styles)
   ========================================================================== */

/* Top Floating Admin Toolbar */
.inline-editor-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100000;
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  font-size: 0.88rem;
  border-bottom: 2px solid #15803d;
}

body.admin-edit-mode {
  padding-top: 50px;
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #ffffff;
}

.toolbar-live-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.toolbar-hint {
  font-size: 0.8rem;
  color: #94a3b8;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.btn-toolbar-save {
  background: #15803d;
  color: #ffffff;
}
.btn-toolbar-save:hover {
  background: #166534;
}

.btn-toolbar-exit {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}
.btn-toolbar-exit:hover {
  background: rgba(255,255,255,0.25);
}

/* Editable Text Elements */
body.admin-edit-mode [contenteditable="true"],
body.admin-edit-mode .editable-text {
  cursor: text !important;
  position: relative;
  transition: background 0.2s ease, outline 0.2s ease;
  border-radius: 4px;
}

/* CRITICAL: Table Cells must keep display: table-cell */
body.admin-edit-mode td.editable-text,
body.admin-edit-mode th.editable-text,
td.editable-text,
th.editable-text {
  display: table-cell !important;
  vertical-align: middle !important;
}

body.admin-edit-mode .editable-text:hover {
  background: rgba(34, 197, 94, 0.08);
  outline: 1px dashed #22c55e !important;
}

body.admin-edit-mode .editable-text:focus {
  background: rgba(34, 197, 94, 0.12);
  outline: 2px solid #15803d !important;
  color: #0f172a !important;
}

/* CSS-Driven Universal Grey Placeholder (:empty::before) */
.editable-text:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8 !important;
  font-weight: 400 !important;
  font-style: normal;
  cursor: text;
}

/* Category Quick Switcher Badge in Edit Mode */
body.admin-edit-mode .detail-cat-badge {
  cursor: pointer;
  position: relative;
}

body.admin-edit-mode .detail-cat-badge:hover {
  outline: 1px dashed #15803d;
}

/* Image Upload Overlays in Edit Mode */
.editable-img-wrapper {
  position: relative;
  cursor: pointer;
}

.editable-img-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  z-index: 50;
  backdrop-filter: blur(2px);
  border-radius: inherit;
  transition: all 0.2s ease;
}

body.admin-edit-mode .editable-img-wrapper:hover .editable-img-overlay {
  display: flex;
}

/* Inline Action Badges on Cards */
.inline-card-controls {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 60;
  gap: 6px;
}

body.admin-edit-mode .clean-p-card {
  position: relative;
}

body.admin-edit-mode .clean-p-card:hover .inline-card-controls {
  display: flex;
}

.btn-card-edit,
.btn-card-del {
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-card-edit {
  background: #15803d;
  color: #ffffff;
}
.btn-card-del {
  background: #dc2626;
  color: #ffffff;
}

/* Add New Card Slot in Edit Mode */
.add-new-card-slot {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
  cursor: pointer;
  color: #64748b;
  transition: var(--transition);
}

.add-new-card-slot:hover {
  border-color: #15803d;
  color: #15803d;
  background: #f0fdf4;
}

.add-new-card-slot i {
  font-size: 2.2rem;
}

.add-new-card-slot span {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Detail Page Specific Visual Edit Buttons */
.detail-edit-add-btn {
  display: none;
  margin-top: 14px;
  padding: 8px 18px;
  background: #f0fdf4;
  border: 1px dashed #15803d;
  color: #15803d;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.detail-edit-add-btn:hover {
  background: #15803d;
  color: #ffffff;
}

body.admin-edit-mode .detail-edit-add-btn {
  display: inline-flex !important;
}

.detail-feature-item {
  position: relative;
  display: flex;
  align-items: center;
}

.detail-feature-del {
  display: none;
  color: #dc2626;
  cursor: pointer;
  margin-left: 10px;
  font-size: 0.85rem;
}

body.admin-edit-mode .detail-feature-item:hover .detail-feature-del {
  display: inline-block;
}

.table-row-del-btn {
  display: none;
  color: #dc2626;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

body.admin-edit-mode .std-specs-matrix tr:hover .table-row-del-btn {
  display: inline-block;
}
