/* 全局样式重置 */
* {
    margin: 0;
    padding: 1px;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: #333;
    line-height: 1.6;
    overflow-x: auto;
    overflow-y: hidden;
}

/* 主容器 - 水平布局：左侧导航栏(10%) + 右侧内容区(90%) */
.main-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    background: transparent;
    min-width: 1200px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

/* 侧边栏 - 占据左侧10%宽度 */
.sidebar {
    width: 10%;
    min-width: 200px;
    height: 100vh;
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}

/* 右侧内容区 - 占据90%宽度，垂直布局：顶部导航(10%) + 工作区(90%) */
.main-content {
    width: 90%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
}

/* 顶部导航 - 占据右侧内容区的10%高度 */
.top-nav {
    height: 10%;
    min-height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* 工作区 - 占据右侧内容区的90%高度，水平布局：图片操作区 + 控制面板 */
.workspace {
    height: 90%;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    flex: 1;
    padding: 0;
    gap: 0;
}

/* 顶部导航样式已移至 header.css */

/* 通用按钮样式（不包括顶部导航按钮，已在header.css中定义） */
.canvas-area .btn-icon,
.image-controls .btn-icon,
.properties-panel .btn-icon {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.canvas-area .btn-icon:hover,
.image-controls .btn-icon:hover,
.properties-panel .btn-icon:hover {
    background: #f8f9fa;
    color: #495057;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 用户菜单样式已移至 header.css */

/* 图片操作区域容器 - 占据工作区左侧80%宽度 */
.image-operation-area {
    width: 80%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    overflow: hidden;
}

/* 图片处理区域 */
.image-processing-area {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1px;
    overflow: hidden;
}

/* 美颜工作区 */
.beauty-workspace {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    gap: 0;
}

/* 画布区域 */
.canvas-area {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-right: 20px;
}

.canvas-container {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

/* 控制面板区域 - 占据工作区右侧20%宽度 */
.properties-panel {
    width: 20%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
}

/* 上传区域 */
.upload-area {
    width: 100%;
    height: 100%;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
    border-color: #3b82f6;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-content {
    text-align: center;
    padding: 40px;
}

.upload-icon {
    font-size: 48px;
    color: #3b82f6;
    margin-bottom: 20px;
}

.upload-content h3 {
    margin-bottom: 10px;
    color: #495057;
    font-weight: 600;
}

.upload-content p {
    color: #6c757d;
    margin-bottom: 20px;
}

/* 图片预览 */
.image-preview {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    min-width: 0; /* 防止内容溢出 */
    overflow: hidden; /* 隐藏溢出内容 */
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 1; /* 允许图片缩小 */
}

.image-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* 属性面板样式已在上方定义，此处删除重复定义 */

/* 底部面板样式 */
.bottom-panel {
    flex: 0 0 auto;
    max-height: 300px;
    min-height: 250px;
}

.panel-section {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-title {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    gap: 8px;
}

.control-group {
    margin-bottom: 20px;
}

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

.control-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

/* 滑块控件 */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

/* 复选框样式 */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    position: relative;
    appearance: none;
    transition: all 0.3s ease;
}

.checkbox-container input[type="checkbox"]:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.checkbox-container input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-container label {
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    user-select: none;
}

/* 选择框 */
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #495057;
    outline: none;
    transition: border-color 0.3s ease;
}

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

/* 操作按钮区域 */
.panel-actions {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-process {
    font-size: 16px;
    padding: 14px 24px;
}

/* 底部状态栏 */
.status-bar {
    height: 40px;
    background: #2c3e50;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 16px;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-container {
        min-width: 800px;
    }
    
    .sidebar {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
    }
    
    .properties-panel {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
    }
}

@media (max-width: 992px) {
    .main-container {
        min-width: 700px;
    }
    
    .sidebar {
        width: 240px;
        min-width: 240px;
        max-width: 240px;
    }
    
    .properties-panel {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
    }
    
    .workspace {
        padding: 15px;
        gap: 15px;
        min-width: 500px;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        min-width: auto;
        overflow-x: hidden;
    }
    
    .sidebar {
        width: 100%;
        min-width: auto;
        max-width: none;
        height: auto;
        order: 1;
    }
    
    .workspace {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
        height: auto;
        max-width: 100vw;
    }
    
    .properties-panel {
        width: 100%;
        min-width: auto;
        max-width: none;
        max-height: 300px;
        order: 3;
        margin: 10px;
    }
    
    .main-content {
        order: 2;
    }
    
    .canvas-area {
        min-height: 400px;
        max-width: 100%;
        height: auto;
    }
    
    .nav-center {
        display: none;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 24px;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    color: #495057;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:invalid {
    border-color: #dc3545;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-link {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-link:hover {
    background: #f8faff;
    color: #1d4ed8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 16px 20px 12px;
    }
    
    .modal-body {
        padding: 20px;
    }
}
