/* Color Palette Tool Styles - New Layout */

/* ====== 基础样式 ====== */
.tool-layout-container {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ====== 主工具区域 ====== */
.tool-main-area {
    flex: 1;
    min-width: 0; /* 防止flex项目溢出 */
}

.tool-card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    overflow: hidden;
    margin-bottom: 2rem;
}

.tool-card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.tool-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.mode-selector {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: #ffffff;
    color: #6c757d;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.mode-btn.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.tool-card-content {
    padding: 1.5rem;
}

.mode-content {
    display: none;
}

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

/* ====== 单色模式样式 ====== */
.color-input-section {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.color-input {
    width: 60px;
    height: 50px;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.color-input:hover {
    border-color: #0d6efd;
}

.hex-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    transition: border-color 0.2s ease;
}

.hex-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.color-preview {
    width: 120px;
    height: 120px;
    border-radius: 0.75rem;
    border: 3px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.color-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-color: #0d6efd;
}

.color-info {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.color-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.color-hex {
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    opacity: 0.9;
}

/* ====== 颜色值网格 ====== */
.color-values-section {
    margin-bottom: 2rem;
}

.color-values-section h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.value-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.value-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.value-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.value-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    background: #f8f9fa;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
}

.copy-btn {
    padding: 0.75rem;
    border: none;
    background: #0d6efd;
    color: #ffffff;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #0b5ed7;
}

/* ====== 颜色调整 ====== */
.color-adjustment-section h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.sliders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.slider-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    transition: background-color 0.2s ease;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* ====== 配色模式 ====== */
.base-color-section {
    margin-bottom: 2rem;
}

.base-color-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.scheme-types h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.scheme-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.scheme-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    background: #ffffff;
    color: #495057;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scheme-btn:hover {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.scheme-display {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.scheme-color {
    height: 80px;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scheme-color:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-color: #0d6efd;
}

.scheme-color-info {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.scheme-color:hover .scheme-color-info {
    opacity: 1;
}

.scheme-color-hex {
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-weight: 500;
}

.scheme-copy-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: #ffffff;
    color: #495057;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.scheme-copy-btn:hover {
    background: #0d6efd;
    color: #ffffff;
}

/* ====== 渐变模式 ====== */
.gradient-section h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.gradient-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.gradient-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gradient-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
}

.gradient-controls {
    margin-bottom: 2rem;
}

.gradient-controls label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.gradient-preview-section {
    margin-bottom: 2rem;
}

.gradient-preview {
    height: 150px;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
}

.gradient-code-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.code-textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    background: #f8f9fa;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: #0d6efd;
    color: #ffffff;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background: #0b5ed7;
}

.action-btn.secondary {
    background: #6c757d;
}

.action-btn.secondary:hover {
    background: #5c636a;
}

/* ====== 保存配色样式 ====== */
.saved-palette-item {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.saved-palette-item:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.palette-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.delete-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid #dc3545;
    background: #ffffff;
    color: #dc3545;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: #dc3545;
    color: #ffffff;
}

.palette-colors {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.saved-color {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    border: 2px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.saved-color:hover {
    transform: scale(1.1);
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ====== 图片拾色模式 ====== */
.upload-section {
    margin-bottom: 2rem;
}

.upload-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.file-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    background: #f8f9fa;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.file-input:focus {
    outline: none;
    border-color: #0d6efd;
}

.image-container {
    margin-bottom: 2rem;
}

.image-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.zoom-controls {
    display: flex;
    gap: 0.5rem;
}

.zoom-btn, .reset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #dee2e6;
    background: #ffffff;
    color: #495057;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-btn:hover, .reset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.image-canvas-wrapper {
    position: relative;
    display: inline-block;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: crosshair;
    max-width: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: border-color 0.2s ease;
}

.image-canvas-wrapper:hover {
    border-color: #0d6efd;
}

.image-canvas-wrapper.dragging {
    cursor: move;
    border-color: #198754;
}

.image-canvas-wrapper.pressing {
    border-color: #fd7e14;
}

.drag-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drag-hint.visible {
    opacity: 1;
}

.drag-hint i {
    font-size: 1rem;
}

.image-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    transition: transform 0.2s ease;
}

.image-canvas:hover {
    transform: scale(1.02);
}

.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-canvas-wrapper:hover .image-info {
    opacity: 1;
}

.image-magnifier {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 3px solid #0d6efd;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    overflow: hidden;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.image-magnifier canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.color-picker-crosshair {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 999;
    display: none;
}

.color-picker-crosshair::before,
.color-picker-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.8);
}

.color-picker-crosshair::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}

.color-picker-crosshair::after {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}

.picked-color-section h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.color-preview-container {
    margin-bottom: 1.5rem;
}

.color-preview-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.color-preview-box:hover {
    border-color: #0d6efd;
    box-shadow: 0 0.25rem 0.5rem rgba(13, 110, 253, 0.15);
}

.color-preview-color {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    border: 2px solid #ffffff;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.color-preview-box:hover .color-preview-color {
    transform: scale(1.05);
}

.color-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.preview-hex {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
}

.preview-rgb {
    font-size: 0.875rem;
    color: #6c757d;
    font-family: 'Courier New', monospace;
}

.preview-coords {
    font-size: 0.8rem;
    color: #adb5bd;
    font-weight: 500;
}

/* 颜色预览动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
}

.picked-color-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ====== 侧边栏样式 ====== */
.tool-sidebar {
    width: 350px;
    flex-shrink: 0;
}

.sidebar-card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.sidebar-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
}

.clear-btn {
    padding: 0.25rem 0.75rem;
    border: 1px solid #dc3545;
    background: #ffffff;
    color: #dc3545;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #dc3545;
    color: #ffffff;
}

.sidebar-content {
    padding: 1.25rem;
}

.quick-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-color {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-color:hover {
    transform: scale(1.1);
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease;
}

.history-item:hover {
    background: #f8f9fa;
}

.history-color {
    width: 24px;
    height: 24px;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

.history-info {
    flex: 1;
    font-size: 0.875rem;
    color: #495057;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0d6efd;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.select-input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    background: #ffffff;
    font-size: 0.875rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-input {
    width: 1rem;
    height: 1rem;
    margin: 0;
}

.checkbox-label {
    font-size: 0.875rem;
    color: #495057;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.w-100 {
    width: 100%;
}

.empty-state {
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
    padding: 1rem;
    font-style: italic;
}

/* ====== 响应式设计 ====== */
@media (max-width: 1200px) {
    .tool-layout-container {
        flex-direction: column;
    }

    .tool-sidebar {
        width: 100%;
        order: -1;
    }

    .sidebar-card {
        margin-bottom: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .tool-layout-container {
        gap: 1rem;
    }

    .tool-card-header {
        padding: 1rem;
    }

    .tool-card-content {
        padding: 1rem;
    }

    .color-input-section {
        flex-direction: column;
        align-items: stretch;
    }

    .color-preview {
        width: 100%;
        height: 80px;
        align-self: center;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .sliders-grid {
        grid-template-columns: 1fr;
    }

    .scheme-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .gradient-inputs {
        grid-template-columns: 1fr;
    }

    .image-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .zoom-controls {
        justify-content: center;
    }

    .picked-color-values {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mode-selector {
        justify-content: center;
    }

    .mode-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 576px) {
    .tool-title {
        font-size: 1rem;
        text-align: center;
        width: 100%;
    }

    .tool-card-header {
        flex-direction: column;
        text-align: center;
    }

    .scheme-buttons {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: row;
    }

    .sidebar-content {
        padding: 1rem;
    }

    .quick-colors-grid {
        grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
    }

    .quick-color {
        width: 35px;
        height: 35px;
    }
}