/* All-in-One Health Calculator - Unified Stylesheet */
/* Version 1.1.0 */

/* --- 核心变量 --- */
:root {
    --calc-text-color: #1a202c;
    --calc-heading-text-color: #333333;
    --calc-card-bg: rgba(255, 255, 255, 0.4);
    --calc-card-border-color: rgba(255, 255, 255, 0.5);
    --calc-input-bg: rgba(255, 255, 255, 0.75);
    --calc-input-border: rgba(200, 200, 200, 0.6);
    --calc-input-focus-border-color: #00AFFF;
    --calc-primary-btn-bg: linear-gradient(90deg, #00AFFF 0%, #A777E8 100%);
    --calc-link-color: #00AFFF;
    --calc-card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --calc-card-hover-shadow: 0 10px 40px 0 rgba(31, 38, 135, 0.25);
    --calc-btn-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.1);
    --calc-btn-hover-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.15);
    --calc-input-focus-shadow: 0 0 0 3px rgba(0, 175, 255, 0.25);
    --calc-btn-hover-filter: saturate(1.1) brightness(1.05);
    --calc-bmi-underweight: #3498db;
    --calc-bmi-normal: #2ecc71;
    --calc-bmi-overweight: #f1c40f;
    --calc-bmi-obese1: #e67e22;
    --calc-bmi-obese2: #c0392b;
}

/* --- 主包装器和字体 --- */
.health-calc-wrapper {
    max-width: 1152px;
    margin: 20px auto;
    padding: 20px;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    color: var(--calc-text-color);
    line-height: 1.6;
}

.health-calc-wrapper .cpc-plugin-wrapper, 
.health-calc-wrapper .bfp-calc-wrapper {
    margin: 0;
    padding: 0;
    width: 100%; 
    max-width: 100%;
}

/* --- 选项卡样式 --- */
.health-calc-wrapper .calculator-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    gap: 10px;
    flex-wrap: wrap;
}

.health-calc-wrapper .tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid var(--calc-card-border-color);
    background-color: var(--calc-card-bg);
    color: var(--calc-text-color);
    border-radius: 12px;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: var(--calc-btn-shadow);
}

.health-calc-wrapper .tab-link:hover {
    background-color: rgba(255, 255, 255, 0.5);
    box-shadow: var(--calc-btn-hover-shadow);
    transform: translateY(-2px);
}

.health-calc-wrapper .tab-link.active {
    background-image: var(--calc-primary-btn-bg) !important;
    background-color: #00AFFF; /* Fallback color */
    color: white;
    border-color: transparent;
    box-shadow: var(--calc-btn-hover-shadow);
}

.health-calc-wrapper .tab-content {
    display: none;
}

.health-calc-wrapper .tab-content.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 通用卡片和表单样式 --- */
.health-calc-wrapper .rbf-title, 
.health-calc-wrapper .bfp-calc-title {
    color: var(--calc-heading-text-color);
    text-align: center;
    margin-top: 0;
    margin-bottom: 35px;
    font-size: 2.2rem;
    font-weight: 600;
}

.health-calc-wrapper .rbf-form fieldset, 
.health-calc-wrapper .bfp-calc-form fieldset, 
.health-calc-wrapper .rbf-results-container, 
.health-calc-wrapper .bfp-calc-results-container, 
.health-calc-wrapper .bmi-reference-table-container {
    background: var(--calc-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--calc-card-border-color);
    border-radius: 20px;
    box-shadow: var(--calc-card-shadow);
    padding: 2rem;
    margin-bottom: 30px;
    transition: all 0.3s ease-out;
}

.health-calc-wrapper .rbf-form fieldset:hover, 
.health-calc-wrapper .bfp-calc-form fieldset:hover, 
.health-calc-wrapper .rbf-results-container:hover, 
.health-calc-wrapper .bfp-calc-results-container:hover, 
.health-calc-wrapper .bmi-reference-table-container:hover {
    box-shadow: var(--calc-card-hover-shadow);
    transform: translateY(-3px);
}

.health-calc-wrapper .fieldset-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--calc-input-border);
}

.health-calc-wrapper .rbf-form legend, 
.health-calc-wrapper .bfp-calc-form legend {
    font-size: 1.75rem;
    color: var(--calc-heading-text-color);
    font-weight: 500;
    padding: 0;
    margin: 0;
    border-bottom: none;
    width: auto;
}

.health-calc-wrapper .legend-hint {
    font-size: 0.9em;
    font-style: italic;
    text-align: right;
    margin-left: 10px;
    flex-shrink: 0;
}

.health-calc-wrapper .form-row-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.health-calc-wrapper .rbf-form-group, 
.health-calc-wrapper .bfp-calc-form-group {
    flex: 1 1 calc(50% - 10px);
    margin-bottom: 20px;
}
.health-calc-wrapper .rbf-form-group-full-width {
    flex-basis: 100% !important;
}

.health-calc-wrapper .rbf-form-group label, 
.health-calc-wrapper .bfp-calc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9em;
}

.health-calc-wrapper .input-with-select {
    display: flex;
    gap: 8px;
}
.health-calc-wrapper .input-with-select input[type="number"] {
    flex: 1 1 70%;
    min-width: 100px;
}
.health-calc-wrapper .input-with-select select {
    flex: 1 1 30%;
    min-width: 80px;
    max-width: 100px;
}

.health-calc-wrapper input[type="number"], 
.health-calc-wrapper select {
    width: 100% !important;
    background-color: var(--calc-input-bg) !important;
    color: var(--calc-text-color) !important;
    border: 1px solid var(--calc-input-border) !important;
    border-radius: 10px !important;
    padding: 12px 15px !important;
    transition: all 0.25s ease !important;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03) !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
}

.health-calc-wrapper input[type="number"]:focus, 
.health-calc-wrapper select:focus {
    outline: none !important;
    border-color: var(--calc-input-focus-border-color) !important;
    box-shadow: var(--calc-input-focus-shadow) !important;
}

.health-calc-wrapper select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23555555%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 10px 10px !important;
    padding-right: 40px !important;
}

.health-calc-wrapper .form-buttons-group {
    margin-top: 30px !important;
}

.health-calc-wrapper .rbf-button, 
.health-calc-wrapper .bfp-calc-button {
    padding: 12px 24px !important;
    border-radius: 12px !important;
    font-weight: 500 !important;
    transition: all 0.25s ease-out !important;
    cursor: pointer;
    border: none !important;
    width: 100%;
    font-size: 1.05em;
    background: var(--calc-primary-btn-bg) !important;
    color: white !important;
    box-shadow: var(--calc-btn-shadow) !important;
}

.health-calc-wrapper .rbf-button:hover, 
.health-calc-wrapper .bfp-calc-button:hover {
    transform: translateY(-2px);
    filter: var(--calc-btn-hover-filter) !important;
    box-shadow: var(--calc-btn-hover-shadow) !important;
}

/* --- 结果和错误信息 --- */
.health-calc-wrapper .rbf-results-title, 
.health-calc-wrapper .bfp-calc-results-title {
    color: var(--calc-heading-text-color);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.75rem;
    border-bottom: 1px solid var(--calc-input-border);
    padding-bottom: 12px;
    font-weight: 500;
}

.health-calc-wrapper #bmi-result-value, 
.health-calc-wrapper #bmi-category-value, 
.health-calc-wrapper #bmi-ideal-weight-value,
.health-calc-wrapper #bmr-result-value, 
.health-calc-wrapper #tdee-result-value,
.health-calc-wrapper #bfp-result-value, 
.health-calc-wrapper #bfp-result-category {
    background: rgba(255, 255, 255, 0.2);
    padding: 1em 1.2em;
    border-radius: 12px;
    margin-bottom: 1em;
    font-size: 1.1em;
    border: 1px solid rgba(255,255,255,0.25);
    text-align: left;
}
.health-calc-wrapper #bmi-result-value strong, 
.health-calc-wrapper #bmi-category-value strong, 
.health-calc-wrapper #bmi-ideal-weight-value strong,
.health-calc-wrapper #bmr-result-value strong, 
.health-calc-wrapper #tdee-result-value strong,
.health-calc-wrapper #bfp-result-value strong, 
.health-calc-wrapper #bfp-result-category strong {
    font-weight: bold;
    margin-right: 8px;
}

.health-calc-wrapper .rbf-error-message, 
.health-calc-wrapper .bfp-calc-error-message {
    background-color: rgba(255, 126, 95, 0.3);
    color: #c82333;
    border: 1px solid rgba(255, 126, 95, 0.4);
    padding: 15px 20px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

/* --- 特定于计算器的样式 --- */
.health-calc-wrapper .calorie-goals-title {
    font-size: 1.15em; font-weight: 600; margin-top: 25px; margin-bottom: 18px;
    color: var(--calc-text-color); padding-bottom: 8px; border-bottom: 1px solid var(--calc-input-border);
}
.health-calc-wrapper .calorie-goal-item {
    background-color: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px; padding: 15px; margin-bottom: 15px; transition: all 0.2s ease-in-out;
}
.health-calc-wrapper .calorie-goal-item:hover {
    background-color: rgba(255, 255, 255, 0.15); transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(31, 38, 135, 0.08);
}
.health-calc-wrapper .calorie-goal-item p { margin-top: 0; margin-bottom: 8px; font-size: 1.05em; }
.health-calc-wrapper .calorie-goal-item .goal-description { font-size: 0.9em; color: #4a5568; line-height: 1.6; }

/* BMI 分类颜色 */
.health-calc-wrapper .bmi-underweight { color: var(--calc-bmi-underweight); font-weight: bold; }
.health-calc-wrapper .bmi-normal { color: var(--calc-bmi-normal); font-weight: bold; }
.health-calc-wrapper .bmi-overweight { color: var(--calc-bmi-overweight); font-weight: bold; }
.health-calc-wrapper .bmi-obese1 { color: var(--calc-bmi-obese1); font-weight: bold; }
.health-calc-wrapper .bmi-obese2 { color: var(--calc-bmi-obese2); font-weight: bold; }

/* BFP 和 BMI 参考表格 */
.health-calc-wrapper .bfp-calc-styled-table, 
.health-calc-wrapper .bmi-reference-table {
    width: 100%; border-collapse: collapse; font-size: 0.9em; margin-top: 10px;
}
.health-calc-wrapper .bfp-calc-styled-table th, 
.health-calc-wrapper .bfp-calc-styled-table td,
.health-calc-wrapper .bmi-reference-table th, 
.health-calc-wrapper .bmi-reference-table td {
    border: 1px solid var(--calc-input-border); padding: 10px 12px; text-align: left;
}
.health-calc-wrapper .bfp-calc-styled-table th, 
.health-calc-wrapper .bmi-reference-table th {
    background-color: rgba(255,255,255,0.1); font-weight: 600;
}
.health-calc-wrapper .bfp-calc-styled-table tbody tr:nth-child(even) { background-color: rgba(255,255,255,0.05); }
.health-calc-wrapper .bmi-reference-table-container h3 {
    font-size: 1.2em; margin-top: 0; margin-bottom: 15px;
    border-bottom: 1px solid var(--calc-input-border); padding-bottom: 10px; font-weight: 500;
}

/* --- 免责声明 --- */
.health-calc-wrapper .rbf-disclaimer {
    font-size: 0.9em; opacity: 0.88; background-color: rgba(255, 235, 59, 0.15);
    border-left: 5px solid rgba(255, 235, 59, 0.65); padding: 14px 18px;
    margin-top: 25px; border-radius: 12px; line-height: 1.55; backdrop-filter: blur(7px);
}
.health-calc-wrapper .rbf-disclaimer strong { color: #F57F17; font-weight: 600; }

/* --- 响应式设计 --- */
@media (max-width: 768px) {
    .health-calc-wrapper { 
        padding: 12px; 
        margin: 20px auto; 
    }
    .health-calc-wrapper .rbf-title, 
    .health-calc-wrapper .bfp-calc-title { font-size: 2rem; }
    
    .health-calc-wrapper .rbf-form fieldset, 
    .health-calc-wrapper .bfp-calc-form fieldset, 
    .health-calc-wrapper .rbf-results-container, 
    .health-calc-wrapper .bfp-calc-results-container, 
    .health-calc-wrapper .bmi-reference-table-container { padding: 1.5rem; }
    
    .health-calc-wrapper .fieldset-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    
    .health-calc-wrapper .rbf-form legend, 
    .health-calc-wrapper .bfp-calc-form legend { font-size: 1.5rem; }
    
    .health-calc-wrapper .form-row-flex { flex-direction: column; gap: 0; }
    
    .health-calc-wrapper .rbf-form-group, 
    .health-calc-wrapper .bfp-calc-form-group { flex-basis: 100% !important; margin-bottom: 18px; }
}
