/* ========== AI情绪建筑设计 容器 ========== */
.aea-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    transition: all .3s cubic-bezier(.4,0,.2,1);
}
.aea-container.fullscreen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.aea-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(124,58,237,.3);
    flex-shrink: 0;
}
.toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
}
.toolbar-btn {
    padding: 5px 10px;
    background: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #7c3aed;
    transition: all .2s;
    white-space: nowrap;
}
.toolbar-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
}
.toolbar-btn:active:not(:disabled) { transform: translateY(0); }
.toolbar-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ========== 主内容区 ========== */
.aea-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========== 左侧历史面板 ========== */
.aea-history-panel {
    width: 190px;
    min-width: 140px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
}
.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background .2s;
}
.history-clear-btn:hover { background: #fde8e8; }
.history-search {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.history-search input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s;
}
.history-search input:focus { border-color: #a855f7; }
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.history-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 20px 8px;
}
.history-item {
    padding: 8px 10px;
    margin-bottom: 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all .18s;
    position: relative;
}
.history-item:hover { background: #f1f5f9; border-color: #cbd5e1; transform: translateX(2px); }
.history-item.active { background: #f3e8ff; border-color: #a855f7; }
.history-item-theme {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}
.history-item-meta {
    font-size: 11px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-item-del {
    position: absolute;
    top: 3px; right: 3px;
    width: 16px; height: 16px;
    background: #fde8e8;
    color: #ef4444;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity .2s;
    cursor: pointer;
}
.history-item:hover .history-item-del { opacity: 1; }

/* ========== 中间输入面板 ========== */
.aea-input-panel {
    width: 360px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
.input-panel-header {
    padding: 10px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
}
.input-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.input-group { display: flex; flex-direction: column; gap: 4px; }
.input-group.half { flex: 1; }
.input-row { display: flex; gap: 8px; }
.input-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}
.required { color: #ef4444; }
.emotion-textarea {
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.55;
    resize: vertical;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    min-height: 72px;
}
.emotion-textarea:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168,85,247,.1);
}
.emotion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.emotion-tag {
    padding: 3px 8px;
    background: #f3e8ff;
    color: #7c3aed;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all .18s;
    border: 1px solid #e9d5ff;
    user-select: none;
}
.emotion-tag:hover { background: #7c3aed; color: #fff; }
.emotion-tag.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
/* 字符计数行 */
.char-count-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 18px;
}
.char-count {
    font-size: 11px;
    color: #94a3b8;
    transition: color .2s;
}
.char-count.warn  { color: #ef4444; }
.char-count.caution { color: #f97316; }
.char-count.ok    { color: #22c55e; }
/* 复制输入按鈕 */
.copy-input-btn {
    padding: 2px 8px;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    color: #7c3aed;
    font-size: 11px;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
}
.copy-input-btn:hover { background: #7c3aed; color: #fff; border-color: #7c3aed; }
/* 示例场景 */
.example-scenarios { display: flex; flex-wrap: wrap; gap: 5px; }
.example-chip {
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    transition: all .18s cubic-bezier(.4,0,.2,1);
    user-select: none;
}
.example-chip:hover { background: #f3e8ff; border-color: #c4b5fd; color: #7c3aed; }
.example-chip.ael-active { background: #7c3aed; color: #fff; border-color: #7c3aed; transform: scale(.95); }
.input-select, .input-text {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: border-color .2s;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}
.input-select:focus, .input-text:focus { border-color: #a855f7; }
.intensity-group {
    display: flex;
    gap: 6px;
}
.intensity-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #64748b;
    transition: all .18s;
    user-select: none;
}
.intensity-option:has(input:checked),
.intensity-option.intensity-checked {
    border-color: #7c3aed;
    background: #f3e8ff;
    color: #7c3aed;
    font-weight: 600;
}
.intensity-option input { display: none; }
.action-row { display: flex; gap: 8px; margin-top: 4px; }
.btn-generate {
    flex: 1;
    padding: 10px 16px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.btn-generate:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,.35);
}
.btn-generate:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-cancel {
    padding: 10px 14px;
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-cancel:hover { background: #fecaca; }
.btn-icon { font-size: 14px; }

/* ========== 右侧结果面板 ========== */
.aea-result-panel {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
}
.result-panel-header {
    padding: 10px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
}
/* 空状态 */
.result-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: #94a3b8;
}
.empty-icon { font-size: 48px; opacity: .6; }
.empty-text { font-size: 13px; text-align: center; color: #64748b; }
.empty-hint { font-size: 11px; color: #94a3b8; }
/* 加载 */
.result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.loading-animation { display: flex; gap: 8px; }
.loading-dot {
    width: 10px; height: 10px;
    background: #a855f7;
    border-radius: 50%;
    animation: loadingBounce .6s cubic-bezier(.4,0,.2,1) infinite;
}
.loading-dot:nth-child(2) { animation-delay: .15s; }
.loading-dot:nth-child(3) { animation-delay: .3s; }
@keyframes loadingBounce {
    0%, 100% { transform: translateY(0); opacity: .7; }
    50% { transform: translateY(-10px); opacity: 1; }
}
.loading-text { font-size: 13px; color: #7c3aed; font-weight: 500; }

/* ========== 结果内容 ========== */
.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* 主题块 */
.result-theme-block {
    padding: 14px 16px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    border-radius: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.theme-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}
.theme-emotion {
    font-size: 12px;
    background: rgba(255,255,255,.2);
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
/* 区块 */
.result-section {
    background: #fafafa;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 10px 12px;
}
.result-section.inline-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}
.section-title {
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
    margin-bottom: 6px;
}
.inline-section .section-title { margin-bottom: 0; flex-shrink: 0; }
.result-text {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
}
/* 色彩方案 */
.color-palette { display: flex; gap: 8px; flex-wrap: wrap; }
.color-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform .18s;
}
.color-chip:hover { transform: scale(1.08); }
.color-swatch {
    width: 40px; height: 40px;
    border-radius: 8px;
    border: 2px solid rgba(0,0,0,.08);
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
    transition: box-shadow .18s;
}
.color-chip:hover .color-swatch { box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.color-name {
    font-size: 10px;
    color: #64748b;
    text-align: center;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 材质标签 */
.material-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.material-tag {
    padding: 3px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    color: #374151;
    font-weight: 500;
}
/* 关键词标签 */
.keyword-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.keyword-tag {
    padding: 3px 10px;
    background: #f3e8ff;
    color: #7c3aed;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid #e9d5ff;
}
/* 音乐标签 */
.music-tag {
    font-size: 12px;
    color: #059669;
    background: #d1fae5;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #a7f3d0;
}
/* 诗意区块 */
.poetry-section { background: linear-gradient(135deg, #fdf4ff, #f5f3ff); border-color: #e9d5ff; }
.poetry-text {
    font-size: 13px;
    color: #4c1d95;
    line-height: 1.8;
    font-style: italic;
}

/* ========== Toast ========== */
.aea-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30,41,59,.9);
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    z-index: 99999;
    white-space: nowrap;
}
.aea-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.aea-toast.success { background: rgba(5,150,105,.9); }
.aea-toast.error { background: rgba(220,38,38,.9); }
.aea-toast.warning { background: rgba(217,119,6,.9); }

/* 生成中锁定输入区 */
.panel-locked {
    opacity: .55;
    pointer-events: none;
    transition: opacity .2s;
}
body.theme-dark .panel-locked { opacity: .4; }
body.theme-dark .aea-container { background: #1e293b; }
body.theme-dark .aea-history-panel,
body.theme-dark .aea-input-panel,
body.theme-dark .aea-result-panel { background: #0f172a; border-color: rgba(148,163,184,.2); }
body.theme-dark .history-header,
body.theme-dark .input-panel-header,
body.theme-dark .result-panel-header { background: #1e293b; color: #e2e8f0; border-color: rgba(148,163,184,.2); }
body.theme-dark .history-search input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.theme-dark .history-item { background: #1e293b; border-color: rgba(148,163,184,.2); color: #e2e8f0; }
body.theme-dark .history-item:hover { background: rgba(148,163,184,.1); }
body.theme-dark .history-item.active { background: #2d1b69; border-color: #a855f7; }
body.theme-dark .history-item-theme { color: #e2e8f0; }
body.theme-dark .emotion-textarea,
body.theme-dark .input-select,
body.theme-dark .input-text { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.theme-dark .input-label { color: #94a3b8; }
body.theme-dark .emotion-tag { background: #2d1b69; color: #c4b5fd; border-color: #4c1d95; }
body.theme-dark .intensity-option { border-color: #334155; color: #94a3b8; }
body.theme-dark .intensity-option:has(input:checked),
body.theme-dark .intensity-option.intensity-checked { background: #2d1b69; color: #c4b5fd; border-color: #7c3aed; }
body.theme-dark .result-section { background: #1e293b; border-color: rgba(148,163,184,.1); }
body.theme-dark .result-text { color: #cbd5e1; }
body.theme-dark .material-tag { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.theme-dark .poetry-section { background: linear-gradient(135deg,#1e0a2e,#1a1033); border-color: #4c1d95; }
body.theme-dark .poetry-text { color: #c4b5fd; }
body.theme-dark .empty-text { color: #94a3b8; }
body.theme-dark .aea-toolbar { background: linear-gradient(135deg,#4a1d96 0%,#6b21a8 100%); }
body.theme-dark .toolbar-btn { background: #2d1b69; color: #c4b5fd; }
body.theme-dark .char-count { color: #64748b; }
body.theme-dark .char-count.warn   { color: #f87171; }
body.theme-dark .char-count.caution{ color: #fb923c; }
body.theme-dark .char-count.ok     { color: #4ade80; }
body.theme-dark .copy-input-btn { background: #2d1b69; border-color: #4c1d95; color: #c4b5fd; }
body.theme-dark .copy-input-btn:hover { background: #7c3aed; color: #fff; }
body.theme-dark .example-chip { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.theme-dark .example-chip:hover { background: #2d1b69; border-color: #7c3aed; color: #c4b5fd; }
body.theme-dark .example-chip.ael-active { background: #7c3aed; color: #fff; border-color: #7c3aed; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .aea-history-panel { display: none; }
    .aea-input-panel { width: 320px; }
}
@media (max-width: 640px) {
    .aea-main { flex-direction: column; }
    .aea-input-panel { width: 100%; border-right: none; border-bottom: 1px solid #e2e8f0; max-height: 50%; }
    .aea-result-panel { min-height: 300px; }
}
/* 细滚动条 */
.aea-result-panel .result-content::-webkit-scrollbar,
.aea-input-panel .input-panel-body::-webkit-scrollbar,
.history-list::-webkit-scrollbar { width: 4px; }
.aea-result-panel .result-content::-webkit-scrollbar-thumb,
.aea-input-panel .input-panel-body::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
