/* 头部区域样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* 修复：覆盖全局 header-actions 的 absolute 定位 */
.header .header-actions {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 返回按钮样式 - 更柔和的浅蓝色 */
.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 18px;
    background-color: #f5f5f5;
    color: #666;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
}

.back-btn:hover {
    background-color: #e8e8e8;
    color: #333;
    transform: translateY(-1px);
}

/* 收藏按钮样式 - 以返回按钮为模板 */
.favorite-button {
    display: inline-flex;
    align-items: center;
    padding: 6px 18px;
    background-color: #f5f5f5;
    color: #666;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
    cursor: pointer;
    font-family: inherit;
}

.favorite-button:hover {
    background-color: #e8e8e8;
    color: #333;
    transform: translateY(-1px);
}

.favorite-button.favorited {
    background-color: #fff8e1;
    color: #f9a825;
}

.favorite-button.favorited:hover {
    background-color: #ffecb3;
    color: #f57f17;
}

@media (max-width: 768px) {
    .header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        margin-top: 15px;
        margin-bottom: 15px;
    }

    .back-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .favorite-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 页面标题 - 居中显示 */
.tool-title {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.tool-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

/* 主要内容区 */
.main-content {
    max-width: 800px;
    margin: 0 auto;
}

/* 颜色预览 */
.color-preview-section {
    margin-bottom: 25px;
}

.color-display {
    height: 150px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease;
    background-color: #2563eb;
}

.color-info {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-name {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    font-family: 'Consolas', monospace;
    margin-bottom: 5px;
}

.color-contrast {
    display: block;
    font-size: 14px;
    color: #666;
}

/* 颜色选择器 */
.color-picker-section,
.converter-section,
.palette-section,
.history-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    margin-bottom: 25px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: #2563eb;
}

.picker-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.native-picker {
    width: 80px;
    height: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    padding: 5px;
    background: white;
}

.btn-random {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-random:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* 输入组 */
.input-group {
    margin-bottom: 20px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.input-with-copy {
    display: flex;
    gap: 10px;
}

.input-with-copy input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Consolas', monospace;
    transition: all 0.3s ease;
}

.input-with-copy input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.btn-copy {
    width: 44px;
    height: 44px;
    border: none;
    background: #f5f5f5;
    border-radius: 10px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-copy:hover {
    background: #2563eb;
    color: white;
}

/* RGB输入 */
.rgb-inputs,
.hsl-inputs,
.cmyk-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.cmyk-inputs {
    grid-template-columns: repeat(4, 1fr);
}

.rgb-item,
.hsl-item,
.cmyk-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 8px;
}

.rgb-label,
.hsl-label,
.cmyk-label {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.rgb-label {
    background: #ef4444;
}

.rgb-item:nth-child(2) .rgb-label {
    background: #22c55e;
}

.rgb-item:nth-child(3) .rgb-label {
    background: #3b82f6;
}

.hsl-label {
    background: #8b5cf6;
}

.cmyk-label.c {
    background: #06b6d4;
}

.cmyk-label.m {
    background: #ec4899;
}

.cmyk-label.y {
    background: #eab308;
}

.cmyk-label.k {
    background: #374151;
}

.rgb-item input,
.hsl-item input,
.cmyk-item input {
    width: 50px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.unit {
    font-size: 12px;
    color: #999;
}

/* 配色方案 */
.palette-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #f5f5f5;
}

.tab-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.palette-display {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.palette-color {
    flex: 1;
    min-width: 100px;
    height: 80px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.palette-color:hover {
    transform: translateY(-4px);
}

.palette-hex {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    font-weight: 600;
}

/* 颜色历史 */
.color-history {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.history-color {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    position: relative;
}

.history-color:hover {
    transform: scale(1.1);
}

.history-color::after {
    content: attr(data-hex);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-color:hover::after {
    opacity: 1;
}

.empty-history {
    color: #999;
    font-size: 14px;
    padding: 20px;
    text-align: center;
    width: 100%;
}

/* 使用说明 */
.info-section {
    max-width: 800px;
    margin: 30px auto 0;
    padding: 25px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

.info-section h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3 i {
    color: #2563eb;
}

.info-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-section li {
    padding: 8px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

.info-section li strong {
    color: #2563eb;
}

/* Toast提示 */
.toast {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) translateY(100px) !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    z-index: 10001 !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    width: auto !important;
    height: auto !important;
    min-width: 120px !important;
    max-width: 300px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.toast.show {
    transform: translateX(-50%) translateY(0) !important;
    opacity: 1 !important;
}

.toast.success {
    background: #4caf50 !important;
    color: white !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .tool-title {
        font-size: 24px;
        width: 100%;
        order: 0;
        margin-bottom: 15px;
    }

    .picker-row {
        flex-direction: column;
        align-items: stretch;
    }

    .native-picker {
        width: 100%;
        height: 60px;
    }

    .rgb-inputs,
    .hsl-inputs {
        grid-template-columns: 1fr;
    }

    .cmyk-inputs {
        grid-template-columns: repeat(2, 1fr);
    }

    .palette-tabs {
        justify-content: center;
    }

    .palette-display {
        justify-content: center;
    }

    .palette-color {
        min-width: 80px;
        height: 60px;
    }
}
