/* =============================================
   健身助理 - fitness_assistant.css
   运动活力配色：绿色主调 + 橙色点缀
   三栏布局，支持全屏与暗黑模式
   ============================================= */

/* ========== 主容器 ========== */
.fa-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f0fdf4;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(34, 197, 94, 0.12);
    transition: all 0.3s ease;
}

/* 全屏模式锁定背景滚动 */
body.fa-fullscreen-active {
    overflow: hidden;
}

/* 全屏模式 */
.fa-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;
}

/* ========== 顶部工具栏 ========== */
.fa-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.4);
    flex-shrink: 0;
}

.fa-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.15);
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.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: #166534;
    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, #f97316 0%, #ea580c 100%);
    color: #fff !important;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.45);
}

.toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.55);
    color: #fff !important;
}

/* ========== 表单校验抖动 ========== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-5px); }
    30%, 70% { transform: translateX(5px); }
}

.fa-input.shake,
.fa-select.shake,
.fa-textarea.shake {
    animation: shake 0.5s ease-in-out;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* 占位符图标浮动动画 */
@keyframes tdhFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.fa-float-anim {
    animation: tdhFloat 3s ease-in-out infinite;
}

/* ========== 主内容区：三栏 ========== */
.fa-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f0fdf4;
}

/* ========== 左栏：历史记录 ========== */
.fa-history-panel {
    width: 210px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #bbf7d0;
    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, #f0fdf4 0%, #dcfce7 100%);
    border-bottom: 1px solid #bbf7d0;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #14532d;
}

.history-count {
    font-size: 11px;
    color: #22c55e;
    font-weight: 400;
}

.history-limit-footer {
    flex-shrink: 0;
    padding: 5px 8px;
    text-align: center;
    font-size: 10px;
    color: #86efac;
    border-top: 1px solid #bbf7d0;
    background: #f0fdf4;
    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 #bbf7d0;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #166534;
    background: #f0fdf4;
}

.history-search input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
    background: #fff;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: #86efac transparent;
}

.history-list::-webkit-scrollbar {
    width: 5px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #86efac;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

.history-empty {
    text-align: center;
    font-size: 12px;
    color: #86efac;
    padding: 24px 8px;
    user-select: none;
}

.history-item {
    padding: 9px 10px;
    margin-bottom: 5px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.history-item:hover {
    background: #dcfce7;
    border-color: #86efac;
    transform: translateX(2px);
}

.history-item.active {
    background: #dcfce7;
    border-color: #22c55e;
    box-shadow: 0 1px 4px rgba(34, 197, 94, 0.2);
}

.history-item-goal {
    font-size: 12px;
    font-weight: 600;
    color: #166534;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 18px;
}

.history-item-level {
    font-size: 11px;
    color: #22c55e;
    margin-top: 2px;
}

.history-item-time {
    font-size: 10px;
    color: #86efac;
    margin-top: 2px;
}

.history-item-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    background: transparent;
    color: #ef4444;
    border: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
    line-height: 1;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.history-item-delete:hover {
    background: #fde8e8;
}

/* ========== 中栏：表单输入 ========== */
.fa-input-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
}

.panel-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #f9fafb 0%, #f3f4f6 100%);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 600;
    color: #166534;
}

.panel-tip {
    font-size: 11px;
    color: #9ca3af;
}

.fa-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: #bbf7d0 transparent;
}

.fa-input-body::-webkit-scrollbar {
    width: 5px;
}

.fa-input-body::-webkit-scrollbar-thumb {
    background: #bbf7d0;
    border-radius: 3px;
}

.fa-input-body::-webkit-scrollbar-thumb:hover {
    background: #86efac;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.required-mark {
    color: #ef4444;
    margin-left: 2px;
}

.label-tip {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
    margin-left: 4px;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.form-group-half {
    flex: 1;
    min-width: 0;
    margin-bottom: 12px;
}

.form-group-third {
    flex: 1;
    min-width: 0;
    margin-bottom: 12px;
}

.fa-select,
.fa-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1fae5;
    border-radius: 5px;
    font-size: 13px;
    color: #1f2937;
    background: #f0fdf4;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.fa-select:focus,
.fa-input:focus {
    border-color: #22c55e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.fa-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1fae5;
    border-radius: 5px;
    font-size: 13px;
    color: #1f2937;
    background: #f0fdf4;
    outline: none;
    transition: all 0.2s;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
}

.fa-textarea:focus {
    border-color: #22c55e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.fa-textarea-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.fa-textarea-hint {
    font-size: 11px;
    color: #9ca3af;
}

/* ========== 右栏：结果展示 ========== */
.fa-result-panel {
    flex: 1.2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.fa-result-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.fa-result-panel .panel-header h3 {
    margin: 0;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-goal-tag {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 12px;
}

.result-time {
    font-size: 11px;
    color: #9ca3af;
}

.result-regen-btn {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.result-regen-btn:hover {
    background: #dcfce7;
    border-color: #22c55e;
}

.fa-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: #bbf7d0 transparent;
}

.fa-result-body::-webkit-scrollbar {
    width: 5px;
}

.fa-result-body::-webkit-scrollbar-thumb {
    background: #bbf7d0;
    border-radius: 3px;
}

.fa-result-body::-webkit-scrollbar-thumb:hover {
    background: #86efac;
}

/* 占位符 */
.result-placeholder {
    text-align: center;
    padding: 40px 20px;
}

.placeholder-icon {
    font-size: 52px;
    display: inline-block;
    margin-bottom: 16px;
    line-height: 1;
}

.placeholder-title {
    font-size: 18px;
    font-weight: 700;
    color: #166534;
    margin: 0 0 8px 0;
}

.placeholder-desc {
    font-size: 13px;
    color: #86efac;
    margin: 4px 0;
}

.placeholder-quote {
    margin-top: 20px;
    font-size: 13px;
    color: #4ade80;
    font-style: italic;
    padding: 10px 20px;
    border-left: 3px solid #22c55e;
    background: #f0fdf4;
    border-radius: 0 6px 6px 0;
    text-align: left;
    display: inline-block;
    max-width: 320px;
}

/* 加载中 */
.result-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-icons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.loading-icons span {
    font-size: 28px;
    animation: bounce 1.2s ease-in-out infinite;
}

.loading-icons span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-icons span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.loading-text {
    font-size: 14px;
    color: #22c55e;
    font-weight: 500;
    margin: 0;
}

/* 加载进度光条 */
.fa-loading-bar {
    width: 180px;
    height: 3px;
    background: #d1fae5;
    border-radius: 2px;
    margin: 16px auto 0;
    overflow: hidden;
    position: relative;
}

.fa-loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 60%;
    height: 100%;
    background: linear-gradient(to right, transparent, #22c55e, #86efac, transparent);
    animation: shimmerBar 1.6s ease-in-out infinite;
}

@keyframes shimmerBar {
    0%   { left: -60%; }
    100% { left: 120%; }
}

.fa-input-panel .panel-header h3,
.fa-result-panel .panel-header h3 {
    border-left: 3px solid #22c55e;
    padding-left: 8px;
}

/* ========== 结果内容区 - Markdown 渲染 + 可重播淡入动效 */
@keyframes resultFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-content-enter {
    animation: resultFadeIn 0.35s ease-out forwards;
}

.result-content {
    font-size: 13.5px;
    line-height: 1.75;
    color: #1f2937;
}

.result-content h1,
.result-content h2 {
    color: #166534;
    font-size: 15px;
    font-weight: 700;
    margin: 18px 0 8px 0;
    padding: 7px 10px 7px 12px;
    border-left: 4px solid #22c55e;
    background: linear-gradient(to right, #f0fdf4 0%, transparent 100%);
    border-radius: 0 5px 5px 0;
}

.result-content h3 {
    color: #16a34a;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 6px 0;
}

.result-content p {
    margin: 6px 0;
    color: #374151;
}

.result-content ul,
.result-content ol {
    margin: 6px 0;
    padding-left: 20px;
}

.result-content ul li::marker,
.result-content ol li::marker {
    color: #16a34a;
    font-weight: 600;
}

.result-content li {
    margin: 3px 0;
    color: #374151;
}

.result-content strong {
    color: #166534;
    font-weight: 600;
}

.result-content em {
    color: #f97316;
    font-style: normal;
    font-weight: 500;
}

.result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}

.result-content th {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
}

.result-content td {
    padding: 7px 10px;
    border-bottom: 1px solid #d1fae5;
    color: #374151;
}

.result-content tr:nth-child(even) td {
    background: #f0fdf4;
}

.result-content tr:hover td {
    background: #dcfce7;
}

.result-content blockquote {
    border-left: 4px solid #22c55e;
    background: #f0fdf4;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 0 5px 5px 0;
    color: #166534;
    font-style: italic;
}

.result-content hr {
    border: none;
    border-top: 2px solid #d1fae5;
    margin: 14px 0;
}

.result-content code {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #16a34a;
}

/* ========== 示例导入模态框 ========== */
.fa-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.fa-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    width: 540px;
    max-width: 95vw;
    max-height: 80vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.fa-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.fa-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    flex-shrink: 0;
}

.fa-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.fa-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 14px;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.fa-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.fa-modal-body {
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #bbf7d0 transparent;
}

.fa-modal-body::-webkit-scrollbar {
    width: 5px;
}

.fa-modal-body::-webkit-scrollbar-thumb {
    background: #bbf7d0;
    border-radius: 3px;
}

.fa-modal-body::-webkit-scrollbar-thumb:hover {
    background: #86efac;
}

/* 示例卡片 */
.example-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-card:hover {
    background: #f0fdf4;
    border-color: #86efac;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(34, 197, 94, 0.12);
}

.example-card-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.example-card-info {
    flex: 1;
    min-width: 0;
}

.example-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 3px;
}

.example-card-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.example-card-tag {
    flex-shrink: 0;
    background: #dcfce7;
    color: #16a34a;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    align-self: flex-start;
}

/* ==============================
   暗黑模式（body.dark 前缀）
   ============================== */
body.dark .fa-container {
    background: #111827;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

body.dark .fa-toolbar {
    background: linear-gradient(135deg, #14532d 0%, #166534 50%, #15803d 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

body.dark .fa-main-content {
    background: #111827;
}

/* 左栏暗黑 */
body.dark .fa-history-panel {
    background: #1e2736;
    border-right-color: #2d4a3e;
}

body.dark .history-panel-header {
    background: linear-gradient(to bottom, #1e2736 0%, #1a2332 100%);
    border-bottom-color: #2d4a3e;
}

body.dark .history-panel-header h3 {
    color: #86efac;
}

body.dark .history-limit-footer {
    background: #1e2736;
    border-top-color: #2d4a3e;
    color: #2d4a3e;
}

body.dark .history-search input {
    background: #111827;
    border-color: #2d4a3e;
    color: #d1fae5;
}

body.dark .history-search input:focus {
    border-color: #22c55e;
    background: #1e2736;
}

body.dark .history-list {
    scrollbar-color: #2d4a3e transparent;
}

body.dark .history-list::-webkit-scrollbar-thumb {
    background: #2d4a3e;
}

body.dark .history-list::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

body.dark .history-empty {
    color: #2d4a3e;
}

body.dark .history-item {
    background: #1a2332;
    border-color: #2d4a3e;
}

body.dark .history-item:hover {
    background: #1e3a2e;
    border-color: #4ade80;
}

body.dark .history-item.active {
    background: #1e3a2e;
    border-color: #22c55e;
}

body.dark .history-item-goal {
    color: #86efac;
}

body.dark .history-item-level {
    color: #4ade80;
}

body.dark .history-item-time {
    color: #2d4a3e;
}

/* 中栏暗黑 */
body.dark .fa-input-panel {
    background: #1e2736;
    border-right-color: #2d4a3e;
}

body.dark .panel-header {
    background: linear-gradient(to bottom, #1e2736 0%, #1a2332 100%);
    border-bottom-color: #2d4a3e;
}

body.dark .panel-header h3 {
    color: #86efac;
}

body.dark .panel-tip {
    color: #4b5563;
}

body.dark .fa-input-body {
    scrollbar-color: #2d4a3e transparent;
}

body.dark .fa-input-body::-webkit-scrollbar-thumb {
    background: #2d4a3e;
}

body.dark .fa-input-body::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

body.dark .form-group label {
    color: #d1fae5;
}

body.dark .label-tip {
    color: #4b5563;
}

body.dark .fa-select,
body.dark .fa-input,
body.dark .fa-textarea {
    background: #111827;
    border-color: #2d4a3e;
    color: #d1fae5;
}

body.dark .fa-select:focus,
body.dark .fa-input:focus,
body.dark .fa-textarea:focus {
    border-color: #22c55e;
    background: #1a2332;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

body.dark .fa-select option {
    background: #1e2736;
    color: #d1fae5;
}

body.dark .fa-textarea-hint {
    color: #4b5563;
}

/* 右栏暗黑 */
body.dark .fa-result-panel {
    background: #1e2736;
}

body.dark .result-goal-tag {
    background: linear-gradient(135deg, #14532d, #166534);
}

body.dark .result-time {
    color: #4b5563;
}

body.dark .result-regen-btn {
    background: #1a3a28;
    border-color: #2d4a3e;
    color: #86efac;
}

body.dark .result-regen-btn:hover {
    background: #1e4d34;
    border-color: #22c55e;
}

body.dark .fa-result-body {
    scrollbar-color: #2d4a3e transparent;
}

body.dark .fa-result-body::-webkit-scrollbar-thumb {
    background: #2d4a3e;
}

body.dark .fa-result-body::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

body.dark .placeholder-title {
    color: #86efac;
}

body.dark .placeholder-desc {
    color: #2d4a3e;
}

body.dark .placeholder-quote {
    color: #4ade80;
    background: #1a2332;
    border-left-color: #22c55e;
}

body.dark .loading-text {
    color: #4ade80;
}

body.dark .result-content {
    color: #d1fae5;
}

body.dark .result-content h1,
body.dark .result-content h2 {
    color: #86efac;
    border-left-color: #22c55e;
    background: linear-gradient(to right, #1e3a2e 0%, transparent 100%);
}

body.dark .result-content h3 {
    color: #4ade80;
}

body.dark .result-content p,
body.dark .result-content li {
    color: #d1d5db;
}

body.dark .result-content strong {
    color: #86efac;
}

body.dark .result-content em {
    color: #fb923c;
}

body.dark .result-content th {
    background: linear-gradient(135deg, #14532d, #15803d);
}

body.dark .result-content td {
    border-bottom-color: #2d4a3e;
    color: #d1d5db;
}

body.dark .result-content tr:nth-child(even) td {
    background: #1a2332;
}

body.dark .result-content tr:hover td {
    background: #1e3a2e;
}

body.dark .result-content blockquote {
    border-left-color: #22c55e;
    background: #1a2332;
    color: #86efac;
}

body.dark .result-content hr {
    border-top-color: #2d4a3e;
}

body.dark .result-content code {
    background: #1a2332;
    border-color: #2d4a3e;
    color: #4ade80;
}

body.dark .history-clear-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

body.dark .history-clear-btn:hover {
    background: rgba(239, 68, 68, 0.28);
}

body.dark .history-item:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

body.dark .result-content ul li::marker,
body.dark .result-content ol li::marker {
    color: #4ade80;
}

/* 暗黑模式 - 加载进度条适配 */
body.dark .fa-loading-bar {
    background: #1e3a2e;
}

body.dark .fa-loading-bar::after {
    background: linear-gradient(to right, transparent, #22c55e, #4ade80, transparent);
}

/* 暗黑模式 - 滚动条轨道背景显式定义 */
body.dark .history-list::-webkit-scrollbar-track,
body.dark .fa-input-body::-webkit-scrollbar-track,
body.dark .fa-result-body::-webkit-scrollbar-track,
body.dark .fa-modal-body::-webkit-scrollbar-track {
    background: #111827;
}

/* 模态框暗黑 */
body.dark .fa-modal {
    background: #1e2736;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.dark .fa-modal-body {
    scrollbar-color: #2d4a3e transparent;
}

body.dark .fa-modal-body::-webkit-scrollbar-thumb {
    background: #2d4a3e;
}

body.dark .fa-modal-body::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}

body.dark .example-card {
    background: #1a2332;
    border-color: #2d4a3e;
}

body.dark .example-card:hover {
    background: #1e3a2e;
    border-color: #4ade80;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

body.dark .example-card-title {
    color: #86efac;
}

body.dark .example-card-desc {
    color: #9ca3af;
}

body.dark .example-card-tag {
    background: #1a3a28;
    color: #4ade80;
}

/* ========== 响应式布局 ========== */
/* ≥900px: 三栏（历史 + 表单 + 结果）默认显示，无需媒体查询 */
/* 640px~899px: 隐藏历史栏，保留中右两栏并排 */
@media (max-width: 900px) {
    .fa-history-panel {
        display: none;
    }
}

/* ≤639px: 纵向堆叠全部区域 */
@media (max-width: 639px) {
    .fa-toolbar {
        padding: 6px 8px;
    }

    .toolbar-title {
        display: none;
    }

    .fa-main-content {
        flex-direction: column;
    }

    .fa-input-panel,
    .fa-result-panel {
        flex: none;
    }

    .fa-input-panel {
        height: 55%;
    }

    .fa-result-panel {
        height: 45%;
    }

    .form-row {
        flex-wrap: wrap;
    }

    .form-group-third {
        flex: none;
        width: 100%;
    }
}

/* ========== 打印样式 ========== */
@media print {
    .fa-toolbar,
    .fa-history-panel,
    .fa-input-panel,
    #resultPlaceholder,
    #resultLoading {
        display: none !important;
    }

    .fa-container,
    .fa-container.fullscreen {
        position: static !important;
        height: auto !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    .fa-main-content {
        display: block !important;
    }

    .fa-result-panel {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
    }

    .fa-result-body {
        overflow: visible !important;
        height: auto !important;
        padding: 0 !important;
    }

    .result-content {
        break-inside: avoid;
        overflow: visible !important;
    }
}
