* {
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
}

.header-Title {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(to right, #1a2980, #26d0ce);
    color: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(246, 4, 4, 0.1);
}

.header-Title h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.header-Title p {
    margin: 8px 0 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* 收藏按钮样式 */
.favorite-button {
    background-color: #1a2a6c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.favorite-button:hover {
    background-color: #4a90e2;
    transform: translateY(-1px);
}

.favorite-button.favorited {
    background-color: #fdbb2d;
    color: #1a2a6c;
}

/* 登录弹窗样式 */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.login-modal-content {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 450px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.login-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.login-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.login-modal-close:hover {
    background-color: #e9ecef;
}

/* 选项卡样式 */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 15px;
    cursor: pointer;
    color: #333;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab.active {
    background: white;
    border-bottom: 3px solid #fdbb2d;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* 表单容器样式 */
.form-container {
    padding: 30px;
}

.form {
    display: none;
}

.form.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 表单组样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-with-icon input:focus {
    border-color: #1a2a6c;
    outline: none;
}

/* 按钮样式 */
.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(to right, #1a2a6c, #4a90e2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: linear-gradient(to right, #4a90e2, #1a2a6c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: linear-gradient(to right, #b21f1f, #fdbb2d);
}

.btn-secondary:hover {
    background: linear-gradient(to right, #fdbb2d, #b21f1f);
}

/* 提示信息样式 */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #28a745;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-message.show {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    text-align: center;
    margin: 20px 0 10px;
    font-size: 1.3rem;
    color: #333;
    font-weight: bold;
}

.control-panel {
    margin: 10px auto;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(246, 4, 4, 0.1);
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: center;
    max-width: 800px;
}

.valuation-control-panel {
    margin: 10px auto;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(246, 4, 4, 0.1);
    /* max-width: 800px; */
    /* 新增：确保面板本身在父容器中居中 */
    width: fit-content;
}

.valuation-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    /* 增加间距让布局更舒展 */
    align-items: center;
    justify-content: center;
    /* 新增：确保行容器宽度适合内容 */
    width: 100%;
}

.valuation-control-group {
    flex: 0 0 auto;
    min-width: 130px;
    /* 增加最小宽度确保内容不拥挤 */
    /* 新增：内部元素居中对齐 */
    text-align: center;
}

/* 调整标题和内容的对齐方式 */
.control-title {
    display: block;
    margin: 0 0 15px 20px;
    /* 去除左侧margin */
    font-weight: bold;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.radio-group {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    /* 单选按钮组居中 */
}

.metric-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    /* 指标按钮居中 */
}

/* 确保数值类型和显示年限始终在同一行 */
.valuation-control-group.value-type,
.valuation-control-group.display-years {
    flex-shrink: 0;
}

/* 指标选择容器 */
.valuation-control-group.metrics {
    flex: 1;
    min-width: 280px;
}

.control-title {
    display: block;
    margin-left: 5px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.radio-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.metric-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.metric-btn {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.metric-btn.active {
    background: #1a2980;
    color: white;
    border-color: #1a2980;
}

select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

.charts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.chart-container {
    width: 100%;
    height: 300px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(246, 4, 4, 0.1);
    position: relative;
    overflow: hidden;
}

#chart-industry-pe,
#chart-industry-pb,
#chart-valuation {
    width: 100%;
    height: 100%;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
    flex-direction: column;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}

.loading-text {
    font-size: 14px;
    color: #3498db;
    font-weight: bold;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .header-Title {
        padding: 15px 0;
    }

    .header-Title h1 {
        font-size: 1.4rem;
    }

    .header-Title p {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .control-panel {
        padding: 8px;
        gap: 8px;
        margin: 8px auto;
    }

    .control-group,
    .valuation-control-group {
        min-width: 100px;
    }

    .chart-container {
        height: 280px;
    }

    select {
        padding: 7px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header-Title {
        padding: 12px 0;
    }

    .header-Title h1 {
        font-size: 1.2rem;
    }

    .header-Title p {
        font-size: 0.8rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .chart-container {
        height: 260px;
    }

    .control-title {
        font-size: 12px;
    }
}