* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #E3F2FD;
    color: #333;
}

/* 顶部标题栏 */
.header {
    background: linear-gradient(135deg, #FFC600 0%, #FFB800 100%);
    padding: 15px 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    background: transparent;
}

.header h1 {
    color: #333;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 1px;
    margin: 0;
}

/* 主容器 */
.container {
    display: flex;
    padding: 20px;
    gap: 20px;
    height: calc(100vh - 92px);
}

/* 左侧导航栏 */
.sidebar {
    width: 220px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-btn {
    background: white;
    border: 2px solid #333;
    padding: 20px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.nav-btn:hover {
    background: #f0f0f0;
}

.nav-btn.active {
    background: #FFF9E6;
    border-color: #FFC600;
    color: #333;
}



/* 主内容区 */
.main-content {
    flex: 1;
    background: white;
    border: 2px solid #333;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.function-page {
    display: none;
}

.function-page.active {
    display: block;
}

/* 内容区域通用 grid 布局 */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    flex: 1;
}

.keyword-input-module {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.keyword-output-module {
    display: flex;
    flex-direction: column;
}

.keyword-output-module .result-area {
    flex: 1;
    overflow-y: auto;
}

/* 模块样式 */
.module {
    border: 2px solid #333;
    padding: 20px;
    background: white;
    display: flex;
    flex-direction: column;
}

.module-title {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* 输入区域 */
.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.demand-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.demand-input {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ccc;
    resize: vertical;
    font-size: 14px;
    font-family: inherit;
}

.confirm-btn {
    align-self: flex-end;
    padding: 8px 24px;
    background: #FFC600;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.confirm-btn:hover {
    background: #FFB800;
}

.confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.user-category-section {
    flex: 1;
    flex-direction: column;
    gap: 10px;
}

.hint-text {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #F0F7FF;
    border-left: 3px solid #4a90e2;
    border-radius: 4px;
    animation: fadeInDown 0.4s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-category-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
}

.category-item {
    cursor: pointer;
    padding: 10px 12px;
    background: white;
    border: 1px solid #ddd;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.category-item:hover {
    background: #f0f0f0;
    border-color: #FFC600;
}

.category-item.selected {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.placeholder {
    color: #999;
    font-size: 14px;
    padding: 5px 0;
    display: none;
}

/* 结果区域 */
.result-area {
    flex: 1;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative; /* 为内部的绝对定位提供参考 */
}

.result-area.large {
    min-height: 400px;
}

/* 结果区域内的加载状态 */
.result-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 50px 30px;
}

.result-item {
    background: white;
    padding: 10px;
    border-left: 3px solid #FFC600;
    margin-bottom: 8px;
    line-height: 1.6;
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-item .copy-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 4px 12px;
    background: #FFC600;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    border-radius: 3px;
}

.result-item .copy-btn:hover {
    background: #FFB800;
}

/* 按钮组 */
.button-group {
    gap: 10px;
    margin-top: 15px;
}

.button-group[style*="display: none"] {
    display: none !important;
}

.button-group[style*="display: flex"] {
    display: flex !important;
}

.submit-btn,
.reset-btn {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.submit-btn {
    background: #FFC600;
    color: white;
}

.submit-btn:hover {
    background: #FFB800;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.reset-btn {
    background: #f5f5f5;
    border: 1px solid #ccc;
}

.reset-btn:hover {
    background: #e0e0e0;
}

/* GEO和案例文案生成页面布局（复用 .content-wrapper 的 grid） */

.geo-input-module,
.case-input-module,
.review-input-module {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.case-input-module textarea.input-field {
    min-height: 280px;
    resize: vertical;
}

.review-input-module textarea.input-field {
    min-height: 250px;
    resize: vertical;
}

.review-output-module {
    display: flex;
    flex-direction: column;
}

.review-output-module .result-area {
    flex: 1;
    overflow-y: auto;
}

.input-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    font-size: 14px;
    font-family: inherit;
}

/* 下拉选择框样式 */
select.input-field {
    cursor: pointer;
    background-color: white;
    appearance: none; /* 移除默认样式 */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

select.input-field:hover {
    border-color: #FFC600;
}

select.input-field:focus {
    outline: none;
    border-color: #FFC600;
    box-shadow: 0 0 0 2px rgba(255, 198, 0, 0.2);
}

textarea.input-field {
    min-height: 150px;
    resize: vertical;
}

/* 平台选择 */
.platform-section,
.store-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.platform-section .confirm-btn {
    align-self: center;
    margin-top: 5px;
}

.section-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.platform-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.platform-btn {
    padding: 10px 20px;
    border: 2px solid #333;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    -webkit-tap-highlight-color: rgba(255, 198, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

.platform-btn:hover {
    background: #f0f0f0;
}

.platform-btn.active {
    background: #FFC600;
    color: white;
    border-color: #FFC600;
}

/* 门店列表 */
.store-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.store-item {
    padding: 10px;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.store-item:hover {
    background: #f0f0f0;
}

.store-item.active {
    background: #FFC600;
    color: white;
    border-color: #FFC600;
}

/* 加载提示 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #FFC600;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 结果区域内的小加载动画 */
.inline-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FFC600;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

/* 错误提示 */
.error-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4444;
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: slideDown 0.3s ease;
}

.error-toast.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 900px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
    }
    
    .nav-btn.active::after {
        content: '';
    }
    
    .header h1 {
        font-size: 24px;
    }
}

/* 流式内容显示 */
.streaming-content {
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #FFC600;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.streaming-content::after {
    content: "▋";
    animation: blink 1s infinite;
    color: #FFC600;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 关键词格式化显示样式 */
.keyword-result-content {
    padding: 15px;
    line-height: 1.8;
    font-size: 14px;
    color: #333;
    word-wrap: break-word;
}

.keyword-result-content strong {
    font-weight: bold;
    color: #333;
}

.keyword-result-content .kw-highlight {
    background: #FFC600;
    color: #333;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 8px;
}

.keywords-container {
    line-height: 1.8;
    font-size: 14px;
    color: #333;
}

.keywords-container .keyword-category {
    margin-bottom: 30px;
}

.keywords-container .category-title {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    display: block;
}

.keywords-container .category-divider {
    border: none;
    border-top: 2px solid #ddd;
    margin: 10px 0 20px 0;
}

.keywords-container .keyword-subsection {
    margin-bottom: 20px;
}

.keywords-container .subsection-title {
    font-weight: bold;
    font-size: 15px;
    color: #555;
    margin-bottom: 10px;
}

.keywords-container .keyword-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.keywords-container .keyword-list li {
    padding: 5px 0;
    padding-left: 20px;
    color: #666;
}

.keywords-container .keyword-list li::before {
    content: attr(data-index) ". ";
    color: #999;
    font-weight: normal;
}

/* 通用AI内容格式化样式（GEO文案、案例文案、好评等模块共用） */
.streaming-content .ai-highlight,
.result-area .ai-highlight {
    background: #FFC600;
    color: #333;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 8px;
}

.streaming-content .ai-section-title,
.result-area .ai-section-title {
    margin-top: 12px;
    margin-bottom: 4px;
}

.streaming-content strong,
.result-area strong {
    font-weight: bold;
    color: #333;
}

/* ========== 历史记录组件 ========== */

/* 标题行：标题 + 历史记录按钮 */
.module-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.module-title-row .module-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 历史记录按钮 */
.history-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 13px;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.history-btn:hover {
    background: #eee;
    border-color: #ccc;
}

.history-btn.active {
    background: #FFC600;
    color: #fff;
    border-color: #FFC600;
}

.history-btn.active:hover {
    background: #FFB800;
    border-color: #FFB800;
}

/* 红色角标 */
.history-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    background: #e74c3c;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(231, 76, 60, 0.4);
    animation: badgePop 0.3s ease;
}

.history-badge.hidden {
    display: none;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 历史记录面板 */
.history-panel {
    display: none;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    animation: historySlideDown 0.25s ease;
}

.history-panel.show {
    display: block;
}

@keyframes historySlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 面板头部 */
.history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    color: #888;
}

.history-clear-btn {
    font-size: 13px;
    color: #e74c3c;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

/* 历史记录列表 */
.history-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.history-list::-webkit-scrollbar {
    width: 5px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* 单条历史记录 */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s;
    gap: 10px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: #f8f8f8;
}

.history-item-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

.history-item-time {
    color: #aaa;
    font-size: 12px;
    white-space: nowrap;
    margin-right: 6px;
}

.history-item-summary {
    color: #555;
}

.history-delete-btn {
    font-size: 12px;
    color: #ccc;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.history-delete-btn:hover {
    color: #e74c3c;
    background: #fde8e8;
}

/* 空状态 */
.history-empty {
    padding: 20px;
    text-align: center;
    color: #ccc;
    font-size: 13px;
}

/* 历史详情弹窗 */
.history-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.history-detail-overlay.hidden {
    display: none;
}

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

.history-detail-box {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 680px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: detailPop 0.25s ease;
}

@keyframes detailPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.history-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.history-detail-header h4 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.history-detail-close {
    font-size: 22px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.history-detail-close:hover {
    color: #333;
}

.history-detail-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #444;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.history-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid #eee;
}

.history-detail-copy-btn {
    padding: 8px 20px;
    font-size: 14px;
    background: #FFC600;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-detail-copy-btn:hover {
    background: #FFB800;
}

