/* =============================================
   营养建议 - nutrition_advice.css
   温暖琥珀金色主题 · 专业营养饮食配色
   暗黑模式以 body.dark 作为 CSS 父级选择器前缀
   ============================================= */

/* ========== tdhFloat 浮动动画（内存规范：占位符图标统一应用） ========== */
@keyframes tdhFloatAnim {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-8px); }
}
.tdhFloat {
    animation: tdhFloatAnim 3s ease-in-out infinite;
}

/* ========== 主容器 ========== */
.na-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fffbeb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(180, 83, 9, 0.12);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.na-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    min-height: unset;
}

/* ========== 顶部工具栏 ========== */
.na-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #78350f 0%, #b45309 45%, #d97706 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(120, 53, 15, 0.45);
    flex-shrink: 0;
}

.na-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-right: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

/* 全屏按钮组右对齐（内存规范：最后一个 toolbar-group 设置 margin-left: auto） */
.na-fullscreen-group {
    margin-left: auto;
}

.toolbar-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #78350f;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 主操作按钮 */
.toolbar-btn-primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff !important;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.45);
}

.toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.55);
    color: #fff !important;
}

/* ========== 表单校验抖动 ========== */
@keyframes naShake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-5px); }
    30%, 70% { transform: translateX(5px); }
}

.na-input.shake,
.na-select.shake,
.na-textarea.shake {
    animation: naShake 0.5s ease-in-out;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* ========== 主内容区：三栏 ========== */
.na-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fffbeb;
}

/* ========== 左栏：历史记录（标准宽度 200px，内存规范） ========== */
.na-history-panel {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #fde68a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fffbeb 0%, #fef3c7 100%);
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    border-left: 4px solid #2ECC71;
    padding-left: 8px;
}

.history-count {
    font-size: 11px;
    color: #d97706;
    font-weight: 400;
}

.history-limit-footer {
    flex-shrink: 0;
    padding: 5px 8px;
    text-align: center;
    font-size: 10px;
    color: #fbbf24;
    border-top: 1px solid #fde68a;
    background: #fffbeb;
    letter-spacing: 0.2px;
    user-select: none;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.history-search {
    padding: 8px;
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #fde68a;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #374151;
    background: #fffdf5;
}

.history-search input:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list:hover::-webkit-scrollbar-track { background: #fef9ee; }
.history-list::-webkit-scrollbar-thumb { background: #fcd34d; border-radius: 2px; }
.history-list::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

.history-empty {
    text-align: center;
    color: #fbbf24;
    font-size: 12px;
    padding: 24px 8px;
    user-select: none;
}

@keyframes naHiFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 11px;
    margin: 3px 0;
    background: #fef9ee;
    border: 1px solid #fde68a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: naHiFadeIn 0.2s ease;
}

.history-item:hover {
    background: #fef3c7;
    border-color: #d97706;
    transform: translateX(2px);
}

.history-item.active {
    background: #fef3c7;
    border-color: #b45309;
    box-shadow: 0 1px 3px rgba(180, 83, 9, 0.25);
}

.history-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fde8e8;
    color: #ef4444;
    border: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.history-item:hover .history-item-del {
    opacity: 1;
}

.history-item-del:hover {
    background: #ef4444;
    color: #fff;
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 20px;
}

.history-item-goal {
    font-size: 11px;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.history-item-time {
    font-size: 10px;
    color: #d97706;
}

/* ========== 中栏：表单输入 ========== */
.na-input-panel {
    width: 340px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #fde68a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.na-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

.na-input-body::-webkit-scrollbar { width: 4px; }
.na-input-body::-webkit-scrollbar-track { background: transparent; }
.na-input-body::-webkit-scrollbar-thumb { background: #fde68a; border-radius: 2px; }
.na-input-body::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

/* ========== 通用面板头部 ========== */
.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fffbeb 0%, #fef3c7 100%);
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    white-space: nowrap;
    border-left: 4px solid #2ECC71;
    padding-left: 8px;
}

.panel-tip {
    font-size: 11px;
    color: #d97706;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
}

.result-user-tag {
    font-size: 11px;
    color: #92400e;
    background: #fef3c7;
    padding: 2px 10px;
    border-radius: 10px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.result-time {
    font-size: 11px;
    color: #d97706;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 换一批按钮 */
.result-regen-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.3);
    border-radius: 4px;
    color: #047857;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.result-regen-btn:hover {
    background: rgba(5, 150, 105, 0.16);
    border-color: #059669;
    transform: translateY(-1px);
}

/* ========== 表单通用样式 ========== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.required-mark {
    color: #ef4444;
    margin-left: 3px;
}

.optional-mark {
    color: #9ca3af;
    font-weight: 400;
}

.na-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #fffdf5;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.na-input:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
    background: #fff;
}

.na-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #fffdf5;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    cursor: pointer;
}

.na-select:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.na-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #fffdf5;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
    line-height: 1.6;
}

.na-textarea:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
    background: #fff;
}

.na-input:disabled,
.na-select:disabled,
.na-textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #fef9ee;
    border-color: #fde68a;
}

/* 数量+单位并排 */
.form-group-row {
    display: flex;
    gap: 10px;
}

.form-group-half {
    flex: 1;
    min-width: 0;
}

.form-group-half label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* 带单位输入框 */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit .na-input {
    padding-right: 34px;
}

.input-unit {
    position: absolute;
    right: 10px;
    font-size: 11px;
    color: #9ca3af;
    pointer-events: none;
    font-weight: 500;
}

/* ========== BMI 实时显示 ========== */
@keyframes naBmiIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bmi-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    border: 1px solid #fde68a;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(217, 119, 6, 0.12);
    animation: naBmiIn 0.25s ease-out;
}

.bmi-label {
    color: #78350f;
    font-weight: 600;
}

.bmi-value {
    font-size: 16px;
    font-weight: 700;
    color: #b45309;
}

.bmi-category {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    background: #fde68a;
    color: #78350f;
}

.bmi-category.bmi-thin   { background: #dbeafe; color: #1d4ed8; }
.bmi-category.bmi-normal { background: #d1fae5; color: #065f46; }
.bmi-category.bmi-over   { background: #fef3c7; color: #92400e; }
.bmi-category.bmi-obese  { background: #fee2e2; color: #991b1b; }

/* ========== 健康目标卡片网格 ========== */
.na-goal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}

.na-goal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 2px solid #fde68a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fffdf5;
    text-align: center;
    user-select: none;
    min-height: 58px;
}

.na-goal-card:hover {
    border-color: #d97706;
    background: #fef3c7;
    transform: translateY(-1px);
}

.na-goal-card.selected {
    border-color: #b45309;
    background: #fef3c7;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.2);
}

.na-goal-card.selected::after {
    content: '✓';
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 10px;
    color: #b45309;
    font-weight: 700;
}

.goal-icon {
    font-size: 18px;
    margin-bottom: 3px;
    display: block;
}

.goal-name {
    font-size: 10px;
    font-weight: 600;
    color: #78350f;
    line-height: 1.2;
}

/* ========== 建议类型卡片 ========== */
.na-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.na-mode-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px;
    border: 2px solid #fde68a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fffdf5;
    text-align: center;
    user-select: none;
}

.na-mode-card:hover {
    border-color: #d97706;
    background: #fef3c7;
    transform: translateY(-1px);
}

.na-mode-card.selected {
    border-color: #b45309;
    background: #fef3c7;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.18);
}

.na-mode-card.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 11px;
    color: #b45309;
    font-weight: 700;
}

.na-mode-icon {
    font-size: 22px;
    margin-bottom: 5px;
}

.na-mode-name {
    font-size: 12px;
    font-weight: 700;
    color: #78350f;
    margin-bottom: 3px;
}

.na-mode-desc {
    font-size: 10px;
    color: #78716c;
    line-height: 1.4;
}

/* ========== 主查询按钮区 ========== */
.na-action-area {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.na-main-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 3px 12px rgba(5, 150, 105, 0.4);
    letter-spacing: 0.5px;
}

.na-main-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 5px 18px rgba(5, 150, 105, 0.5);
    transform: translateY(-2px);
}

.na-main-btn:active:not(:disabled) {
    transform: translateY(0);
}

.na-main-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.na-shortcut-hint {
    margin: 0;
    font-size: 11px;
    color: #92400e;
    opacity: 0.65;
}

/* ========== 右栏：结果展示 ========== */
.na-result-panel {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
}

.na-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fffdf9;
    display: flex;
    flex-direction: column;
}

.na-result-body::-webkit-scrollbar { width: 6px; }
.na-result-body::-webkit-scrollbar-track { background: transparent; }
.na-result-body::-webkit-scrollbar-thumb { background: #fde68a; border-radius: 3px; }
.na-result-body::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

/* ========== 初始占位 ========== */
.na-result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
    text-align: center;
    padding: 30px;
}

/* tdhFloat 类实现浮动动画，内存规范 */
.tdh-placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.placeholder-title {
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
    margin: 0 0 8px;
}

.placeholder-desc {
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 4px;
}

.placeholder-quote {
    margin-top: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border-left: 3px solid #d97706;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: #92400e;
    font-style: italic;
}

/* ========== 加载中 ========== */
.na-result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
    text-align: center;
    padding: 30px;
}

/* 进度光条动画（内存规范：加载状态必须集成扫光效果） */
.fa-loading-bar {
    width: 180px;
    height: 3px;
    background: #fde68a;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    flex-shrink: 0;
}

.fa-loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, #d97706 50%, transparent 100%);
    animation: naLoadBarSweep 1.5s ease-in-out infinite;
}

@keyframes naLoadBarSweep {
    0%   { left: -60%; }
    100% { left: 120%; }
}

.loading-icons {
    font-size: 30px;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
}

.loading-icons span {
    animation: naLoadBounce 1s ease-in-out infinite;
    display: inline-block;
}

.loading-icons span:nth-child(2) { animation-delay: 0.2s; }
.loading-icons span:nth-child(3) { animation-delay: 0.4s; }

@keyframes naLoadBounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

.loading-text {
    font-size: 14px;
    color: #d97706;
    margin: 0;
    font-weight: 500;
}

/* ========== 结果内容 ========== */
/* 结果淡入动效（内存规范：用 .na-result-enter 类 + JS offsetWidth 重排确保动画可重播） */
@keyframes naResultFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.na-result-enter {
    animation: naResultFadeIn 0.35s ease-out forwards;
}

.na-result-content {
    font-size: 14px;
    line-height: 1.8;
    color: #1f2937;
    word-break: break-word;
}

/* 每个结果板块作为独立卡片 */
.na-section-block {
    margin-bottom: 14px;
    background: #fffdf5;
    border: 1px solid #fde68a;
    border-left: 3px solid #d97706;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    break-inside: avoid;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.na-section-block:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 12px rgba(217, 119, 6, 0.15);
}

.na-section-block:last-child {
    margin-bottom: 0;
}

/* 结果板块标题（替代内联样式，支持暗黑模式） */
.na-section-title {
    display: block;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(90deg, #92400e 0%, #d97706 100%);
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.na-section-body {
    font-size: 13px;
    color: #374151;
    line-height: 1.8;
    white-space: normal;
}

/* ul/ol 列表标记统一规范（内存规范：font-weight:600 + #C0392B） */
.na-result-content ul li::marker,
.na-result-content ol li::marker,
.na-section-body ul li::marker,
.na-section-body ol li::marker {
    color: #C0392B;
    font-weight: 600;
}

/* 结果区 code/hr/h1/h2 基础样式（内存规范：暗黑模式下 code 用 #2ECC71，h1/h2 用绿色左边框） */
.na-section-body code,
.na-result-content code {
    background: #fef3c7;
    color: #b45309;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

.na-section-body hr,
.na-result-content hr {
    border: none;
    border-top: 1px solid #fde68a;
    margin: 10px 0;
}

.na-result-content h1,
.na-result-content h2 {
    font-size: 14px;
    color: #92400e;
    border-left: 4px solid #2ECC71;
    padding-left: 8px;
    margin: 10px 0 6px;
    font-weight: 700;
}

/* 错误状态 */
/* display: flex !important 防止 jQuery .show() 写入 display:block 覆盖（Bug Fix）*/
.na-result-content--error {
    background: #fff5f5;
    border: 1px solid #fde8e8;
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    min-height: 200px;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
}

.result-error-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.result-error-icon  { font-size: 36px; color: #ef4444; }
.result-error-title { font-size: 14px; color: #b91c1c; font-weight: 600; margin: 0; }
.result-error-hint  { font-size: 12px; color: #9ca3af; margin: 0; }

.na-retry-btn {
    margin-top: 8px;
    padding: 8px 20px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.na-retry-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ========== 示例模态框 ========== */
.na-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    backdrop-filter: blur(2px);
}

/* 模态框入场动画 */
@keyframes naModalSlideIn {
    from { opacity: 0; transform: translate(-50%, -53%) scale(0.95); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.na-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 90vw);
    max-height: 75vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: naModalSlideIn 0.22s ease-out;
}

.na-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.na-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}

.na-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #78350f;
}

.na-modal-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.na-modal-close:hover {
    background: #fde8e8;
    color: #ef4444;
}

.na-modal-body {
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}

.na-modal-body::-webkit-scrollbar { width: 4px; }
.na-modal-body::-webkit-scrollbar-track { background: transparent; }
.na-modal-body::-webkit-scrollbar-thumb { background: #fde68a; border-radius: 2px; }
.na-modal-body::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

/* 示例卡片 */
.example-card {
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fffdf5;
    position: relative;
}

.example-card:hover {
    border-color: #d97706;
    background: #fef3c7;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(180, 83, 9, 0.15);
}

.example-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: #78350f;
    margin-bottom: 5px;
}

.example-card-badge {
    font-size: 10px;
    color: #059669;
    background: #d1fae5;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.example-card-desc {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0 0 8px;
}

.example-card-import {
    font-size: 11px;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.example-card-import:hover {
    background: #fde68a;
    border-color: #d97706;
}

/* ========== 暗黑模式（body.dark 父级前缀） ========== */
body.dark .na-container {
    background: #1c1208;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

body.dark .na-main-content {
    background: #1c1208;
}

body.dark .na-toolbar {
    background: linear-gradient(135deg, #451a03 0%, #78350f 50%, #92400e 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark .na-history-panel {
    background: #1e1508;
    border-right-color: #3a2808;
}

body.dark .history-panel-header {
    background: linear-gradient(to bottom, #1e1508, #1c1208);
    border-bottom-color: #3a2808;
}

body.dark .history-panel-header h3 {
    color: #fbbf24;
    border-left-color: #2ECC71;
}

body.dark .history-limit-footer {
    background: #1c1208;
    border-top-color: #3a2808;
    color: #6b5020;
}

body.dark .history-search {
    border-bottom-color: #3a2808;
}

body.dark .history-search input {
    background: #2a1c0a;
    border-color: #3a2808;
    color: #fde68a;
}

body.dark .history-search input:focus {
    border-color: #d97706;
}

body.dark .history-search input::placeholder {
    color: #6b5020;
}

body.dark .history-list::-webkit-scrollbar-track { background: #1e1508; }
body.dark .history-list::-webkit-scrollbar-thumb { background: #5a3e14; }
body.dark .history-list::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

body.dark .history-empty {
    color: #6b5020;
}

body.dark .history-item {
    background: #2a1c0a;
    border-color: #3a2808;
}

body.dark .history-item:hover {
    background: #3a2808;
    border-color: #d97706;
}

body.dark .history-item.active {
    background: #3a2c0e;
    border-color: #d97706;
}

body.dark .history-item-title {
    color: #fbbf24;
}

body.dark .history-item-goal {
    color: #6b7280;
}

body.dark .history-item-time {
    color: #6b5020;
}

body.dark .history-clear-btn {
    background: #3a1a1a;
    color: #f87171;
}

body.dark .history-clear-btn:hover {
    background: #4a2020;
}

body.dark .history-item-del {
    background: #3a1a1a;
    color: #f87171;
}

body.dark .history-item-del:hover {
    background: #ef4444;
    color: #fff;
}

body.dark .na-input-panel {
    background: #1e1508;
    border-right-color: #3a2808;
}

body.dark .panel-header {
    background: linear-gradient(to bottom, #1e1508, #1c1208);
    border-bottom-color: #3a2808;
}

body.dark .panel-header h3 {
    color: #fbbf24;
    border-left-color: #2ECC71;
}

body.dark .panel-tip {
    color: #6b5020;
}

body.dark .na-input-body {
    background: #1e1508;
}

body.dark .na-input-body::-webkit-scrollbar-track { background: #1c1208; }
body.dark .na-input-body::-webkit-scrollbar-thumb { background: #5a3e14; }
body.dark .na-input-body::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

body.dark .form-group label {
    color: #9ca3af;
}

body.dark .na-input {
    background: #2a1c0a;
    border-color: #3a2808;
    color: #fde68a;
}

body.dark .na-input:focus {
    border-color: #d97706;
    background: #3a2808;
}

body.dark .na-select {
    background: #2a1c0a;
    border-color: #3a2808;
    color: #fde68a;
}

body.dark .na-select:focus {
    border-color: #d97706;
}

body.dark .na-textarea {
    background: #2a1c0a;
    border-color: #3a2808;
    color: #fde68a;
}

body.dark .na-textarea:focus {
    border-color: #d97706;
    background: #3a2808;
}

body.dark .na-input:disabled,
body.dark .na-select:disabled,
body.dark .na-textarea:disabled {
    opacity: 0.4;
    background: #1c1208;
    border-color: #2a1c0a;
}

body.dark .input-unit {
    color: #6b5020;
}

body.dark .bmi-display {
    background: linear-gradient(135deg, #2a1c0a, #1c1208);
    border-color: #3a2808;
}

body.dark .bmi-label { color: #fbbf24; }
body.dark .bmi-value { color: #fbbf24; }
body.dark .bmi-category { background: #3a2808; color: #fbbf24; }
body.dark .bmi-category.bmi-thin   { background: #1e3a5f; color: #93c5fd; }
body.dark .bmi-category.bmi-normal { background: #064e3b; color: #6ee7b7; }
body.dark .bmi-category.bmi-over   { background: #451a03; color: #fbbf24; }
body.dark .bmi-category.bmi-obese  { background: #450a0a; color: #fca5a5; }

body.dark .na-goal-card {
    background: #2a1c0a;
    border-color: #3a2808;
}

body.dark .na-goal-card:hover {
    background: #3a2808;
    border-color: #d97706;
}

body.dark .na-goal-card.selected {
    background: #3a2c0e;
    border-color: #d97706;
}

body.dark .goal-name {
    color: #fbbf24;
}

body.dark .na-mode-card {
    background: #2a1c0a;
    border-color: #3a2808;
}

body.dark .na-mode-card:hover {
    background: #3a2808;
    border-color: #d97706;
}

body.dark .na-mode-card.selected {
    background: #3a2c0e;
    border-color: #d97706;
}

body.dark .na-mode-name {
    color: #fbbf24;
}

body.dark .na-mode-desc {
    color: #6b7280;
}

body.dark .na-shortcut-hint {
    color: #6b5020;
}

body.dark .na-result-panel {
    background: #1e1508;
}

body.dark .na-result-body {
    background: #1c1208;
}

body.dark .na-result-body::-webkit-scrollbar-track { background: #1c1208; }
body.dark .na-result-body::-webkit-scrollbar-thumb { background: #5a3e14; }
body.dark .na-result-body::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

body.dark .na-result-placeholder {
    background: #1c1208;
}

body.dark .placeholder-title {
    color: #fbbf24;
}

body.dark .placeholder-desc {
    color: #6b7280;
}

body.dark .placeholder-quote {
    background: linear-gradient(135deg, #2a1c0a, #3a2808);
    border-left-color: #d97706;
    color: #fbbf24;
}

body.dark .fa-loading-bar {
    background: #3a2808;
}

body.dark .fa-loading-bar::after {
    background: linear-gradient(90deg, transparent 0%, #d97706 50%, transparent 100%);
}

body.dark .loading-text {
    color: #d97706;
}

body.dark .na-result-content {
    color: #fde68a;
}

/* 暗黑模式下结果区块（内存规范：border-left-color 显式覆盖为深色系适配值） */
body.dark .na-section-block {
    background: #2a1c0a;
    border-color: #3a2808;
    border-left-color: #6a4020;
}

body.dark .na-section-title {
    background: linear-gradient(90deg, #451a03 0%, #78350f 100%);
    color: #fde68a;
}

body.dark .na-section-body {
    color: #fde68a;
}

/* 暗黑模式 code/hr/h1/h2（内存规范：code 用 #2ECC71，h1/h2 用绿色左边框） */
body.dark .na-section-body code,
body.dark .na-result-content code {
    background: #3a2808;
    color: #2ECC71;
}

body.dark .na-section-body hr,
body.dark .na-result-content hr {
    border-top-color: #3a2808;
}

body.dark .na-result-content h1,
body.dark .na-result-content h2 {
    color: #fbbf24;
    border-left-color: #2ECC71;
}

body.dark .na-section-block:hover {
    box-shadow: 0 2px 12px rgba(180, 83, 9, 0.25);
}

body.dark .result-user-tag {
    color: #fbbf24;
    background: #2a1c0a;
}

body.dark .result-time {
    color: #6b5020;
}

body.dark .result-regen-btn {
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.3);
    color: #34d399;
}

body.dark .result-regen-btn:hover {
    background: rgba(5, 150, 105, 0.2);
    border-color: #10b981;
    color: #6ee7b7;
}

body.dark .na-result-content--error {
    background: #2a1414;
    border-color: #4a2020;
}

body.dark .result-error-title { color: #f87171; }
body.dark .result-error-hint  { color: #6b7280; }
body.dark .na-retry-btn { background: #b91c1c; }
body.dark .na-retry-btn:hover { background: #991b1b; }

body.dark .na-modal-overlay {
    background: rgba(0, 0, 0, 0.65);
}

body.dark .na-modal {
    background: #1e1508;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

body.dark .na-modal-header {
    background: linear-gradient(135deg, #1e1508, #2a1c0a);
    border-bottom-color: #3a2808;
}

body.dark .na-modal-header h3 {
    color: #fbbf24;
}

body.dark .na-modal-close {
    color: #6b7280;
}

body.dark .na-modal-close:hover {
    background: #3a1f1f;
    color: #ef4444;
}

body.dark .na-modal-body::-webkit-scrollbar-track { background: #1c1208; }
body.dark .na-modal-body::-webkit-scrollbar-thumb { background: #5a3e14; }
body.dark .na-modal-body::-webkit-scrollbar-thumb:hover { background: rgba(196, 26, 26, 0.4); }

body.dark .example-card {
    background: #2a1c0a;
    border-color: #3a2808;
}

body.dark .example-card:hover {
    background: #3a2808;
    border-color: #d97706;
}

body.dark .example-card-title {
    color: #fbbf24;
}

body.dark .example-card-badge {
    background: #064e3b;
    color: #6ee7b7;
}

body.dark .example-card-desc {
    color: #6b7280;
}

body.dark .example-card-import {
    background: #1e1508;
    border-color: #3a2808;
    color: #fbbf24;
}

body.dark .example-card-import:hover {
    background: #3a2808;
    border-color: #d97706;
}

/* ========== 打印样式（内存规范） ========== */
@media print {
    #naResultPlaceholder,
    #naResultLoading { display: none !important; }

    .na-toolbar,
    .na-history-panel,
    .na-input-panel { display: none !important; }

    .na-container { height: auto !important; }
    .na-main-content { display: block !important; }
    .na-result-panel { min-width: unset; }
    .na-result-body { overflow: visible; padding: 0; }

    /* 打印模式卡片防跨页断裂（内存规范）：break-inside: avoid + width: 50% 双列 + overflow: visible */
    .na-section-block {
        break-inside: avoid;
        width: 50%;
        overflow: visible;
        display: inline-block;
        vertical-align: top;
        box-sizing: border-box;
        margin-bottom: 10px;
    }

    .na-result-content {
        display: flex;
        flex-wrap: wrap;
    }
}

/* ========== 响应式适配（内存规范：三断点布局） ========== */

/* ≥900px：标准三栅 + 适当压缩 */
@media (max-width: 1024px) {
    .na-history-panel { width: 170px; }
    .na-input-panel   { width: 310px; }
}

/* 640~899px：隐藏历史栏，保留表单+结果两栅并排（内存规范） */
@media (min-width: 640px) and (max-width: 899px) {
    .na-history-panel {
        display: none !important;
    }
    .na-input-panel {
        width: 300px;
        flex-shrink: 0;
    }
}

/* ≤639px：纵向堆叠全部区域（内存规范） */
@media (max-width: 639px) {
    .na-main-content {
        flex-direction: column;
    }

    /* 历史栏恢复显示，折叠为横向带 */
    .na-history-panel {
        display: flex !important;
        width: 100%;
        max-height: 140px;
        border-right: none;
        border-bottom: 1px solid #fde68a;
    }

    .na-input-panel {
        width: 100%;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 1px solid #fde68a;
        max-height: 60vh;
    }

    .na-result-panel {
        min-width: unset;
        min-height: 280px;
    }

    .na-goal-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .goal-icon { font-size: 15px; }
    .goal-name { font-size: 9px; }

    .na-modal-body {
        grid-template-columns: 1fr;
    }

    .na-toolbar {
        padding: 6px 10px;
    }

    .toolbar-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    body.dark .na-history-panel {
        border-right: none;
        border-bottom: 1px solid #3a2808;
    }

    body.dark .na-input-panel {
        border-right: none;
        border-bottom: 1px solid #3a2808;
    }
}
