/* ========== 日记助手容器 ========== */
.da-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fdf8f3;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.da-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.da-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #c77c3a 0%, #8b4513 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.35);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.da-toolbar .toolbar-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #7c3a1a;
    transition: all 0.3s;
    white-space: nowrap;
}

.da-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.da-toolbar .toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.da-toolbar .toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.da-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #f6c90e 0%, #e09b00 100%);
    color: #5a3e00;
    box-shadow: 0 2px 8px rgba(230, 159, 0, 0.35);
}

.da-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffe033 0%, #f6c90e 100%);
    box-shadow: 0 4px 14px rgba(230, 159, 0, 0.5);
}

/* ========== 主内容三栏 ========== */
.da-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fdf8f3;
}

/* ========== 左侧历史面板 ========== */
.da-history-panel {
    width: 200px;
    background: white;
    border-right: 1px solid #e8d5c0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.da-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fafafa 0%, #fdf5ee 100%);
    border-bottom: 1px solid #e8d5c0;
    flex-shrink: 0;
}

.da-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #7c3a1a;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #c77c3a;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.da-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.da-history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 10px;
    margin-bottom: 4px;
    background: #fdf9f5;
    border: 1px solid #e8d5c0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.da-history-item:hover {
    background: #f7ede0;
    border-color: #c77c3a;
    transform: translateX(2px);
}

.da-history-item:focus-visible {
    outline: 2px solid #c77c3a;
    outline-offset: 1px;
    border-color: #c77c3a;
    background: #f7ede0;
}

.da-history-item.active {
    background: #f5e3d0;
    border-color: #c77c3a;
    border-left: 3px solid #8b4513;
    box-shadow: 0 1px 3px rgba(199, 124, 58, 0.2);
}

.da-history-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
    padding-right: 22px;
}

.da-history-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.da-history-time {
    font-size: 11px;
    color: #b0bec5;
}

.da-history-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: #fde8e8;
    color: #ef4444;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    line-height: 1;
}

.da-history-item:hover .da-history-del {
    opacity: 1;
}

.da-history-del:hover {
    background: #ef4444;
    color: white;
}

.da-history-empty {
    text-align: center;
    padding: 24px 12px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.8;
}

/* ========== 中间输入面板 ========== */
.da-input-panel {
    width: 320px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #e8d5c0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.da-input-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #fdf5ee 100%);
    border-bottom: 1px solid #e8d5c0;
    font-size: 13px;
    font-weight: 600;
    color: #7c3a1a;
    flex-shrink: 0;
}

.da-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
}

/* 表单组 */
.da-form-group {
    margin-bottom: 13px;
}

.da-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #7c3a1a;
    margin-bottom: 6px;
}

.da-label-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
}

.da-form-input,
.da-form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e8d5c0;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fffbf7;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.da-form-input:focus,
.da-form-textarea:focus {
    border-color: #c77c3a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(199, 124, 58, 0.12);
}

.da-form-textarea {
    resize: vertical;
    min-height: 66px;
}

/* 输入框错误状态 */
.da-form-textarea.is-error,
.da-form-input.is-error {
    border-color: #ef4444 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    transition: all 0.2s;
}

/* 选项按钮组 */
.da-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.da-btn-option {
    padding: 4px 9px;
    border: 1px solid #e8d5c0;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    background: #fffbf7;
    color: #7c3a1a;
    transition: all 0.2s;
    user-select: none;
}

.da-btn-option:hover {
    border-color: #c77c3a;
    color: #8b4513;
    background: #f7ede0;
}

.da-btn-option:focus-visible {
    outline: 2px solid #c77c3a;
    outline-offset: 2px;
    border-color: #c77c3a;
}

.da-btn-option.active {
    border-color: #a05c2a;
    background: linear-gradient(135deg, #e8a56a 0%, #a05c2a 100%);
    color: white;
    font-weight: 500;
}

/* 字符计数 */
.da-char-counter {
    text-align: right;
    font-size: 11px;
    color: #b0bec5;
    margin-top: 3px;
    user-select: none;
}

/* 快捷键提示 */
.da-shortcut-hint {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    letter-spacing: 0.2px;
}

/* 生成按钮 */
@keyframes daBtnGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(160, 92, 42, 0.25); }
    50%       { box-shadow: 0 4px 22px rgba(160, 92, 42, 0.55); }
}

.da-generate-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #c77c3a 0%, #8b4513 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.5px;
    animation: daBtnGlow 2.4s ease-in-out infinite;
}

.da-generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.45);
    animation: none;
}

.da-generate-btn:active:not(:disabled) { transform: translateY(0); }

.da-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

/* 加载动画 */
.da-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: daSpin 0.8s linear infinite;
    display: none;
}

.da-generate-btn.loading .da-spinner { display: block; }
.da-generate-btn.loading .da-btn-text { display: none; }

.da-btn-loading-text { display: none; font-size: 13px; }
.da-generate-btn.loading .da-btn-loading-text { display: inline; }

@keyframes daSpin { to { transform: rotate(360deg); } }

/* ========== 右侧结果面板 ========== */
.da-result-panel {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 320px;
}

.da-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #fdf5ee 100%);
    border-bottom: 1px solid #e8d5c0;
    flex-shrink: 0;
}

.da-result-title {
    font-size: 13px;
    font-weight: 600;
    color: #7c3a1a;
}

.da-result-actions { display: flex; gap: 6px; }

.da-result-action-btn {
    padding: 4px 10px;
    border: 1px solid #e8d5c0;
    border-radius: 4px;
    background: white;
    font-size: 11px;
    cursor: pointer;
    color: #7c3a1a;
    transition: all 0.2s;
}

.da-result-action-btn:hover {
    border-color: #c77c3a;
    color: #8b4513;
    background: #f7ede0;
}

.da-result-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 16px 28px;
}

/* ===== 空状态 ===== */
.da-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: #94a3b8;
    text-align: center;
    gap: 12px;
}

.da-empty-icon { font-size: 54px; opacity: 0.6; }

.da-empty-title {
    font-size: 15px;
    font-weight: 500;
    color: #a05c2a;
}

.da-empty-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.7;
    max-width: 260px;
}

/* ===== 骨架屏 头部卡片层 ===== */
.da-skel-header-block {
    background: linear-gradient(135deg, #fdf0e0 0%, #f5dcc4 100%);
    border: 1px solid #e8c89a;
    border-left: 4px solid #e8a56a;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.da-skel-header-block .da-skel-item {
    background: linear-gradient(90deg, #f0d9bf 25%, #e5c9a8 50%, #f0d9bf 75%);
    background-size: 200% 100%;
    animation: daShimmer 1.5s infinite;
}

/* ===== 骨架屏 ===== */
.da-skeleton { display: none; }
.da-skeleton.show { display: block; }

.da-skel-item {
    background: linear-gradient(90deg, #f7ede0 25%, #f0ddc8 50%, #f7ede0 75%);
    background-size: 200% 100%;
    animation: daShimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}

@keyframes daShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.da-skel-title { height: 28px; width: 65%; }
.da-skel-meta  { height: 18px; width: 50%; }
.da-skel-opening { height: 44px; }
.da-skel-bar { height: 16px; }
.da-skel-short { width: 72%; }
.da-skel-quote { height: 56px; border-radius: 8px; }

/* ===== 结果区 ===== */
.da-result-wrap { display: none; }
.da-result-wrap.show {
    display: block;
    animation: daFadeIn 0.28s ease;
}

@keyframes daFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 日记头部 */
.da-diary-header {
    background: linear-gradient(135deg, #fdf0e0 0%, #f5dcc4 100%);
    border: 1px solid #e8c89a;
    border-left: 4px solid #c77c3a;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.da-diary-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.da-diary-date {
    font-size: 12px;
    color: #8b6343;
    font-weight: 500;
    background: rgba(139, 69, 19, 0.1);
    border-radius: 12px;
    padding: 2px 10px;
}

.da-diary-mood,
.da-diary-weather {
    font-size: 13px;
    opacity: 0.85;
}

.da-diary-title {
    font-size: 20px;
    font-weight: 700;
    color: #5c2d0e;
    margin: 0 0 8px;
    line-height: 1.35;
    font-family: "STKaiti", "KaiTi", Georgia, serif;
}

.da-diary-opening {
    font-size: 13px;
    color: #7c5232;
    font-style: italic;
    line-height: 1.7;
    margin: 0;
    padding-left: 10px;
    border-left: 3px solid #e8a56a;
}

/* 正文内容 */
.da-diary-content {
    font-size: 14px;
    color: #374151;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 14px 18px;
    background: #fffcf8;
    border: 1px solid #f0e4d0;
    border-radius: 8px;
    margin-bottom: 14px;
    font-family: "FangSong", "STFangSong", "STSong", Georgia, serif;
}

/* 感悟区块 */
.da-diary-reflection {
    background: #fff8ec;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.da-reflection-label {
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.da-reflection-text {
    font-size: 13px;
    color: #78350f;
    line-height: 1.7;
    margin: 0;
    font-style: italic;
}

/* 名言区块 */
.da-diary-quote {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-left: 4px solid #8b5cf6;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.da-quote-text {
    font-size: 14px;
    color: #4c1d95;
    line-height: 1.7;
    font-style: italic;
    margin: 0 0 6px;
    position: relative;
    padding-left: 18px;
}

.da-quote-text::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -4px;
    font-size: 28px;
    color: #8b5cf6;
    line-height: 1;
    font-style: normal;
    opacity: 0.6;
}

.da-quote-author {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #7c3aed;
    font-style: normal;
    font-weight: 500;
}

.da-quote-author::before { content: '—— '; }

/* 标签 */
.da-diary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.da-tag {
    padding: 3px 10px;
    background: #fdf0e0;
    border: 1px solid #e8c89a;
    border-radius: 12px;
    font-size: 12px;
    color: #7c3a1a;
    font-weight: 500;
}

.da-tag::before { content: '#'; margin-right: 1px; opacity: 0.65; }

/* 字数统计 */
.da-diary-stats {
    text-align: right;
    font-size: 11px;
    color: #b0bec5;
    padding-top: 4px;
    border-top: 1px dashed #e8d5c0;
}

/* ===== 错误状态 ===== */
.da-result-error {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 32px;
}

.da-error-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.85; }

.da-error-msg {
    font-size: 14px;
    line-height: 1.6;
    color: #ef4444;
    max-width: 260px;
}

.da-retry-btn {
    margin-top: 14px;
    padding: 8px 22px;
    border: 1px solid #ef4444;
    color: #ef4444;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.da-retry-btn:hover { background: #fef2f2; }

/* ========== 示例抽屉 ========== */
.da-drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
}

.da-drawer-overlay.show {
    opacity: 1;
    visibility: visible;
}

.da-example-drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 10002;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.da-example-drawer.show { right: 0; }

.da-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #e8d5c0;
    flex-shrink: 0;
    background: linear-gradient(135deg, #c77c3a 0%, #8b4513 100%);
    color: white;
}

.da-drawer-title { font-size: 15px; font-weight: 600; }

.da-drawer-close {
    width: 30px; height: 30px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.da-drawer-close:hover { background: rgba(255,255,255,0.3); }

.da-drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

.da-example-card {
    border: 1px solid #e8d5c0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fdf9f5;
}

.da-example-card:hover {
    border-color: #c77c3a;
    background: #f7ede0;
    transform: translateX(-3px);
    box-shadow: 2px 0 8px rgba(199, 124, 58, 0.12);
}

.da-example-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #5c2d0e;
    margin-bottom: 6px;
}

.da-example-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.da-example-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: #fdf0e0;
    color: #7c3a1a;
}

.da-example-card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

/* ========== Toast ========== */
.da-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.da-toast {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: daToastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}

.da-toast.success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.da-toast.error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.da-toast.info    { background: #fef3c7; color: #78350f; border-left: 4px solid #f59e0b; }

@keyframes daToastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ========== 自定义滚动条 ========== */
.da-history-list::-webkit-scrollbar,
.da-input-body::-webkit-scrollbar,
.da-result-body::-webkit-scrollbar,
.da-drawer-body::-webkit-scrollbar {
    width: 5px;
}

.da-history-list::-webkit-scrollbar-track,
.da-input-body::-webkit-scrollbar-track,
.da-result-body::-webkit-scrollbar-track,
.da-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.da-history-list::-webkit-scrollbar-thumb,
.da-input-body::-webkit-scrollbar-thumb,
.da-result-body::-webkit-scrollbar-thumb,
.da-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(199, 124, 58, 0.35);
    border-radius: 2px;
}

.da-history-list::-webkit-scrollbar-thumb:hover,
.da-input-body::-webkit-scrollbar-thumb:hover,
.da-result-body::-webkit-scrollbar-thumb:hover,
.da-drawer-body::-webkit-scrollbar-thumb:hover {
    background: rgba(199, 124, 58, 0.65);
}
