/* ============================================
   图片编辑器样式 - 优化版
   ============================================ */

/* 查看尺寸按钮 */
.image-edit-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.image-edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

/* ============================================
   模态框容器（缩小版）
   ============================================ */
.image-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-container {
    position: relative;
    max-width: 900px;  /* 从1200px缩小到900px */
    width: 85%;
    max-height: 85vh;  /* 从90vh缩小到85vh */
    margin: 7.5vh auto; /* 居中 */
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 35px;
    height: 35px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    color: #333;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

/* ============================================
   缩略图导航（右上角）
   ============================================ */
.thumbnail-nav-top {
    /*position: absolute;*/
    top: 12px;
    right: 60px; /* 在关闭按钮左边 */
    display: flex;
    gap: 8px;
    z-index: 15;
    padding: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.thumbnail-item {
    position: relative;
    width: 50px;  /* 缩小尺寸 */
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.thumbnail-item:hover {
    border-color: #4a90e2;
    transform: scale(1.08);
}

.thumbnail-item.active {
    border-color: #667eea;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

/* ============================================
   模态框内容布局
   ============================================ */
.modal-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding-top: 10px; /* 为右上角缩略图留空间 */
}

.preview-section {
    flex: 1;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.control-panel {
    width: 280px;  /* 从350px缩小到280px */
    padding: 20px;
    background: white;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
}

.section-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* ============================================
   刻度尺容器
   ============================================ */
.ruler-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 刻度尺 - 只有上边和左边 */
.ruler-top,
.ruler-left {
    position: absolute;
    background: #e8e8e8;
    display: flex;
    align-items: center;
    z-index: 10;
}

.ruler-top {
    left: 30px;
    right: 0;
    top: 0;
    height: 30px;
    border-radius: 8px 8px 0 0;
}

.ruler-left {
    left: 0;
    top: 30px;
    bottom: 0;
    width: 30px;
    border-radius: 8px 0 0 0;
}

.ruler-mark {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 🎯 最后一个刻度特殊处理 */
.ruler-mark-last {
    position: absolute !important;
}

.ruler-top .ruler-mark,
.ruler-bottom .ruler-mark {
    flex-direction: column;
}

.ruler-left .ruler-mark,
.ruler-right .ruler-mark {
    flex-direction: row;
}

.ruler-tick {
    background: #555;
}

.ruler-top .ruler-tick,
.ruler-bottom .ruler-tick {
    width: 2px;
    height: 8px;
}

.ruler-left .ruler-tick,
.ruler-right .ruler-tick {
    width: 8px;
    height: 2px;
}

.ruler-label {
    font-size: 9px;
    color: #666;
    font-weight: 500;
    margin: 2px;
}

/* ============================================
   Pattern 显示区域（精准控制 - 不超出刻度尺）
   ============================================ */
.pattern-display {
    position: absolute;
    top: 30px;
    left: 30px;
    right: 0;
    bottom: 0;
    background: white;
    overflow: hidden;
    border: 1px solid #ddd;
}

.pattern-tile {
    box-sizing: border-box;
}

/* ============================================
   控制面板
   ============================================ */
.control-group {
    margin-bottom: 18px;
}

.control-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.current-image-name {
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 12px;
    color: #666;
    border-left: 3px solid #667eea;
    word-break: break-all;
}

/* 刻度按钮 */
.scale-buttons {
    display: flex;
    gap: 6px;
}

.scale-btn {
    flex: 1;
    padding: 8px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.scale-btn:hover {
    background: #e8e8e8;
    border-color: #4a90e2;
}

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

/* 尺寸输入 */
.size-inputs {
    display: flex;
    gap: 10px;
}

.input-wrapper {
    flex: 1;
}

.input-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    color: #666;
}

.input-wrapper input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    transition: all 0.3s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 滑块 */
.slider-container {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.slider-value {
    font-weight: 600;
    color: #667eea;
}

.size-slider {
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.3s;
}

.size-slider::-webkit-slider-thumb:hover {
    background: #764ba2;
    transform: scale(1.15);
}

.size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

/* 平铺信息 */
.tile-info {
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8eaf6 100%);
    border-left: 3px solid #667eea;
    border-radius: 5px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.info-value {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
}

/* 保存按钮 */
.btn-save {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .modal-container {
        width: 90%;
    }
    
    .control-panel {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .modal-content {
        flex-direction: column;
    }
    
    .preview-section {
        padding: 15px;
    }
    
    .control-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e0e0e0;
        padding: 15px;
    }
    
    .thumbnail-navigation-top {
        position: static;
        margin: 10px;
        justify-content: center;
    }
    
    .size-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .scale-buttons {
        flex-direction: column;
    }
}