/* 头部区域样式 */
.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: 900px;
    margin: 0 auto;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    display: inline-block;
    padding: 10px 20px 10px 16px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
    text-align: center;
    direction: ltr;
    line-height: normal;
}

.tab-btn:hover {
    background: #f5f5f5;
    border-color: #2563eb;
    color: #2563eb;
}

.tab-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.tab-btn i {
    font-size: 14px;
    margin-right: 6px;
    vertical-align: baseline;
    line-height: 1;
}

/* 换算区域 */
.converter-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    margin-bottom: 25px;
}

.converter-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr;
    gap: 15px;
    align-items: end;
    margin-bottom: 25px;
}

.input-group label,
.unit-select-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.unit-select {
    width: 100%;
    padding: 14px 35px 14px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.unit-select:focus {
    border-color: #2563eb;
    outline: none;
}

.swap-btn-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 0;
}

.btn-swap {
    width: 44px;
    height: 44px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-swap:hover {
    background: #2563eb;
    color: white;
    transform: rotate(180deg);
}

/* 结果区域 */
.result-section {
    background: #2563eb;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    color: white;
}

.result-value {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    font-family: 'Consolas', monospace;
}

.result-unit {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 15px;
}

.btn-copy {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 常用换算表 */
.quick-table-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;
}

.quick-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.table-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.table-item .value {
    font-weight: 600;
    color: #2563eb;
}

/* 使用说明 */
.info-section {
    max-width: 900px;
    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;
    }

    .category-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 10px 15px 10px 10px;
    }

    .converter-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .swap-btn-wrapper {
        order: 2;
    }

    .btn-swap {
        width: 100%;
        border-radius: 10px;
    }

    .result-value {
        font-size: 32px;
    }

    .quick-table {
        grid-template-columns: 1fr;
    }
}
