/* 复用参考文件的 CSS 变量和基础样式 */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #7209b7;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    /* 换算器主题色 */
    --unit-bg: #ffffff;
    --border-radius: 12px;
    --box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f0f2f5;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.logo span {
    color: var(--success-color);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 25px;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--transition);
}

nav a:hover, nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 主内容区 */
main {
    padding: 40px 0;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--accent-color);
}

/* 工具卡片 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.tool-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.tool-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.tool-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.tool-card h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.tool-card p {
    color: var(--gray-color);
    margin-bottom: 20px;
}

.use-tool-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.use-tool-btn:hover {
    background-color: var(--secondary-color);
}

/* 工具详情 */
.tool-detail {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin-top: 30px;
    display: none;
}

.tool-detail.active {
    display: block;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f2f5;
}

.tool-header h2 {
    font-size: 1.6rem;
    color: var(--secondary-color);
}

.close-tool {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-color);
    cursor: pointer;
    transition: var(--transition);
}

.close-tool:hover {
    color: var(--warning-color);
}

/* 换算器布局 */
.converter-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.converter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.section-head {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.unit-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: var(--transition);
}

.unit-row:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.unit-label {
    width: 100px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
    flex-shrink: 0;
}

.unit-symbol {
    font-size: 0.8rem;
    color: var(--gray-color);
    display: block;
}

.unit-input-wrapper {
    flex: 1;
    position: relative;
}

.unit-input {
    width: 100%;
    border: none;
    font-size: 1.1rem;
    font-family: 'Consolas', monospace;
    color: var(--primary-color);
    text-align: right;
    outline: none;
    background: transparent;
}

.unit-input::placeholder {
    color: #ccc;
}

.clear-actions {
    margin-top: 20px;
    text-align: right;
}

.btn-outline {
    padding: 8px 20px;
    background: white;
    border: 1px solid #e0e0e0;
    color: var(--gray-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline:hover {
    border-color: var(--warning-color);
    color: var(--warning-color);
}