/* ===================================
   配色方案生成工具 - 样式表
   参考 online_html_editor 设计风格
   ================================== */

/* ========== 主容器 ========== */
.color-picker-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: calc(100vh - 80px); /* 减去头部和面包屑高度 */
    min-height: 700px;
    background: #f8fafc;
    position: relative;
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
}

/* 全屏模式 */
.color-picker-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    margin: 0;
    border-radius: 0;
}

/* ========== 顶部工具栏 ========== */
.top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toolbar-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toolbar-btn-small {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.toolbar-btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ========== 主内容区 ========== */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* ========== 左侧控制面板 ========== */
.left-sidebar {
    width: 240px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-right: 2px solid rgba(102, 126, 234, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    min-width: 180px;
    max-width: 400px;
}

.sidebar-header {
    padding: 12px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
}

.control-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

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

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-item {
    margin-bottom: 14px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.value-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #667eea;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    min-width: 28px;
    text-align: center;
}

/* 颜色输入组 */
.color-input-group {
    display: grid;
    grid-template-columns: 45px 1fr;
    gap: 8px;
}

.color-picker-input {
    width: 45px;
    height: 32px;
    padding: 2px;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
    background: white;
}

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

.hex-input {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    font-size: 11px;
    font-family: 'Consolas', 'Monaco', monospace;
    text-transform: uppercase;
    outline: none;
    transition: all 0.3s;
}

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

/* 滑块 */
.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, 
        rgba(102, 126, 234, 0.2) 0%, 
        rgba(102, 126, 234, 0.4) 50%, 
        rgba(102, 126, 234, 0.2) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.6);
}

.range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.6);
}

.control-input {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
}

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

.control-select {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 6px;
    font-size: 11px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.control-select:hover {
    border-color: #667eea;
}

.btn-generate {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

/* 风格模板网格 */
.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 6px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1.5px solid rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.style-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.style-btn:hover::before {
    left: 100%;
}

.style-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.style-icon {
    font-size: 20px;
    line-height: 1;
}

.style-name {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
}

.style-btn:hover .style-name {
    color: #667eea;
}

/* 快速操作 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1.5px solid rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: #667eea;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.action-icon {
    font-size: 18px;
    line-height: 1;
}

/* ========== 中间画布区 ========== */
.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 400px;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.canvas-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.canvas-actions {
    display: flex;
    gap: 6px;
}

.btn-action {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
}

.btn-action:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.color-display-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    gap: 20px;
}

/* 颜色卡片 */
.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.color-item {
    background: white;
    border: 1.5px solid rgba(102, 126, 234, 0.15);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.color-item.locked {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.color-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.color-item:hover::before {
    left: 100%;
}

.color-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
    border-color: #667eea;
}

.color-swatch {
    height: 100px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.color-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.color-item:hover .color-actions {
    opacity: 1;
}

.color-action-btn {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-action-btn:hover {
    background: white;
    transform: scale(1.1);
}

.color-lock {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.color-lock:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.color-info {
    padding: 10px;
    background: white;
}

.color-hex {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.color-name {
    font-size: 10px;
    color: #64748b;
}

/* 预览区域 */
.preview-section {
    background: white;
    border: 1.5px solid rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.preview-section:hover {
    border-color: rgba(102, 126, 234, 0.2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.preview-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 1.5px solid rgba(102, 126, 234, 0.1);
}

.preview-tab {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s;
    margin-bottom: -1.5px;
}

.preview-tab:hover {
    color: #667eea;
}

.preview-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.preview-content {
    min-height: 240px;
}

.preview-panel {
    display: none;
}

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

/* UI演示 */
.ui-demo {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    min-height: 220px;
}

.demo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border-radius: 8px;
    margin-bottom: 12px;
}

.demo-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.demo-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

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

.demo-content {
    padding: 14px;
    background: white;
    border-radius: 8px;
    border: 1.5px solid rgba(102, 126, 234, 0.1);
}

.demo-content p {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}

.demo-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.demo-card {
    padding: 14px;
    background: #f093fb;
    color: white;
    border-radius: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(240, 147, 251, 0.3);
}

/* 渐变演示 */
.gradient-demo {
    height: 240px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 网站演示 */
.website-demo {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: 40px 1fr 30px;
    gap: 6px;
    height: 240px;
    font-size: 11px;
    font-weight: 600;
}

.demo-nav {
    grid-column: 1 / 3;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 6px;
}

.demo-sidebar {
    background: #764ba2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    writing-mode: vertical-rl;
}

.demo-main {
    background: white;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #64748b;
}

.demo-footer {
    grid-column: 1 / 3;
    background: #f093fb;
    color: white;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 6px;
}

/* ========== 右侧信息面板 ========== */
.right-panel {
    width: 260px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-left: 2px solid rgba(102, 126, 234, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-width: 200px;
    max-width: 500px;
}

.panel-header {
    padding: 12px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
}

.info-section {
    margin-bottom: 20px;
    background: white;
    border: 1.5px solid rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 14px;
    transition: all 0.3s;
}

.info-section:hover {
    border-color: rgba(102, 126, 234, 0.2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.info-title {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-card {
    padding: 12px;
    background: white;
    border: 1.5px solid rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.preview-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* 代码格式切换标签 */
.code-format-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1.5px solid rgba(102, 126, 234, 0.1);
}

.code-tab {
    padding: 5px 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.3s;
    margin-bottom: -1.5px;
}

.code-tab:hover {
    color: #667eea;
}

.code-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.code-preview {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 10px;
    line-height: 1.6;
    overflow-x: auto;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.code-line {
    margin-bottom: 2px;
}

/* 导出操作按钮 */
.export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.export-icon-btn {
    flex: 0 0 auto;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1.5px solid rgba(102, 126, 234, 0.15);
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.export-icon-btn span {
    display: inline-block;
}

.export-icon-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

/* 历史记录 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    padding: 8px 10px;
    background: white;
    border: 1.5px solid rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: #667eea;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.15);
}

.history-number {
    font-size: 10px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #667eea;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}

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

.history-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.history-time {
    font-size: 10px;
    color: #64748b;
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========== 模板库面板 ========== */
.modal-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000; /* 高于全屏容器的99999 */
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.template-categories {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.template-category h4 {
    margin: 0 0 14px 0;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.15);
    letter-spacing: 0.3px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.template-card {
    padding: 16px 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 1.5px solid rgba(102, 126, 234, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.template-card:hover::before {
    left: 100%;
}

.template-card:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

.template-preview {
    display: flex;
    gap: 5px;
    margin-bottom: 12px;
    justify-content: center;
}

.template-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.template-card:hover .template-color {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.template-name {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 5px;
}

.template-desc {
    font-size: 10px;
    color: #64748b;
}

/* ========== AI 对话框 ========== */
.ai-dialog .modal-content {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.ai-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
}

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

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

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

.btn-secondary {
    background: #f1f5f9;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    color: #475569;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

/* ========== 底部状态栏 ========== */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-top: 1.5px solid rgba(102, 126, 234, 0.1);
    font-size: 11px;
    flex-wrap: wrap;
    gap: 12px;
}

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

.status-label {
    color: #64748b;
    font-weight: 500;
}

.status-value {
    color: #1e293b;
    font-weight: 600;
}

/* ========== 暗黑模式 ========== */
body.dark-mode .color-picker-container {
    background: #1e293b;
}

body.dark-mode .left-sidebar,
body.dark-mode .center-panel,
body.dark-mode .right-panel {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .section-title,
body.dark-mode .info-title,
body.dark-mode .canvas-header h3 {
    color: #e2e8f0;
}

body.dark-mode .control-label,
body.dark-mode .status-label {
    color: #94a3b8;
}

body.dark-mode .control-input,
body.dark-mode .control-select,
body.dark-mode .ai-textarea {
    background: #1e293b;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .color-card,
body.dark-mode .preview-card,
body.dark-mode .history-item,
body.dark-mode .info-section {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .color-name,
body.dark-mode .template-name {
    color: #e2e8f0;
}

body.dark-mode .modal-content {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark-mode .btn-secondary {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
}

body.dark-mode .btn-secondary:hover {
    background: #334155;
    border-color: rgba(148, 163, 184, 0.5);
}

/* ========== 可调整大小的分隔条 ========== */
.resizer {
    position: absolute;
    background: transparent;
    z-index: 10;
    transition: background 0.2s;
}

.resizer:hover {
    background: rgba(102, 126, 234, 0.3);
}

.resizer.resizing {
    background: rgba(102, 126, 234, 0.5);
}

.resizer-x {
    width: 6px;
    cursor: col-resize;
    top: 0;
    bottom: 0;
}

.left-sidebar .resizer-x {
    right: -3px;
}

.right-panel .resizer-x {
    left: -3px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .left-sidebar,
    .right-panel {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-sidebar,
    .center-panel,
    .right-panel {
        width: 100%;
    }
    
    .top-toolbar {
        padding: 10px 12px;
        flex-wrap: wrap;
    }
    
    .toolbar-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .color-palette {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== Toast 通知 ========== */
.toast-notification {
    position: fixed;
    bottom: -100px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    font-weight: 600;
    z-index: 10001;
    transition: all 0.3s ease-out;
}

.toast-notification.show {
    bottom: 20px;
}

.toast-notification.success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.toast-notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ========== 加载动画 ========== */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== 可访问性增强 ========== */
.toolbar-btn:focus,
.btn-generate:focus,
.btn-primary:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* ========== 打印样式 ========== */
@media print {
    .top-toolbar,
    .left-sidebar,
    .right-panel,
    .status-bar {
        display: none !important;
    }
    
    .center-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* ========== 通知动画 ========== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification {
    animation: slideInRight 0.3s ease-out !important;
}

/* ========== 加载动画 ========== */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 暗黑模式加载 */
body.dark-mode #colorPickerLoading {
    background: rgba(30, 41, 59, 0.95) !important;
    color: #a5b4fc !important;
}
