/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 导航栏样式 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav {
    padding: 1rem;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-size: 1.5rem;
    color: #333;
    text-decoration: none;
    font-weight: bold;
}

.nav-menu ul {
    display: flex;
    list-style: none;
}

.nav-menu li a {
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
}

.nav-menu li a:hover {
    color: #007bff;
}

.nav-right a {
    margin-left: 1rem;
    text-decoration: none;
}

.login-btn {
    color: #007bff;
}

.register-btn {
    color: #fff;
    background-color: #007bff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

/* 主要内容区样式 */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* 介绍部分样式 */
.intro-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.intro-item {
    margin-bottom: 1.5rem;
}

.intro-item:last-child {
    margin-bottom: 0;
}

.intro-item h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* 计算器容器样式 */
.calculator-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 标签按钮样式 */
.calc-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background: none;
    color: #666;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #007bff, #0056b3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    border-radius: 6px;
}

.tab-btn span {
    position: relative;
    z-index: 2;
}

.tab-btn:hover {
    color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(45deg, #007bff, #0056b3);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-btn:not(.active):hover {
    transform: translateY(-2px);
}

/* 表单样式 */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-weight: 500;
    color: #2c3e50;
}

.input-field input {
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-field input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.input-tip {
    font-size: 0.9rem;
    color: #666;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.calculate-btn, .clear-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.calculate-btn {
    background-color: #007bff;
    color: #fff;
    flex: 2;
}

.calculate-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.clear-btn {
    background-color: #f8f9fa;
    color: #666;
    flex: 1;
}

.clear-btn:hover {
    background-color: #e2e6ea;
}

/* 结果显示样式 */
.results {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.result-item {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.result-details {
    border-top: 1px solid #ddd;
    padding-top: 1rem;
}

/* 公式部分样式 */
.formula-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.formula-item {
    margin-bottom: 2rem;
}

.formula-item:last-child {
    margin-bottom: 0;
}

.formula-item h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.formula-item p {
    font-family: "Courier New", monospace;
    margin-bottom: 0.5rem;
}

.formula-item ul {
    list-style-type: none;
    margin-left: 1rem;
}

/* 广告容器样式 */
.ad-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.ad-content {
    background-color: #f8f9fa;
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
}

/* 底部版权样式 */
.footer {
    background-color: #333;
    color: #fff;
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer a {
    color: #fff;
    text-decoration: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu.active {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        z-index: 100;
    }

    .nav-menu.active ul {
        flex-direction: column;
    }

    .nav-menu.active li {
        margin: 0.5rem 0;
    }

    .calc-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tab-btn {
        width: 100%;
        padding: 0.8rem 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .calculate-btn, .clear-btn {
        width: 100%;
    }
}

/* 下拉框样式 */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0.8rem 2.5rem 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    width: 100%;
    color: #333;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1rem;
    transition: all 0.3s ease;
}

select:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* 下拉选项样式 */
select option {
    padding: 0.8rem;
    font-size: 1rem;
    background-color: #fff;
    color: #333;
}

select option:hover {
    background-color: #f8f9fa;
}

/* 下拉框容器样式 */
.select-container {
    position: relative;
    width: 100%;
}

/* 添加悬浮效果 */
.input-field:hover select {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

/* 下拉框组样式 */
.select-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* 添加标签样式 */
.select-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 768px) {
    select {
        padding: 0.7rem 2rem 0.7rem 0.8rem;
        font-size: 0.95rem;
    }

    .select-group {
        flex-direction: column;
    }
}

/* 美化下拉框选项的数学符号 */
select option[value="k^2"]::before {
    content: "k²: ";
}

select option[value="k^3"]::before {
    content: "k³: ";
}

/* 添加动画效果 */
@keyframes selectFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

select:focus {
    animation: selectFocus 0.3s ease;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    select {
        background-color: #2c3e50;
        color: #fff;
        border-color: #34495e;
    }

    select option {
        background-color: #2c3e50;
        color: #fff;
    }

    select:hover {
        border-color: #3498db;
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
    }
}

/* 添加选择框的激活状态样式 */
.input-field.active select {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* 优化下拉框的可读性 */
select option {
    line-height: 1.5;
    padding: 0.8rem;
}

/* 添加下拉框的禁用状态样式 */
select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 添加下拉框的错误状态样式 */
select.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* 添加下拉框的成功状态样式 */
select.success {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
} 