/**
 * 图片裁剪工具样式 - 现代简约风格
 */

/* 全局样式 */
.image-cropper-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    color: #333;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.image-cropper-container * {
    box-sizing: border-box;
}

/* 布局 */
.image-cropper-main {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    align-items: stretch; /* 确保子元素拉伸到相同高度 */
}

.image-cropper-header {
    text-align: center;
    margin-bottom: 20px; /* 减少顶部间距 */
    padding-bottom: 15px; /* 减少底部间距 */
    border-bottom: 1px solid #f0f0f0;
}

.image-cropper-header h2 {
    font-size: 24px; /* 减小标题大小 */
    font-weight: 600;
    color: #333;
    margin-bottom: 8px; /* 减少底部间距 */
}

.image-cropper-description {
    font-size: 14px; /* 减小描述文字大小 */
    color: #666;
    max-width: 800px;
    margin: 0 auto;
}

/* 控制面板 - 现在放在左边 */
.image-cropper-controls {
    flex: 1;
    min-width: 280px;
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: auto; /* 高度自适应内容 */
    overflow-y: visible; /* 不使用滚动条 */
    order: 1; /* 放在左边 */
}

/* 主画布区域 - 现在放在右边 */
.image-cropper-canvas-container {
    flex: 2;
    min-width: 300px;
    position: relative;
    background-color: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    order: 2; /* 放在右边 */
}

.image-cropper-canvas {
    width: 100%;
    height: 500px; /* 稍微减小高度 */
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-cropper-canvas img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* 上传区域 */
.image-cropper-upload {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    border: 2px dashed #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.image-cropper-upload:hover {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.05);
}

.image-cropper-upload.drag-over {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: #6366f1;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.image-cropper-upload:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.upload-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 5px;
}

.upload-formats {
    font-size: 14px;
    color: #888;
    margin-top: 5px;
    margin-bottom: 15px;
}

.upload-paste {
    font-size: 14px;
    color: #888;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

/* 控制组 */
.control-group {
    margin-bottom: 12px; /* 减少底部间距 */
    padding-bottom: 12px; /* 减少底部间距 */
    border-bottom: 1px solid #eee;
}

.control-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.control-group h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
}

.control-group h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background-color: #6366f1;
    margin-right: 8px;
    border-radius: 2px;
}

/* 尺寸输入区域 - 一行显示 */
.size-inputs-container {
    width: 100%;
}

.size-inputs {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    width: 100%;
}

.size-inputs .input-group {
    flex: 1;
    margin: 0;
}

/* 锁定宽高比 - 布局优化 */
.lock-ratio {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-left: 5px;
}

.lock-ratio label {
    font-size: 13px;
    margin-left: 3px;
}

/* 输出设置 - 一行显示 */
.output-settings {
    display: flex;
    flex-wrap: nowrap; /* 不换行 */
    align-items: center;
    gap: 10px;
    width: 100%;
}

.output-settings .input-group {
    margin: 0;
    flex: 1;
    min-width: 0; /* 允许元素收缩 */
}

#quality-control {
    flex: 2;
}

/* 输入组样式调整 - 更紧凑 */
.input-group {
    margin-bottom: 5px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    background-color: #fff;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group input[type="checkbox"] {
    flex: 0;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: #6366f1;
}

.input-group input[type="range"] {
    flex: 2;
    height: 6px;
    -webkit-appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.unit {
    margin-left: 8px;
    color: #6b7280;
    font-size: 14px;
}

/* 宽高比按钮组调整 */
.aspect-ratio-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
}

.image-cropper-aspect-ratio-btn {
    flex: 1 0 calc(33.33% - 4px);
    border: 1px solid #ddd;
    background-color: #fff;
    color: #555;
    padding: 6px 5px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.image-cropper-aspect-ratio-btn:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.image-cropper-aspect-ratio-btn.active {
    background-color: #6366f1;
    color: white;
    border-color: #6366f1;
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.2);
}

/* 变换按钮组调整 */
.transform-buttons {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.transform-btn {
    flex: 1;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #555;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transform-btn svg {
    color: #4b5563;
    transition: all 0.3s ease;
}

.transform-btn:hover {
    background-color: #e5e7eb;
}

.transform-btn:hover svg {
    color: #374151;
    transform: scale(1.1);
}

/* 裁剪框样式覆盖 */
.cropper-container {
    max-width: 100%;
    font-family: inherit;
}

.cropper-view-box {
    outline: 1px solid #6366f1;
    outline-color: rgba(99, 102, 241, 0.75);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.cropper-line {
    background-color: #6366f1;
}

.cropper-point {
    width: 8px;
    height: 8px;
    background-color: #6366f1;
    opacity: 0.8;
}

.cropper-point:hover {
    opacity: 1;
}

.cropper-point.point-n,
.cropper-point.point-s,
.cropper-point.point-e,
.cropper-point.point-w {
    width: 10px;
    height: 10px;
}

.cropper-point.point-ne,
.cropper-point.point-nw,
.cropper-point.point-se,
.cropper-point.point-sw {
    width: 12px;
    height: 12px;
    opacity: 0.9;
}

/* 响应式设计调整 */
@media (max-width: 768px) {
    .image-cropper-main {
        flex-direction: column; /* 在移动端改为纵向排列 */
    }
    
    .image-cropper-canvas {
        height: 400px; /* 在移动设备上减小画布高度 */
    }
    
    .image-cropper-controls {
        order: 2; /* 移动端先显示画布，再显示控制面板 */
    }
    
    .image-cropper-canvas-container {
        order: 1; /* 移动端先显示画布，再显示控制面板 */
    }
    
    .size-inputs {
        flex-wrap: wrap;
    }
    
    .lock-ratio {
        margin-top: 5px;
        margin-left: 0;
    }
    
    .output-settings {
        flex-wrap: wrap;
    }
    
    .aspect-ratio-buttons {
        flex-wrap: wrap;
    }
    
    .transform-buttons {
        flex-wrap: wrap;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
        margin-bottom: 8px;
    }
}

/* 页脚样式 */
.image-cropper-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

/* 隐私声明 */
.privacy-notice {
    flex: 1;
    min-width: 250px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6366f1;
    font-size: 14px;
    color: #4b5563;
}

.privacy-notice p,
.keyboard-shortcuts-info p {
    display: flex;
    align-items: center;
    margin: 0;
}

.privacy-notice svg,
.keyboard-shortcuts-info svg {
    margin-right: 10px;
    color: #6366f1;
    flex-shrink: 0;
}

/* 键盘快捷键信息 */
.keyboard-shortcuts-info {
    flex: 1;
    min-width: 250px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6366f1;
    font-size: 14px;
    color: #4b5563;
}

/* 加载状态 */
.image-cropper-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.image-cropper-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    border-top-color: #6366f1;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示 */
.image-cropper-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    cursor: help;
}

.image-cropper-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #6366f1;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.image-cropper-tooltip:hover .image-cropper-tooltip-icon {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.4);
}

.image-cropper-tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #1f2937;
    color: #f3f4f6;
    text-align: center;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 13px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    line-height: 1.5;
}

.image-cropper-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.image-cropper-tooltip:hover .image-cropper-tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateY(-5px);
}

/* 操作按钮调整 */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 10px;
}

.primary-btn,
.secondary-btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.primary-btn {
    flex: 2;
    background-color: #6366f1;
    color: white;
    border: none;
}

.secondary-btn {
    flex: 1;
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
}

.primary-btn:hover {
    background-color: #4f46e5;
}

.secondary-btn:hover {
    background-color: #e5e5e5;
}

.primary-btn svg,
.secondary-btn svg {
    margin-right: 5px;
}