/* 自定义样式 */
body {
    font-family: 'Noto Sans SC', sans-serif;
}

/* 画布容器样式 */
.canvas-container {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    cursor: crosshair;
}

.canvas-container canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* 工具栏样式 */
.toolbar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.toolbar-item {
    display: inline-flex;
    align-items: center;
    margin-right: 16px;
    font-size: 14px;
    color: #4a5568;
}

.toolbar-item:last-child {
    margin-right: 0;
}

.toolbar-item i {
    margin-right: 6px;
    color: #718096;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

.btn-outline:hover {
    background: #f3f4f6;
}

.btn i {
    margin-right: 6px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

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

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* 结果表格样式 */
.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.results-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.results-table td {
    font-size: 14px;
    color: #4b5563;
}

.results-table tr:hover {
    background: #f9fafb;
}

/* 颜色样本样式 */
.color-sample {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #e5e7eb;
    margin-right: 8px;
    vertical-align: middle;
}

.color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.color-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 14px;
}

.color-item .remove-color {
    margin-left: 8px;
    color: #ef4444;
    cursor: pointer;
    font-size: 12px;
}

.color-item .remove-color:hover {
    color: #dc2626;
}

/* 侧边栏样式 */
.sidebar {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.sidebar h3 {
    margin-bottom: 16px;
    font-weight: 600;
    color: #1f2937;
    font-size: 18px;
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
}

/* 提示信息样式 */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* 模态框样式 */
.modal {
    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: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #374151;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar-item {
        display: block;
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }
    
    .results-table {
        font-size: 12px;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 禁用状态 */
.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* 颜色选择器相关样式 */
.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #e5e7eb;
    margin-right: 8px;
    flex-shrink: 0;
}

.color-info {
    flex: 1;
    min-width: 0;
}

.color-rgb {
    font-size: 12px;
    color: #6b7280;
    font-family: monospace;
}

.color-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 2px;
    margin-left: 8px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.color-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* 结果显示相关样式 */
.result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #f9fafb;
}

.result-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #e5e7eb;
    margin-right: 12px;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
}

.result-percentage {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.result-pixels {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

.result-area {
    font-size: 12px;
    color: #059669;
    font-weight: 500;
}

/* 小按钮样式 */
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 画布相关样式增强 */
.canvas-container {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    cursor: crosshair;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-container.eyedropper {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M13.354 2.646a.5.5 0 0 0-.708 0L8 7.293 5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0 0-.708z"/></svg>') 8 8, crosshair;
}

.canvas-container.selection {
    cursor: crosshair;
}

.canvas-container.pan {
    cursor: grab;
}

.canvas-container.pan:active {
    cursor: grabbing;
}

/* 上传提示样式 */
#uploadPrompt {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 250, 251, 0.9);
    color: #9ca3af;
    font-size: 18px;
    z-index: 1;
}

/* 参考信息样式 */
#referenceInfo {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #0c4a6e;
}

#referenceInfo div {
    margin-bottom: 4px;
}

#referenceInfo div:last-child {
    margin-bottom: 0;
}

/* 工具栏增强 */
.toolbar {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 表格样式增强 */
.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.results-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 总计信息卡片样式 */
.stats-card {
    text-align: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stats-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stats-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.pulse {
    animation: pulse 2s infinite;
}

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

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

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

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