/* ========== 全局基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background-color: #f5f7fa;
    min-width: 1200px;
    scroll-behavior: smooth;
}

/* 导航栏样式 */
.navbar {
    background-color: #28a745;
    color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}
.navbar-container {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-logo {
    font-size: 20px;
    font-weight: 700;
}
.navbar-menu {
    display: flex;
    gap: 30px;
}
.navbar-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s;
}
.navbar-menu a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 页脚样式 */
.footer {
    background-color: #333;
    color: #ccc;
    padding: 20px 15px;
    margin-top: 40px;
}
.footer-copyright {
    text-align: center;
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    width: 98%;
    max-width: 1920px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    padding: 30px;
}

/* ========== 颜色工具专属样式 ========== */
.color-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}
.color-header {
    text-align: center;
    margin-bottom: 30px;
}
.color-header h1 {
    font-size: 25px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
}
.color-header p {
    color: #666;
    font-size: 16px;
}

/* 标签切换 */
.color-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.color-tab {
    padding: 12px 28px;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.color-tab.active {
    background: #53A551;
    color: #fff;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}
.color-tab:hover:not(.active) {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* 可视化取色器 */
.color-picker-section {
    max-width: 100%;
    margin: 0 auto 40px;
    padding: 40px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f4f8 100%);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}
.color-picker-section h2 {
    font-size: 17px;
    margin-bottom: 30px;
    color: #2c3e50;
    text-align: center;
    font-weight: 600;
}
.picker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}
.picker-preview {
    width: 100%;
    height: 120px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}
#nativeColorPicker {
    width: 180px;
    height: 60px;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transition: transform 0.2s ease;
}
#nativeColorPicker:hover {
    transform: scale(1.05);
}
.picker-result {
    width: 100%;
    padding: 25px;
    background: #fff;
    border-radius: 12px;
    border-left: 5px solid #28a745;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.picker-result p {
    margin: 12px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.picker-code {
    color: #28a745;
    font-weight: bold;
    font-size: 18px;
    font-family: Consolas, Monaco, monospace;
}

/* 汉字查询颜色 */
.color-search {
    max-width: 100%;
    margin: 0 auto 40px;
    padding: 40px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f4f8 100%);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}
.color-search h2 {
    font-size: 17px;
    margin-bottom: 25px;
    color: #2c3e50;
    text-align: center;
    font-weight: 600;
}
.search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.search-input {
    flex: 1;
    min-width: 200px;
    padding: 16px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    transition: border-color 0.2s ease;
}
.search-input:focus {
    outline: none;
    border-color: #53A551;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.search-btn {
    padding: 16px 30px;
    background: linear-gradient(135deg, #28a745 0%, #5a6edb 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transition: all 0.2s ease;
}
.search-btn:hover {
    background: linear-gradient(135deg, #5a6edb 0%, #4d5fc7 100%);
    transform: translateY(-2px);
}
.search-result {
    margin-top: 25px;
    padding: 25px;
    border-radius: 12px;
    background: #fff;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.result-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
.result-item:last-child {
    margin: 0;
    padding: 0;
    border: none;
}
.result-color {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}
.result-color:hover {
    transform: scale(1.1);
}
.result-info p {
    margin: 8px 0;
    font-size: 16px;
}
.result-code {
    color: #28a745;
    font-weight: bold;
    font-family: Consolas, Monaco, monospace;
}
.no-result {
    color: #dc3545;
    text-align: center;
    padding: 20px;
    font-size: 16px;
}

/* 复制按钮 */
.copy-btn {
    padding: 8px 16px;
    margin-left: 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s ease;
}
.copy-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

/* 强制三个表格样式/宽度完全一致（优先级最高） */
.color-table-wrap {
    width: 100% !important;
    margin: 20px 0 !important;
    overflow-x: auto !important;
}
.color-table {
    width: 100% !important;
    min-width: 1000px !important;
    border-collapse: collapse !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}
.color-table th, .color-table td {
    padding: 0 !important;
    text-align: center !important;
    border: 1px solid #eee !important;
}
.color-table th {
    background: #f8f9fa !important;
    padding: 10px !important;
    font-size: 14px !important;
    color: #333 !important;
}
.color-cell {
    height: 50px !important;
    cursor: pointer !important;
    transition: transform 0.1s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    color: #333 !important;
    font-size: 12px !important;
}
.color-cell.dark-text {
    color: #fff !important;
}
.copy-tooltip {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: rgba(0,0,0,0.8) !important;
    color: #fff !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
    pointer-events: none !important;
}
.color-cell:hover .copy-tooltip {
    opacity: 1 !important;
}

/* 颜色转换 */
.color-converter {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 40px;
}
.color-converter h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}
.converter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.converter-btn {
    padding: 10px 20px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}
.converter-btn:hover {
    background: #5a6edb;
}
.result-box {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 4px;
    border-left: 3px solid #28a745;
}

/* 新增：颜色转换结果色条样式（核心修改） */
.convert-color-bar {
    width: 100%;
    height: 50px; /* 桌面端高度50px */
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* 渐变色 */
.gradient-section {
    margin-bottom: 40px;
}
.gradient-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}
.gradient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}
.gradient-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.gradient-preview {
    height: 80px;
    cursor: pointer;
}
.gradient-info {
    padding: 15px;
    background: #fff;
}
.gradient-code {
    font-size: 12px;
    color: #28a745;
    word-break: break-all;
}

/* 详细颜色表 */
.extended-color-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 12px;
}
.extended-color-table td {
    padding: 4px;
    border: 1px solid #eee;
    text-align: center;
}
.extended-color-table .color-block {
    width: 30px;
    height: 30px;
    display: inline-block;
    border-radius: 2px;
    cursor: pointer;
}
.extended-color-table .color-code {
    margin-top: 4px;
    font-family: monospace;
}
.color-section-title {
    margin: 20px 0 10px;
    font-size: 16px;
    color: #333;
    font-weight: bold;
    border-left: 4px solid #28a745;
    padding-left: 8px;
}

/* 工具导航 */
.tool-nav-card {
    margin: 20px auto;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    max-width: 1920px;
    width: 96%;
    box-sizing: border-box;
}
.tool-nav-card h3 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #333;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* ========== 响应式（优化手机端适配） ========== */
@media (max-width: 767px) {
    /* 核心：取消最小宽度限制，适配手机屏幕 */
    html, body {
        min-width: unset;
        overflow-x: hidden;
    }
    
    /* 容器适配手机 */
    .container {
        width: 100%;
        padding: 15px !important;
        margin: 10px auto !important;
        border-radius: 8px !important;
    }
    
    /* 导航栏适配 */
    .navbar {
        padding: 10px 15px !important;
    }
    .navbar-container {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }
    .navbar-menu {
        gap: 10px !important;
        flex-wrap: wrap !important;
        width: 100% !important;
    }
    .navbar-menu a {
        font-size: 12px !important;
    }
    
    /* 标题适配 */
    .color-header h1 {
        font-size: 22px !important;
    }
    
    /* 标签按钮适配 */
    .color-tab {
        padding: 8px 16px !important;
        font-size: 14px !important;
        margin-bottom: 10px !important;
    }
    
    /* 取色器区域适配 */
    .color-picker-section,
    .color-search {
        padding: 20px 15px !important;
        max-width: 100% !important;
    }
    .picker-preview {
        height: 80px !important;
        font-size: 18px !important;
    }
    #nativeColorPicker {
        width: 140px !important;
        height: 50px !important;
    }
    
    /* 搜索按钮适配（手机端占满宽度） */
    .search-btn {
        width: 100% !important;
    }
    
    /* 颜色结果块适配 */
    .result-color {
        width: 50px !important;
        height: 50px !important;
    }
    
    /* 颜色单元格适配 */
    .color-cell {
        height: 40px !important;
        font-size: 10px !important;
    }
    
    /* 渐变色网格适配（手机端单列） */
    .gradient-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* 色条适配（手机端高度50px） */
    .convert-color-bar {
        height: 50px !important;
    }
    
    /* 工具导航卡片适配 */
    .tool-nav-card {
        width: 100% !important;
        padding: 10px !important;
    }
    
    /* 颜色转换区域适配 */
    .color-converter {
        padding: 15px !important;
    }
    .converter-form {
        grid-template-columns: 1fr !important;
    }
    .result-box {
        padding: 10px !important;
    }
    
    /* 表格适配（手机端横向滚动更友好） */
    .color-table-wrap {
        margin-bottom: 20px !important;
    }
    .color-table {
        min-width: unset !important;
        width: 100% !important;
    }

    /* 1. 修复复制按钮在手机端换行挤压问题 */
    .picker-result p {
        flex-direction: column; /* 手机端键值对垂直排列，避免复制按钮换行 */
        align-items: flex-start;
        gap: 8px;
    }
    .copy-btn {
        margin-left: 0; /* 取消左边距，垂直排列更美观 */
        padding: 6px 12px;
        font-size: 12px;
    }

    /* 2. 优化搜索结果文字大小，避免手机端文字溢出 */
    .result-info p {
        font-size: 14px !important;
    }
    .result-code {
        font-size: 14px !important;
    }

    /* 3. 优化取色器结果区域内边距，适配手机窄屏 */
    .picker-result {
        padding: 15px !important;
    }
    .picker-result p {
        font-size: 14px !important;
    }
    .picker-code {
        font-size: 16px !important;
    }

    /* 4. 优化渐变色卡片预览高度，手机端更紧凑 */
    .gradient-preview {
        height: 60px !important;
    }

    /* 5. 修复导航栏粘性定位在手机端的小问题（可选） */
    .navbar {
        position: sticky;
        top: 0;
        z-index: 999;
        width: 100%; /* 确保导航栏占满手机屏幕宽度 */
    }
}