/* 基础样式 */
.calculator-container {
    /* use full width to reduce large side whitespace on this page */
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 1rem 1rem; /* reduced horizontal padding */
    color: #333;
    font-family: 'Arial', sans-serif;
}

.calculator-container h1 {
    color: #2c3e50;
    text-align: center;
    margin: 0 auto 2rem auto;
    font-size: 2.5rem;
    position: relative;
    padding-bottom: 1rem;
    max-width: 1200px; /* keep title width similar to full-layout */
}

.calculator-container h1:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: #3498db;
}

/* 子页面选择 卡片式样式 （大气视觉） */
.subpages-cards {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: stretch;
    margin: 1rem auto 2rem auto;
    max-width: 960px;
}

.subpage-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1 1 45%;
    background: linear-gradient(135deg, #ffffff 0%, #f4f7fb 100%);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 12px 30px rgba(15, 30, 60, 0.08);
    text-decoration: none;
    color: #213547;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(33,53,71,0.06);
}

.subpage-card .card-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#eaf4ff 0,#fff 100%);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(34,77,138,0.06) inset;
}

.subpage-card .card-body {
    flex: 1 1 auto;
}

.subpage-card .card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #16324a;
}

.subpage-card .card-desc {
    font-size: 0.92rem;
    color: #4b6b82;
    margin-top: 4px;
}

.subpage-card .card-action {
    font-size: 0.9rem;
    color: #0b69d0;
    font-weight: 700;
    white-space: nowrap;
}

.subpage-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 18px 40px rgba(15, 30, 60, 0.12);
}

.subpage-card.active {
    border: 1px solid rgba(11,105,208,0.14);
}

@media (max-width: 760px) {
    .subpages-cards { flex-direction: column; }
    .subpage-card { flex: 1 1 auto; }
}

/* 选项卡风格 */
.tabs-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 18px;
}
.tab-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(180deg,#ffffff,#f7fbff);
    border: none;
    padding: 16px 22px;
    border-radius: 14px;
    font-weight: 700;
    color: #0f2a3a;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
    min-width: 320px;
    box-shadow: 0 8px 30px rgba(12,40,70,0.06);
}
.tab-btn:hover { transform: translateY(-6px); box-shadow: 0 20px 50px rgba(12,40,70,0.12); }
.tab-btn .tab-icon { font-size: 28px; width:48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:10px; background: linear-gradient(135deg,#eaf6ff,#ffffff); box-shadow: inset 0 4px 8px rgba(0,0,0,0.03); }
.tab-btn .tab-text { text-align: left; }
.tab-btn .tab-title { font-size: 1.08rem; color: #072033; font-weight:800; }
.tab-btn .tab-desc { font-size: 0.86rem; color: #3b5a6e; margin-top: 2px; font-weight:600; }
.tab-btn .tab-badge { margin-left:auto; background: transparent; color:#0b69d0; font-weight:800; padding:6px 8px; border-radius:8px; border:1px solid rgba(11,105,208,0.12); }
.tab-btn.active { background: linear-gradient(90deg,#0b69d0 0%, #2c98f2 100%); color:#fff; box-shadow: 0 28px 60px rgba(11,105,208,0.14); }
.tab-btn.active .tab-badge { background: rgba(255,255,255,0.14); color:#fff; border-color: rgba(255,255,255,0.12); }
.tab-btn.active .tab-title, .tab-btn.active .tab-desc { color: #fff; }

.tab-panel { display: block; }
.tab-hidden { display: none; }

@media (max-width: 920px) {
    .tabs-container { flex-direction: column; gap:12px; align-items: stretch; }
    .tab-btn { min-width: auto; padding: 14px; }
    .tab-btn .tab-text { text-align: left; }
}

/* 频率子选项样式 */
.freq-subtabs { justify-content: flex-start; }
.freq-subtab { padding: 8px 12px; border-radius: 8px; background: #f1f5f9; border: 1px solid rgba(15,30,60,0.04); cursor:pointer; font-weight:700 }
.freq-subtab.active { background: linear-gradient(90deg,#0b69d0,#2c98f2); color:#fff; box-shadow:0 12px 30px rgba(11,105,208,0.12) }
.freq-result-inline { text-align:center; margin-bottom:8px }
.freq-canvas { width:100%; height:360px }
.freq-table { margin-top:12px }

/* 下拉样式 */
#freq-select { padding:8px 10px; border-radius:8px; border:1px solid #d7e6f6; background: #fff; font-weight:700 }

/* 表单样式 */
.calculator-form {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3498db;
    outline: none;
}

button[type="submit"] {
    background: linear-gradient(to right, #3498db, #2c3e50);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

/* 应用主容器布局 */
.app-container {
    display: flex;
    flex-direction: column; /* stack vertically: form on top, chart below */
    gap: 1.5rem;
    align-items: center;
}

/* 外层卡片容器，包裹三块内容 */
.panels-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    margin: 0 auto 2rem auto;
    max-width: 960px; /* match the design's content width */
}

/* 面板视觉合并：去除单独面板的白底（保持内部 padding） */
.panels-box .calculator-panel,
.panels-box .chart-panel,
.panels-box .table-panel {
    background: transparent;
    box-shadow: none;
    padding: 0; /* panels will use inner sections' padding */
}

.panels-box .calculator-form,
.panels-box .chart-container,
.panels-box .table-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: none;
}

/* 表单行：标签固定宽度、输入自适应，桌面端两列排列风格 */
.panels-box .calculator-form .form-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.panels-box .calculator-form .form-group label {
    width: 180px;
    text-align: right;
    padding-right: 0.5rem;
    color: #2c6ef2; /* 附图中有蓝色标签，给出轻微强调色 */
    font-weight: 600;
}

.panels-box .calculator-form .form-group input,
.panels-box .calculator-form .form-group select {
    flex: 1 1 auto;
    max-width: 420px;
}

/* 提交按钮：较大的蓝色矩形，居中 */
.panels-box .calculator-form button[type="submit"] {
    display: inline-block;
    width: 140px;
    max-width: none;
    margin: 1rem auto 0 auto;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    background: #1976d2;
    box-shadow: none;
}

/* 小屏幕回退：标签堆叠，行内布局变为纵向 */
@media (max-width: 640px) {
    .panels-box .calculator-form .form-group {
        display: block;
    }

    .panels-box .calculator-form .form-group label {
        width: auto;
        text-align: left;
        display: block;
        margin-bottom: 0.5rem;
    }
}

.calculator-panel {
    /* left form column */
    flex: 0 0 28%; /* slightly narrower to give center more room */
    background: #f8f9fa;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chart-panel {
    /* make chart-panel full width inside the panels-box */
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.table-panel {
    /* table will appear below chart in stacked layout */
    width: 100%;
}

/* 结果区域 */
.results h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.chart-container {
    width: 100%;
    max-width: 820px; /* similar to design's large chart width within the card */
    height: 360px; /* chart height closer to design */
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.table-container {
    flex: 1;
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* allow table to expand naturally without internal scrolling */
    height: auto;
    overflow-y: visible;
}

.chart-container canvas,
.table-container table {
    width: 100%;
    height: 100%;
}

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

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .calculator-form {
        padding: 1.5rem;
    }
}

/* Stack panels vertically on medium and small screens */
@media (max-width: 900px) {
    .calculator-panel,
    .chart-panel,
    .table-panel {
        flex: 0 0 100%;
        max-width: 100%;
    }

    button[type="submit"] {
        width: 100%;
        max-width: none;
    }
}