/* ==========================================
   配色明度协调工具样式
   ========================================== */

/* 变量定义 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 工具容器 */
.harmony-tool {
    background: var(--background-primary);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
}

/* 工具头部 */
.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.tool-header h2 i {
    color: var(--secondary-color);
}

.tool-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 场景选择器 */
.scene-selector {
    margin-bottom: 40px;
    padding: 25px;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
}

.scene-selector h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scene-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.scene-option {
    cursor: pointer;
}

.scene-option input[type="radio"] {
    display: none;
}

.option-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-card i {
    font-size: 2rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.option-title {
    font-weight: 600;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.scene-option.active .option-card {
    border-color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.05);
}

.scene-option.active .option-card i {
    color: var(--secondary-color);
}

.scene-option:hover .option-card {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.scene-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.scene-info i {
    color: var(--secondary-color);
    flex-shrink: 0;
}

.scene-info-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.scene-info-title {
    font-size: 1rem;
    color: var(--text-primary);
}

.scene-info-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.scene-info-usage {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 2px;
}

/* 颜色输入区域 */
.color-input-section {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
}

.section-header {
    margin-bottom: 20px;
}

.section-header h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.required {
    color: var(--danger-color);
    font-size: 0.9rem;
    font-weight: normal;
}

.optional {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: normal;
}

.section-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* 主色列表 */
.color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 80px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.color-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--background-secondary);
    border-radius: 8px;
    transition: var(--transition);
}

.color-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.color-item.reference-color {
    border: 2px solid var(--secondary-color);
    background: rgba(52, 152, 219, 0.05);
}

.reference-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.color-swatch {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.color-swatch:hover {
    transform: scale(1.05);
}

.color-code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.color-lightness {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lightness-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.lightness-badge.ok {
    background: #d4edda;
    color: #155724;
}

.lightness-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.btn-remove-color {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    opacity: 0;
}

.color-item:hover .btn-remove-color {
    opacity: 1;
}

.btn-remove-color:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* 添加颜色控制 */
.add-color-controls {
    margin-bottom: 15px;
}

.color-picker-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.color-picker-group input[type="color"] {
    width: 50px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.color-picker-group input[type="color"]:hover {
    transform: scale(1.05);
}

.color-picker-group input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    transition: var(--transition);
}

.color-picker-group input[type="text"]:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 按钮样式 */
.btn-add {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    background: var(--secondary-color);
    color: white;
}

.btn-add:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

/* 批量输入提示 */
.batch-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.batch-hint i {
    color: var(--secondary-color);
    flex-shrink: 0;
}

/* 紧凑布局样式 */
.compact-section {
    padding: 20px !important;
}

.compact-color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.compact-color-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.compact-label i {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.compact-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.color-display-mini {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.color-display-mini:hover {
    border-color: var(--secondary-color);
}

.color-display-mini.filled {
    border-style: solid;
}

.empty-state-mini {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.compact-input-row input[type="color"] {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.compact-input-row input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    min-width: 0;
}

.compact-input-row input[type="text"]:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.btn-mini {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--secondary-color);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-mini:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.compact-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 6px 10px;
    background: white;
    border-radius: 4px;
}

.hint-range {
    color: var(--text-secondary);
}

.hint-status {
    color: var(--text-secondary);
    font-weight: 500;
}

.filled-color-mini {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn-remove-mini {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition);
    opacity: 0;
}

.color-display-mini:hover .btn-remove-mini {
    opacity: 1;
}

.btn-remove-mini:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* 明度提示 */
.lightness-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.lightness-hint i {
    color: var(--warning-color);
}

.lightness-hint strong {
    color: var(--secondary-color);
}

.current-status {
    margin-left: auto;
    color: var(--text-secondary);
}

/* 单个颜色输入 */
.single-color-input {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.color-display {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.color-display:hover {
    border-color: var(--secondary-color);
}

.color-display.filled {
    border-style: solid;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 10px;
}

.empty-state i {
    font-size: 1.5rem;
}

.filled-color {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.filled-code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.filled-lightness {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn-remove-single {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.btn-remove-single:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .btn-outline, .btn-success {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: var(--success-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* 分析结果 */
.analysis-result {
    margin-top: 40px;
    padding: 30px;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.result-section h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

/* 颜色预览行 */
.color-preview-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.preview-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
}

.color-swatches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.swatch-box {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.swatch-info {
    text-align: center;
    font-size: 0.8rem;
}

.swatch-code {
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
}

.swatch-lightness {
    color: var(--text-secondary);
    font-weight: 600;
}

/* 问题列表 */
.issues-list {
    margin-top: 20px;
}

.issue-item {
    padding: 12px 16px;
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.issue-item.ok {
    background: #d4edda;
    border-left-color: var(--success-color);
}

.issue-item i {
    font-size: 1.2rem;
}

.issue-item.ok i {
    color: var(--success-color);
}

.issue-item:not(.ok) i {
    color: var(--warning-color);
}

/* 单个颜色检查 */
.single-color-check {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: var(--background-secondary);
    border-radius: 8px;
}

.check-swatch {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.check-info {
    flex: 1;
}

.check-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.check-status.ok {
    color: var(--success-color);
}

.check-status.warning {
    color: var(--warning-color);
}

/* 调整后预览 */
.adjusted-preview {
    margin-top: 40px;
    padding: 30px;
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    animation: fadeIn 0.5s ease;
}

.preview-header h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comparison-view {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 30px;
}

.comparison-column {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.comparison-column h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.color-group {
    margin-bottom: 20px;
}

.group-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--secondary-color);
}

/* 手动微调 */
.manual-adjust {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.manual-adjust h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.adjust-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.adjust-item {
    display: grid;
    grid-template-columns: 80px 100px 1fr 60px 60px;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: var(--background-secondary);
    border-radius: 8px;
}

.adjust-swatch {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.adjust-code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.adjust-slider {
    display: flex;
    align-items: center;
    gap: 10px;
}

.adjust-slider input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.adjust-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
}

.adjust-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    border: none;
}

.adjust-value {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
    text-align: center;
}

.adjust-status {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* 导出按钮 */
.export-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 工具说明 */
.tool-intro {
    background: var(--background-primary);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
}

.intro-header h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.intro-content {
    display: grid;
    gap: 25px;
}

.intro-item h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
}

.intro-item p, .intro-item ol {
    color: var(--text-secondary);
    line-height: 1.8;
}

.intro-item ol {
    padding-left: 20px;
}

.intro-item li {
    margin-bottom: 8px;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--success-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast.error {
    background: var(--danger-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .harmony-tool {
        padding: 20px;
    }

    .tool-header h2 {
        font-size: 1.5rem;
    }

    .scene-options {
        grid-template-columns: 1fr;
    }

    .color-picker-group {
        width: 100%;
    }

    .compact-color-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }

    .comparison-view {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .comparison-arrow {
        transform: rotate(90deg);
    }

    .adjust-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .adjust-swatch {
        justify-self: center;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-buttons button {
        width: 100%;
    }
}

