/* css/admin.css */

body.admin-page {
    background-color: #f4f4f4;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

/* ... (Header/Container/Button styles same as before) ... */
.admin-header {
    background: #111;
    color: #fff;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.btn-text {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    margin-left: 20px;
    transition: color 0.2s;
}

.btn-text:hover {
    color: #fff;
}

.btn-text.danger:hover {
    color: #ff6b6b;
}

.admin-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.btn-primary {
    background: #111;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #333;
}

.btn-danger {
    background: transparent;
    color: #d9534f;
    border: 1px solid #d9534f;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #d9534f;
    color: #fff;
}

/* --- Sliders Specific (Fixed for visibility) --- */
/* 确保滑块容器有足够的空间 */
.range-control-group input[type=range] {
    -webkit-appearance: none;
    /* 清除默认样式 */
    appearance: none;
    width: 100%;
    height: 6px;
    /* 轨道高度 */
    background: #ddd;
    /* 轨道颜色 */
    border-radius: 3px;
    outline: none;
    margin: 10px 0;
    padding: 0;
    /* 移除 padding */
    border: none;
    /* 移除 border */
    cursor: pointer;
}

/* 滑块头 (Thumb) - WebKit (Chrome, Safari) */
.range-control-group input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #111;
    /* 滑块头颜色 */
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
    /* 增加白色描边，使其更显眼 */
    /* 垂直居中修复：(18px - 6px) / 2 = 6px，但通常不需要负 margin 如果高度对齐了 */
    /* 在 WebKit 中，thumb 是相对于 track 的 content box 定位的 */
}

/* 滑块头 (Thumb) - Firefox */
.range-control-group input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #111;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
}

/* 轨道 (Track) - Firefox 需要单独定义 */
.range-control-group input[type=range]::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

/* Focus 状态 */
.range-control-group input[type=range]:focus {
    background: #ccc;
}

/* Visual Controls Container */
.visual-controls {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.visual-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.range-val {
    font-family: 'Menlo', monospace;
    background: #fff;
    border: 1px solid #ddd;
    padding: 2px 6px;
    border-radius: 4px;
    color: #333;
    min-width: 40px;
    text-align: center;
}

/* ... (Rest of layout) ... */
.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    max-width: 400px;
    margin: 100px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.editor-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.editor-card.hidden {
    display: none;
}

.card-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.card-header:hover {
    background: #fafafa;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-info .id {
    color: #999;
    font-family: monospace;
}

.header-info .title {
    font-size: 1.1rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eee;
    color: #666;
}

.status-badge.featured {
    background: #e0f7fa;
    color: #006064;
}

.arrow {
    transition: transform 0.3s;
    color: #999;
}

.editor-card.collapsed .card-body {
    display: none;
}

.editor-card.collapsed .arrow {
    transform: rotate(-90deg);
}

.editor-card.collapsed .card-header {
    border-bottom: none;
}

.tabs-nav {
    display: flex;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    padding: 0 20px;
    gap: 20px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 15px 0;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #111;
    border-bottom-color: #111;
}

.tab-pane {
    display: none;
    padding: 30px;
}

.tab-pane.active {
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group.full {
    grid-column: span 2;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #444;
}

input,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

input:focus,
textarea:focus {
    border-color: #111;
    outline: none;
}

textarea.code-font {
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 0.85rem;
    background: #fcfcfc;
}

.hint {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    color: #999;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

.divider {
    margin: 30px 0;
    border-bottom: 1px dashed #ddd;
    text-align: center;
    height: 10px;
}

.divider span {
    background: #fff;
    padding: 0 10px;
    color: #999;
    font-size: 0.8rem;
    font-weight: 500;
}

.card-actions {
    padding: 20px 30px;
    background: #fafafa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Block Builder */
.content-block-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    cursor: grab;
}

.block-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: #667eea;
    padding: 2px 8px;
    margin-left: 8px;
    margin-right: 6px;
}

.block-type {
    font-size: 0.7rem;
    font-weight: bold;
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: auto;
    margin-left: 10px;
}

.add-block-bar {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.add-block-btn {
    flex: 1;
    padding: 10px;
    background: #fff;
    border: 1px dashed #ccc;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
}

.add-block-btn:hover {
    border-color: #333;
    color: #333;
}

/* --- 新增：删除按钮样式 --- */
.block-header button.delete-btn {
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.2s;
}

.block-header button.delete-btn:hover {
    color: #d9534f;
    /* 鼠标悬停变红色 */
}

/* --- 新增：后台图片预览样式 --- */
.block-img-preview {
    display: block;
    max-width: 100%;
    /* 宽度不超容器 */
    max-height: 200px;
    /* 高度限制在 200px 以内，防止太占地 */
    width: auto;
    height: auto;
    margin: 10px auto;
    /* 居中显示 */
    border-radius: 4px;
    border: 1px solid #eee;
    background-color: #fafafa;
    /* 图片未加载时的背景色 */
    object-fit: contain;
    /* 保证图片完整显示在框内 */
}

/* 当没有 src 时隐藏预览图框，避免显示破碎图标 */
.block-img-preview[src=""],
.block-img-preview:not([src]) {
    opacity: 0;
    height: 0;
    margin: 0;
    border: none;
}

/* Admin Styles */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin: 10px 0;
    cursor: grab;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #333;
    margin-top: -6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #ddd;
    border-radius: 2px;
}

.visual-controls {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eee;
    display: flex;
    gap: 20px;
    margin-top: 5px;
}

.visual-col {
    flex: 1;
}

.range-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
}

.range-val {
    font-family: monospace;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    color: #333;
    font-size: 0.8rem;
}

/* Block & Gallery Preview */
.preview-container {
    border: 1px solid #ddd;
    background: #fff;
    background-image: radial-gradient(#e5e5e5 1px, transparent 1px);
    background-size: 10px 10px;
    padding: 20px;
    margin-top: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
}

.preview-container.mode-left {
    justify-content: flex-start;
}

.block-img-preview {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: width 0.2s;
}

/* Subsections */
.sub-sections-container {
    border-left: 2px solid #eee;
    padding-left: 15px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sub-section-item {
    background: #fcfcfc;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 4px;
    position: relative;
}

.sub-section-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 5px;
}

.delete-section-btn {
    color: #ff6b6b;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1rem;
    line-height: 1;
}

.add-section-btn {
    font-size: 0.8rem;
    color: #007aff;
    cursor: pointer;
    background: none;
    border: 1px dashed #007aff;
    padding: 8px;
    border-radius: 4px;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s;
}

.add-section-btn:hover {
    background: #f0f8ff;
}

.add-block-bar {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.add-block-btn {
    flex: 1;
    padding: 12px;
    background: #fff;
    border: 1px dashed #ccc;
    color: #666;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-block-btn:hover {
    border-color: #333;
    color: #333;
    background: #fdfdfd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    margin-top: 10px;
}

.toggle-label input {
    width: auto;
    margin: 0;
}

/* Gallery List */
.gallery-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.gallery-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px;
    position: relative;
    cursor: grab;
}

.gallery-item:active {
    cursor: grabbing;
}

.gallery-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    background: #f5f5f5;
    margin-bottom: 8px;
    border: 1px solid #eee;
}

.gallery-controls {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.gallery-input {
    width: 100%;
    font-size: 0.8rem;
    padding: 4px;
    margin-bottom: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.del-gal-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: #ff6b6b;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Focus Picker Styles */
.focus-picker-container {
    margin: 20px 0;
}

.focus-picker {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 16 / 9;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    background: #f5f5f5;
}

.focus-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
}

.focus-crosshair {
    position: absolute;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    pointer-events: none;
    z-index: 10;
}

.crosshair-h,
.crosshair-v {
    position: absolute;
    background: rgba(255, 0, 0, 0.8);
}

.crosshair-h {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.crosshair-v {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.focus-crosshair::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 3px solid rgba(255, 0, 0, 0.8);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
}

.hero-picker {
    aspect-ratio: 16 / 9;
}

.gallery-preview-box {
    width: 100%;
    height: 120px;
}

.gallery-crop-frame {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* this is what makes crop visible */
    border-radius: 4px;
    border: 1px solid #eee;
    background: #f5f5f5;
}

.gallery-crop-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.15s, object-position 0.15s;
}


/* Cropper modal */
.crop-modal.hidden {
    display: none;
}

.crop-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.crop-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.crop-modal-dialog {
    position: relative;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    width: 80vw;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.crop-modal-header,
.crop-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.crop-modal-body {
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

#crop-image {
    max-width: 100%;
    max-height: 100%;
}

.crop-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.crop-ratio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ratio-btn {
    border: 1px solid #ddd;
    background: #f7f7f7;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

.ratio-btn.active {
    border-color: #333;
    background: #333;
    color: #fff;
}

.crop-modal.hidden {
    display: none;
}

.crop-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.crop-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.crop-modal-dialog {
    position: relative;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    width: 80vw;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.crop-modal-header,
.crop-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px;
}

.crop-modal-body {
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

#crop-image {
    max-width: 100%;
    max-height: 100%;
}

/* 比例按钮工具条 */
.crop-aspect-toolbar {
    display: inline-flex;
    gap: 4px;
}

.aspect-btn {
    border: 1px solid #ddd;
    background: #f8f8f8;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.aspect-btn.is-active {
    background: #111;
    color: #fff;
    border-color: #111;
}


@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: span 1;
    }

    .tabs-nav {
        flex-wrap: wrap;
        gap: 10px;
    }
}
/* ================================
   Visual Grid Editor
   ================================ */

.visual-grid-editor {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
}

.grid-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

.grid-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.grid-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.grid-canvas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 120px;
  gap: 12px;
  background: white;
  padding: 15px;
  border-radius: 6px;
  border: 2px dashed #ddd;
  min-height: 200px;
}

.grid-image-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  border: 2px solid #e0e0e0;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.grid-image-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.grid-item-preview {
  flex: 1;
  background-size: cover;
  background-position: center;
  background-color: #f5f5f5;
  position: relative;
  min-height: 80px;
}

.grid-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.3;
}

.grid-item-controls {
  background: rgba(255, 255, 255, 0.98);
  padding: 8px;
  border-top: 1px solid #e0e0e0;
}

.grid-input-url {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-bottom: 6px;
}

.grid-size-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
}

.grid-size-controls label {
  font-weight: 600;
  color: #666;
}

.grid-input-size {
  width: 40px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-size: 0.75rem;
}

.grid-delete-btn {
  background: #ff4757;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
  font-size: 0.85rem;
  transition: all 0.2s;
}

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


/* Drag Resize Handles (Figma-style) */
.grid-resize-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.grid-image-item:hover .grid-resize-handles,
.grid-image-item.resizing .grid-resize-handles {
  opacity: 1;
}

.resize-handle {
  position: absolute;
  pointer-events: all;
  background: #667eea;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}

.resize-handle:hover {
  background: #764ba2;
  transform: scale(1.2);
}

/* 右侧拖拽手柄（调整宽度） */
.resize-w {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 60px;
  border-radius: 6px;
  cursor: ew-resize;
}

/* 底部拖拽手柄（调整高度） */
.resize-h {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 12px;
  border-radius: 6px;
  cursor: ns-resize;
}

/* 右下角拖拽手柄（同时调整宽高） */
.resize-wh {
  right: -6px;
  bottom: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: nwse-resize;
}

/* Size badges */
.size-badge {
  display: inline-block;
  padding: 3px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 4px;
}


/* 拖拽中的视觉反馈 */
.grid-image-item.resizing {
  opacity: 0.8;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  z-index: 10;
}

.grid-image-item.resizing .resize-handle {
  background: #ff6b6b;
  transform: scale(1.3);
}

/* ================================
   Grid Table Editor (New System)
   ================================ */

.grid-table-editor {
  margin: 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
  border-radius: 12px;
  border: 2px solid #667eea30;
}

.grid-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.grid-size-controls label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

.grid-size-controls input[type="number"] {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-left: 5px;
  font-size: 0.9rem;
}

.grid-editor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 8px;
  background: white;
  padding: 10px;
  border-radius: 8px;
}

.grid-cell {
  position: relative;
  min-height: 120px;
  height: 120px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  text-align: center;
  vertical-align: middle;
}

.grid-cell:hover {
  border-color: #667eea;
  background: #f0f4ff;
  transform: scale(1.02);
}

.grid-cell.has-image {
  border-style: solid;
  border-color: #667eea;
  background: white;
}

.grid-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.cell-empty {
  font-size: 2rem;
  color: #ccc;
  display: inline-block;
  line-height: 120px;
}

.cell-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px;
  font-size: 0.7rem;
  border-radius: 0 0 6px 6px;
}

.cell-size {
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.grid-help {
  margin-top: 15px;
  padding: 10px;
  background: #fffbea;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #856404;
}

/* Modal for Cell Editor */
.cell-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cell-editor-modal.active {
  opacity: 1;
}

.cell-editor-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.cell-editor-modal.active .cell-editor-content {
  transform: translateY(0);
}

.cell-editor-content h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.3rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
  justify-content: flex-end;
}

.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #555;
}

.btn-secondary:hover {
  background: #d0d0d0;
}


/* Gallery Block Crop Button */
.crop-btn-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.gallery-item-block:hover .crop-btn-overlay {
  opacity: 1;
}

.crop-btn-overlay:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 6px 16px rgba(245, 87, 108, 0.5);
}

.drag-handle {
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.gallery-item-block:hover .drag-handle {
  opacity: 1;
}

/* ================================
   Insert Block Divider
   ================================ */

.insert-block-divider {
  position: relative;
  margin: 10px 0;
  text-align: center;
}

.insert-trigger {
  cursor: pointer;
  padding: 8px 0;
  color: #999;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  opacity: 0.5;
}

.insert-trigger:hover {
  opacity: 1;
  color: #667eea;
}

.insert-trigger span {
  position: relative;
  background: #f4f4f4;
  padding: 0 15px;
  z-index: 2;
}

.insert-trigger::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd 20%, #ddd 80%, transparent);
  z-index: 1;
}

.insert-menu {
  display: none;
  margin-top: 8px;
  padding: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.insert-menu.active {
  display: flex;
}

.insert-menu button {
  padding: 8px 16px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.insert-menu button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

/* ================================
   Block Collapse/Expand
   ================================ */

.content-block-item .block-header {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.content-block-item .block-header:hover {
  background: #f8f9fa;
}

.collapse-indicator {
  margin-left: 8px;
  font-size: 0.7rem;
  color: #999;
  transition: transform 0.2s ease;
  display: inline-block;
}

.content-block-item.collapsed .collapse-indicator {
  transform: rotate(-90deg);
}

.content-block-item .block-content {
  max-height: 5000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.content-block-item.collapsed .block-content {
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* Show block type label when collapsed */
.content-block-item.collapsed .block-type {
  font-weight: 600;
  color: #667eea;
}

/* Prevent dragging when interacting with header content */
.content-block-item .block-handle {
  cursor: grab;
}

.content-block-item .block-handle:active {
  cursor: grabbing;
}

/* ================================
   Project Sorting Styles
   ================================ */

.sort-hint {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sort-hint span {
  flex: 1;
  font-weight: 500;
}

.sort-hint button {
  margin: 0;
}

.sortable-ghost {
  opacity: 0.4;
  background: #f0f0f0;
}

.sortable-chosen {
  cursor: grabbing !important;
}

.sortable-drag {
  opacity: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
