/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    padding: 12px 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.nav-logo a {
    text-decoration: none;
    color: #fff;
}

.nav-logo h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 0.9em;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-weight: 600;
}

/* 主容器 */
.calculator-main {
    background: #f8fafc;
    height: calc(100vh - 80px);
    padding: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.calculator-container {
    max-width: 1600px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 计算器主体布局 */
.calc-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

/* 左侧输入区 */
.calc-left {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    overflow-x: hidden;
}

.page-title h1 {
    color: #1a5f7a;
    font-size: 1.1em;
    margin: 0 0 2px 0;
    font-weight: 700;
}

.subtitle {
    color: #159895;
    font-size: 0.7em;
    margin: 0 0 6px 0;
}

/* 输入区域 */
.input-section {
    margin-bottom: 6px;
    flex-shrink: 0;
}

.input-content {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.input-section h3 {
    color: #1a5f7a;
    font-size: 0.75em;
    margin: 0 0 4px 0;
    padding-bottom: 3px;
    border-bottom: 2px solid #e8f4f8;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 5px;
}

.form-group {
    margin-bottom: 3px;
}

.form-group label {
    display: block;
    color: #333;
    font-size: 0.65em;
    font-weight: 500;
    margin-bottom: 2px;
}

.input-with-unit {
    display: flex;
    gap: 2px;
}

.input-with-unit input {
    flex: 1;
    max-width: 30%;
    padding: 5px 6px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.7em;
    transition: all 0.3s;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #159895;
    box-shadow: 0 0 0 3px rgba(21, 152, 149, 0.1);
}

.unit-selector {
    padding: 5px 4px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.65em;
    background: #fff;
    cursor: pointer;
    min-width: 55px;
    flex-shrink: 0;
}

.unit-selector:focus {
    outline: none;
    border-color: #159895;
}

.hint {
    display: block;
    color: #999;
    font-size: 0.6em;
    margin-top: 0px;
}

/* 计算按钮 */
.calculate-btn {
    width: 100%;
    padding: 7px;
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 3px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(21, 152, 149, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* 中间结果区 */
.calc-center {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.calc-center h2 {
    color: #1a5f7a;
    font-size: 1em;
    margin: 0 0 8px 0;
    font-weight: 600;
    flex-shrink: 0;
}

.results-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-content: start;
}

.placeholder {
    color: #999;
    text-align: center;
    padding: 40px 15px;
    font-size: 0.8em;
    grid-column: 1 / -1;
}

.result-item {
    background: #f8fafc;
    border-left: 4px solid #159895;
    padding: 6px 8px;
    border-radius: 0 5px 5px 0;
}

.result-label {
    color: #666;
    font-size: 0.7em;
    margin-bottom: 2px;
}

.result-value {
    color: #1a5f7a;
    font-size: 1em;
    font-weight: 700;
}

.result-unit {
    color: #999;
    font-size: 0.7em;
    margin-left: 2px;
}

/* 右侧图表区 */
.calc-right {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.calc-right h2 {
    color: #1a5f7a;
    font-size: 1em;
    margin: 0 0 8px 0;
    font-weight: 600;
    flex-shrink: 0;
}

.chart-controls {
    margin-bottom: 8px;
    flex-shrink: 0;
}

.chart-control-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
}

.chart-control-row label {
    color: #666;
    font-size: 0.7em;
    min-width: 55px;
    flex-shrink: 0;
}

.chart-selector {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 0.7em;
    background: #fff;
    cursor: pointer;
}

.chart-selector:focus {
    outline: none;
    border-color: #159895;
}

.chart-btn {
    width: 100%;
    padding: 6px;
    background: #159895;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.75em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.chart-btn:hover {
    background: #1a5f7a;
}

.chart-container {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* 公式切换按钮 */
.formula-toggle {
    text-align: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.toggle-btn {
    padding: 6px 16px;
    background: #fff;
    color: #159895;
    border: 2px solid #159895;
    border-radius: 25px;
    font-size: 0.75em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-btn:hover {
    background: #159895;
    color: #fff;
}

/* 公式区域 */
.formula-section {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.formula-section h3 {
    color: #1a5f7a;
    font-size: 1em;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.formula-box {
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px;
    border-left: 4px solid #159895;
}

.formula-box h4 {
    color: #1a5f7a;
    font-size: 0.85em;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.formula {
    background: #fff;
    padding: 8px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    color: #333;
    margin-bottom: 6px;
    overflow-x: auto;
}

.formula-box ul {
    margin: 0;
    padding-left: 16px;
    color: #666;
    font-size: 0.7em;
    line-height: 1.4;
}

.formula-box li {
    margin-bottom: 2px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .calc-body {
        grid-template-columns: 1fr 1fr;
    }

    .calc-right {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 12px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .calculator-main {
        padding: 16px;
    }

    .calc-body {
        grid-template-columns: 1fr;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

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

    .chart-container {
        height: 250px;
    }
}
