/* 配色助手样式 */

/* 容器 */
.color-scheme-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 工具栏 */
.color-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    padding-right: 12px;
    border-right: 1px solid #e2e8f0;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.toolbar-btn:disabled,
.toolbar-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.toolbar-btn.ai-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
}

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

/* 主内容区域 */
.color-main-content {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    min-height: 500px;
}

/* 左侧颜色选择器面板 */
.color-picker-panel {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
}

.color-picker-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.color-picker-input {
    width: 80px;
    height: 80px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input::-webkit-color-swatch {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
}

.color-preview-large {
    flex: 1;
    height: 80px;
    background: #3498db;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-input-group {
    margin-bottom: 12px;
}

.color-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
}

.input-with-btn {
    display: flex;
    gap: 6px;
}

.color-text-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', monospace;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.2s;
}

.color-text-input:focus {
    outline: none;
    border-color: #3498db;
}

.copy-btn {
    padding: 8px 10px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.copy-btn.small {
    padding: 4px 8px;
    font-size: 11px;
}

/* RGB滑块 */
.slider-group {
    margin-bottom: 12px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
}

.color-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
}

.color-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid #64748b;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.red-slider {
    background: linear-gradient(to right, #000, #ff0000);
}

.green-slider {
    background: linear-gradient(to right, #000, #00ff00);
}

.blue-slider {
    background: linear-gradient(to right, #000, #0000ff);
}

/* 中间配色方案面板 */
.scheme-panel {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
}

.scheme-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.scheme-type-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.scheme-type-selector label {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
}

.scheme-select {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.scheme-select:focus {
    outline: none;
    border-color: #3498db;
}

.generate-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.scheme-description {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #e0f2fe;
    border-radius: 6px;
    margin-bottom: 16px;
}

.desc-icon {
    font-size: 14px;
}

.desc-text {
    font-size: 12px;
    color: #0369a1;
    line-height: 1.5;
}

/* 配色方案展示 */
.scheme-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.scheme-color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

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

.color-block {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.color-code {
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: #475569;
}

.color-copy-btn {
    padding: 4px 8px;
    font-size: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-copy-btn:hover {
    background: #e2e8f0;
}

/* 色轮 */
.color-wheel-container {
    text-align: center;
    position: relative;
}

.color-wheel-container h4 {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin: 0 0 12px 0;
}

#colorWheel {
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#wheelMarkers {
    position: absolute;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
}

/* 右侧预览面板 */
.preview-panel {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
}

.preview-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.preview-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 8px;
}

.preview-tab {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-tab:hover {
    color: #334155;
}

.preview-tab.active {
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.preview-content {
    display: none;
    min-height: 250px;
}

.preview-content.active {
    display: block;
}

/* UI预览 */
.preview-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #3498db;
    color: #fff;
    font-weight: 600;
}

.card-badge {
    padding: 2px 8px;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.preview-card-body {
    padding: 16px;
}

.preview-card-body p {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 16px 0;
    line-height: 1.6;
}

.preview-buttons {
    display: flex;
    gap: 10px;
}

.preview-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-btn.primary {
    background: #3498db;
    color: #fff;
}

.preview-btn.secondary {
    background: #e2e8f0;
    color: #475569;
}

/* 渐变预览 */
.gradient-box {
    height: 80px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.gradient-code {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #1e293b;
    border-radius: 6px;
}

.gradient-code code {
    flex: 1;
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: #94a3b8;
    word-break: break-all;
}

/* 文字预览 */
.text-preview-item {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.text-preview-item.dark {
    background: #1e293b;
}

.preview-heading {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #3498db;
}

.preview-body {
    font-size: 13px;
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.text-preview-item.dark .preview-heading,
.text-preview-item.dark .preview-body {
    color: #fff;
}

.contrast-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f1f5f9;
    border-radius: 6px;
}

.contrast-label {
    font-size: 12px;
    color: #64748b;
}

.contrast-value {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.contrast-status {
    font-size: 12px;
    color: #22c55e;
}

/* 调色板预览 */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.palette-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.palette-cell:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* 底部历史记录 */
.history-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.history-bar h4 {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin: 0;
    white-space: nowrap;
}

.history-colors {
    display: flex;
    flex: 1;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
}

.history-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.history-color:hover {
    transform: scale(1.1);
}

.clear-history-btn {
    padding: 6px 10px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* AI侧边栏 */
.ai-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ai-sidebar.active {
    right: 0;
}

.ai-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ai-sidebar-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-close-btn {
    padding: 4px 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.ai-input-group {
    margin-bottom: 16px;
}

.ai-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 8px;
}

.ai-input-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.ai-input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.ai-suggestions {
    margin-bottom: 16px;
}

.ai-suggestions p {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 8px 0;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.suggestion-tag {
    padding: 4px 10px;
    font-size: 12px;
    color: #667eea;
    background: #f0f1ff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-tag:hover {
    background: #e0e1ff;
}

.ai-actions {
    margin-bottom: 20px;
}

.ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

.ai-result {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.ai-result h5 {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 12px 0;
}

.ai-scheme-name {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
}

.ai-scheme-colors {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-scheme-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-scheme-color:hover {
    transform: scale(1.1);
}

.ai-scheme-desc {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 12px;
}

.ai-apply-btn {
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: #22c55e;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-apply-btn:hover {
    background: #16a34a;
}

.ai-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.ai-overlay.active {
    display: block;
}

/* 预设方案弹窗 */
.preset-modal,
.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    align-items: center;
    justify-content: center;
}

.preset-modal.active,
.help-modal.active {
    display: flex;
}

.preset-modal-content,
.help-modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.preset-modal-header,
.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.preset-modal-header h3,
.help-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.modal-close {
    padding: 4px 8px;
    font-size: 14px;
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #cbd5e1;
}

.preset-modal-body,
.help-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.preset-category {
    margin-bottom: 24px;
}

.preset-category h4 {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin: 0 0 12px 0;
}

.preset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.preset-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.preset-name {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 8px;
}

.preset-colors {
    display: flex;
    gap: 4px;
}

.preset-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* 帮助弹窗 */
.help-section {
    margin-bottom: 20px;
}

.help-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 10px 0;
}

.help-section ul,
.help-section ol {
    margin: 0;
    padding-left: 20px;
}

.help-section li {
    font-size: 13px;
    color: #64748b;
    line-height: 1.8;
}

.help-section li strong {
    color: #334155;
}

.help-section p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', monospace;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 通知提示 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    font-size: 14px;
    color: #fff;
    background: #334155;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
    word-break: break-word;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #22c55e;
}

.toast.error {
    background: #ef4444;
}

/* 响应式 */
@media (max-width: 1200px) {
    .color-main-content {
        grid-template-columns: 260px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .color-main-content {
        grid-template-columns: 1fr;
    }
    
    .color-picker-panel,
    .scheme-panel,
    .preview-panel {
        margin-bottom: 16px;
    }
}

@media (max-width: 768px) {
    .toolbar-group {
        flex-wrap: wrap;
    }
    
    .scheme-type-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .scheme-type-selector label {
        margin-bottom: 8px;
    }
    
    .generate-btn {
        width: 100%;
        margin-top: 8px;
    }
    
    .ai-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .preset-modal-content,
    .help-modal-content {
        width: 95%;
        max-height: 90vh;
    }
}
