/* 新增强化样式 */
:root {
    --primary: #87CEEB;      /* 天蓝主色 */
    --secondary: #98FB98;    /* 浅绿辅色 */
    --background: #FFFFFF;   /* 白色背景 */
    --text: #2C3E50;         /* 主文字色 */
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
}

/* 首页专用样式 */
.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-banner h2 {
    margin-top: 0;
    font-size: 2rem;
}

.welcome-banner p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.tool-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.category-header {
    background: var(--primary);
    color: white;
    margin: 0;
    padding: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.category-header .icon {
    margin-right: 0.5rem;
    font-size: 1.5rem;
}

.tool-list {
    padding: 0.5rem;
}

.tool-item {
    display: block;
    padding: 0.8rem;
    margin: 0.3rem 0;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text);
    text-decoration: none;
}

.tool-item:hover {
    background: #f0f7ff;
    transform: translateX(5px);
}

.tool-name {
    font-weight: bold;
    display: block;
}

.tool-desc {
    font-size: 0.9rem;
    color: #666;
    display: block;
}

.featured-tools {
    margin-bottom: 3rem;
}

.featured-tools h3 {
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.featured-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.featured-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.featured-card h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.featured-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.main-footer {
    background: #f5f5f5;
    padding: 1.5rem;
    text-align: center;
    margin-top: 2rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-container p {
    margin: 0.5rem 0;
    color: #666;
}

@media (max-width: 768px) {
    .tool-categories {
        grid-template-columns: 1fr;
    }

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

    .welcome-banner {
        padding: 1.5rem;
    }

    .welcome-banner h2 {
        font-size: 1.5rem;
    }

    .welcome-banner p {
        font-size: 1rem;
    }
}

.main-nav {
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: var(--primary);
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: var(--primary);
    color: white;
}

.nav-links a.active {
    background: var(--secondary);
    color: var(--text);
}

/* 导航栏下拉菜单样式 */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropbtn {
    background: transparent;
    color: springgreen;
    border: none;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.dropdown-arrow {
    font-size: 0.6rem;
    margin-left: 0.3rem;
    transition: transform 0.3s;
}

.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background: white;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 0 0 4px 4px;
    overflow: hidden;
}

.nav-dropdown.active .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    color: var(--text);
    padding: 0.8rem 1rem;
    text-decoration: none;
    display: block;
    text-align: left;
    transition: background 0.2s;
}

.nav-dropdown-content a:hover {
    background: #f0f7ff;
}

.nav-dropdown-content a.active {
    background: var(--secondary);
    color: var(--text);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .nav-dropdown {
        display: block;
        width: 100%;
    }

    .nav-dropdown-content {
        position: static;
        box-shadow: none;
        border-radius: 0;
    }
}

/* 工具容器 */
.tool-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.tool-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-3px);
}

.tool-header {
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

/* 输入输出样式 */
.input-group {
    margin: 1.5rem 0;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.text-input:focus {
    border-color: var(--secondary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(135,206,235,0.2);
}

/* 按钮样式 */
.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #6CB4EE;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover {
    background: #90EE90;
}

/* 身份证校验页面专用样式 */
#idCardInput {
    font-family: monospace;
    letter-spacing: 1px;
}

#idCardResult {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed #ddd;
}

.result-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

/* 温度转换页面专用样式 */
.converter-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.swap-btn {
    background: var(--primary);
    color: white;
    padding: 0.5rem;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem 0;
}

.swap-btn:hover {
    background: var(--secondary);
    color: var(--text);
}

.comparison-table {
    margin-top: 1rem;
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid #ddd;
}

.comparison-table th {
    background: var(--primary);
    color: white;
}

.comparison-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* 温度转换页面专用样式 */
.converter-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
}

.swap-icon {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 0.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.swap-icon:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.reference-box {
    margin-top: 2rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
}

.reference-box h3 {
    margin-top: 0;
    color: var(--primary);
}

.reference-box table {
    width: 100%;
    border-collapse: collapse;
}

.reference-box th,
.reference-box td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid #ddd;
}

.reference-box th {
    background: var(--primary);
    color: white;
}

.reference-box tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* 长度转换页面专用样式 */
.multi-converter {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.unit-group {
    margin-bottom: 1rem;
}

.unit-input {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .multi-converter {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .multi-converter {
        grid-template-columns: 1fr;
    }
}

/* 面积和体积转换页面共用样式 */
.multi-converter {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.unit-group {
    margin-bottom: 1rem;
}

.unit-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95rem;
}

.info-box {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
}

.info-box h3 {
    margin-top: 0;
    color: var(--primary);
}

.info-box ul {
    padding-left: 1.5rem;
    margin-bottom: 0;
}

.info-box li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .multi-converter {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .multi-converter {
        grid-template-columns: 1fr;
    }

    .info-box {
        padding: 1rem;
    }
}

/* 能量转换页面专用样式 */
.energy-unit {
    font-size: 0.9em;
    color: #666;
}

/* 进制转换页面专用样式 */
.base-converter {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.base-example {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .base-converter {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .base-converter {
        grid-template-columns: 1fr;
    }
}

/* 大小写转换和字符串混淆页面共用样式 */
.tool-card {
    max-width: 800px;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.btn {
    min-width: 120px;
}

.info-box {
    margin-top: 2rem;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
}

.info-box h3 {
    margin-top: 0;
    color: var(--primary);
}

.info-box ul {
    padding-left: 1.5rem;
    margin-bottom: 0;
}

.info-box li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* 字符串混淆页面专用样式 */
#modeBtn {
    background: var(--secondary);
    color: var(--text);
}

/* 随机数生成器页面专用样式 */
.result-box {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin: 1.5rem 0;
}

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

.history-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 0.5rem;
    border-radius: 4px;
    background: white;
}

.history-item {
    padding: 0.3rem 0;
    border-bottom: 1px dashed #eee;
}

.history-item:last-child {
    border-bottom: none;
}

/* ASCII码表页面专用样式 */
.search-box {
    margin-bottom: 1.5rem;
}

.ascii-table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.ascii-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ascii-table th,
.ascii-table td {
    padding: 0.6rem;
    text-align: center;
    border: 1px solid #ddd;
}

.ascii-table th {
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
}

.ascii-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.ascii-table tr:hover {
    background-color: #e6f7ff;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .ascii-table {
        font-size: 0.8rem;
    }

    .ascii-table th,
    .ascii-table td {
        padding: 0.4rem;
    }
}

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

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 1rem;
    }
}