/* =====================================================
   新版页面样式 - 优雅现代设计（统一输出样式）
   ===================================================== */

/* ==================== 统一输出文字样式 ==================== */

/* 所有输出容器统一文字样式 */
.output-container {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    min-height: 280px;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

/* 统一输出内所有文字样式 */
.output-container .bubble,
.output-container p,
.output-container li,
.output-container h1,
.output-container h2,
.output-container h3,
.output-container h4 {
    font-size: 14px !important;
    line-height: 1.7 !important;
    font-weight: 200 !important;
    color: var(--text) !important;
    max-width: 100% !important;
    overflow-x: auto !important;
}

.output-container h1 {
    font-size: 20px !important;
    font-weight: 300 !important;
    margin-top: 16px !important;
    margin-bottom: 10px !important;
}

.output-container h2 {
    font-size: 18px !important;
    font-weight: 300 !important;
    margin-top: 16px !important;
    margin-bottom: 8px !important;
    color: var(--accent) !important;
}

.output-container h3 {
    font-size: 16px !important;
    font-weight: 300 !important;
    margin-top: 14px !important;
    margin-bottom: 6px !important;
}

.output-container p {
    margin-bottom: 12px !important;
}

.output-container p:last-child {
    margin-bottom: 0 !important;
}

.output-container ul,
.output-container ol {
    padding-left: 20px !important;
    margin: 12px 0 !important;
}

.output-container li {
    margin-bottom: 6px !important;
    font-size: 14px !important;
}

.output-container strong {
    font-weight: 500 !important;
    color: var(--warning) !important;
}

.output-container code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px !important;
    padding: 2px 6px;
    background: var(--accent-light);
    border-radius: 4px;
    color: var(--accent);
}

.output-container pre {
    margin: 12px 0;
    padding: 16px;
    background: rgba(191, 90, 242, 0.05);
    border: 0.5px solid rgba(191, 90, 242, 0.15);
    border-radius: 12px;
    overflow-x: auto;
}

.output-container pre code {
    padding: 0;
    background: none;
}

/* 小红书输出样式 - 稍大字体以突出种草效果 */
.xhs-output p,
.xhs-output li,
.xhs-output {
    font-size: 15px !important;
    line-height: 1.85 !important;
}

.xhs-output strong {
    color: #FF6B6B !important;
}

/* 情报输出样式 - 稍大字体以突出分析效果 */
.intelligence-output .bubble,
.intelligence-output p,
.intelligence-output li {
    font-size: 15px !important;
    line-height: 1.85 !important;
}

/* ==================== 海报模块样式 ==================== */
.poster-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 海报尺寸选择器 */
#posterRatio {
    padding: 8px 32px 8px 12px;
    border: 0.5px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 300;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

#posterRatio:focus {
    border-color: rgba(0, 122, 255, 0.5);
    background-color: rgba(0, 122, 255, 0.05);
}

#posterRatio option {
    background: #1a1a1a;
    color: var(--text);
}

.poster-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
}

.poster-loading .loading-text {
    font-size: 14px;
    font-weight: 300;
    color: var(--text-secondary);
}

.poster-loading .loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.poster-loading .loading-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 200;
    color: var(--text-tertiary);
}

.poster-loading .loading-step.active {
    color: var(--accent);
}

.poster-loading .loading-step.completed {
    color: var(--success);
}

.poster-loading .step-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poster-loading .step-icon.pending {
    border: 1.5px solid var(--border);
}

.poster-loading .step-icon.active {
    border: 1.5px solid var(--accent);
    animation: pulse 1.5s infinite;
}

.poster-loading .step-icon.completed {
    background: var(--success);
    border: none;
}

.poster-loading .step-icon.completed::after {
    content: '✓';
    color: white;
    font-size: 10px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 海报图片展示 */
.poster-preview {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}

.poster-preview img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* 海报按钮操作区 */
.poster-actions,
.image-actions,
.prompt-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.poster-actions .btn,
.image-actions .btn,
.prompt-actions .btn {
    min-width: 120px;
}

.poster-actions .btn-primary,
.image-actions .btn-primary {
    background: transparent;
    border: 0.5px solid var(--accent);
    color: var(--accent);
    font-weight: 300;
}

.poster-actions .btn-primary:hover,
.image-actions .btn-primary:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--accent);
}

.poster-actions .btn-secondary,
.image-actions .btn-secondary {
    background: transparent;
    border: 0.5px solid var(--border);
}

.poster-actions .btn-secondary:hover,
.image-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ==================== 通用页面结构 ==================== */

.intelligence-page,
.wechat-page,
.xhs-page,
.shortvideo-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 页面 Hero 区域 */
.page-hero {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 32px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.06) 0%, rgba(191, 90, 242, 0.04) 100%);
    border: 0.5px solid rgba(0, 122, 255, 0.1);
    border-radius: 20px;
}

.page-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 122, 255, 0.1);
    border: 0.5px solid rgba(0, 122, 255, 0.2);
    color: #007AFF;
    flex-shrink: 0;
}

.page-hero-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
}

.page-hero-icon.xhs-icon { color: #FF6B6B; background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.2); }
.page-hero-icon.wechat-icon { color: #30D158; background: rgba(48, 209, 88, 0.1); border-color: rgba(48, 209, 88, 0.2); }
.page-hero-icon.video-icon { color: #FF9F0A; background: rgba(255, 159, 10, 0.1); border-color: rgba(255, 159, 10, 0.2); }

.page-hero-content h2 {
    font-size: 26px;
    font-weight: 200;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.page-hero-content p {
    font-size: 14px;
    font-weight: 200;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 玻璃卡片 */
.glass-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 28px;
}

/* 输入网格 */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    font-size: 12px;
    font-weight: 300;
    color: var(--text-secondary);
}

.input-label .optional {
    color: var(--text-tertiary);
    font-size: 11px;
}

/* 带按钮的输入框 */
.input-with-btn {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-with-btn input {
    flex: 1;
}

/* ==================== 通用输入框样式 ==================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 200;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    height: 44px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus {
    border-color: rgba(0, 122, 255, 0.5);
    background: rgba(0, 122, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

/* 输入框网格中的独立输入 */
.input-grid input[type="text"] {
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    height: 44px;
}

.input-with-btn input {
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    height: 44px;
}

/* 搜索框内输入 */
.search-input-wrapper input {
    padding-left: 48px;
}

/* ==================== 按钮样式 ==================== */

.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: 0.5px solid var(--accent);
    border-radius: 12px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.primary-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.primary-btn:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--accent);
}

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn.large {
    padding: 14px 32px;
    font-size: 15px;
}

.primary-btn.accent {
    background: transparent;
    border: 0.5px solid #FF9F0A;
    color: #FF9F0A;
}

.primary-btn.accent:hover {
    background: rgba(255, 159, 10, 0.1);
    border-color: #FF9F0A;
}

/* 操作行 */
.action-row {
    display: flex;
    justify-content: center;
    padding: 12px 0;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    stroke-width: 1.5;
}

.search-input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 0.5px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 200;
    outline: none;
    transition: all 0.3s ease;
}

.search-input-wrapper input:focus {
    border-color: rgba(0, 122, 255, 0.4);
    background: rgba(0, 122, 255, 0.05);
}

.search-input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

/* 快捷课题 */
.quick-topics {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topic-label,
.template-label {
    font-size: 11px;
    font-weight: 300;
    color: var(--text-tertiary);
}

.topic-chip,
.template-chip {
    padding: 8px 16px;
    border: 0.5px solid rgba(0, 122, 255, 0.2);
    border-radius: 20px;
    background: rgba(0, 122, 255, 0.05);
    color: var(--accent);
    font-size: 12px;
    font-weight: 200;
    cursor: pointer;
    transition: all 0.25s ease;
}

.topic-chip:hover,
.template-chip:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: rgba(0, 122, 255, 0.3);
}

.quick-templates {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 0.5px solid var(--border);
    margin-top: 16px;
}

/* 提示行 */
.tips-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 159, 10, 0.05);
    border: 0.5px solid rgba(255, 159, 10, 0.15);
    border-radius: 12px;
}

.tip-icon {
    font-size: 14px;
}

.tip-text {
    font-size: 12px;
    font-weight: 200;
    color: rgba(255, 159, 10, 0.9);
}

/* 输出占位符 */
.output-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    text-align: center;
}

.placeholder-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 122, 255, 0.05);
    border: 0.5px solid rgba(0, 122, 255, 0.1);
    color: var(--accent);
    margin-bottom: 16px;
}

.placeholder-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1;
}

.output-placeholder p {
    font-size: 13px;
    font-weight: 200;
    color: var(--text-tertiary);
}

/* ==================== 通用按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 0.5px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
}

.btn:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: transparent;
    border: 0.5px solid var(--accent);
    color: var(--accent);
}

.btn-primary:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--accent);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.btn-large {
    padding: 14px 32px;
    font-size: 15px;
}

/* 风格选择器 */
.style-select {
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 200;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    height: 44px;
    box-sizing: border-box;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.style-select:focus {
    border-color: rgba(0, 122, 255, 0.5);
    background-color: rgba(0, 122, 255, 0.05);
}

.style-select option {
    background: #1a1a1a;
    color: var(--text);
}

/* ==================== 设置页面 ==================== */

.settings-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 200;
    color: var(--text);
}

.settings-title svg {
    color: var(--accent);
}

.settings-card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.provider-name {
    font-size: 14px;
    font-weight: 300;
    color: var(--text);
    margin-right: 12px;
}

.provider-status {
    font-size: 11px;
    font-weight: 300;
    padding: 3px 10px;
    border-radius: 8px;
}

.provider-status.active {
    background: rgba(48, 209, 88, 0.1);
    color: var(--success);
    border: 0.5px solid rgba(48, 209, 88, 0.2);
}

.provider-status.inactive {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-tertiary);
    border: 0.5px solid var(--border);
}

.setting-select {
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 200;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(0,122,255,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.setting-select:focus {
    border-color: rgba(0, 122, 255, 0.4);
}

.setting-select option {
    background: #1a1a1a;
    color: var(--text);
}

.api-key-input input {
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 200;
    outline: none;
    transition: all 0.3s ease;
}

.api-key-input input:focus {
    border-color: rgba(0, 122, 255, 0.4);
    background: rgba(0, 122, 255, 0.05);
}

.api-key-input input::placeholder {
    color: var(--text-tertiary);
}

.setting-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Token 统计 */
.token-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.token-stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(0, 122, 255, 0.03);
    border: 0.5px solid rgba(0, 122, 255, 0.1);
    border-radius: 16px;
}

.token-stat-value {
    font-size: 28px;
    font-weight: 200;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.token-stat-label {
    font-size: 11px;
    font-weight: 200;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.token-by-provider h4 {
    font-size: 12px;
    font-weight: 200;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.provider-token-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 10px;
    margin-bottom: 8px;
}

.provider-token-name {
    font-size: 13px;
    font-weight: 300;
    color: var(--text);
    flex: 1;
}

.provider-token-value {
    font-size: 13px;
    font-weight: 200;
    color: var(--accent);
}

.provider-token-requests {
    font-size: 11px;
    font-weight: 200;
    color: var(--text-tertiary);
}

.no-data {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 200;
    padding: 20px;
}

/* ==================== 历史记录面板样式 ==================== */
.history-panel {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-top: 8px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 0.5px solid var(--border);
}

.history-title {
    font-size: 13px;
    font-weight: 300;
    color: var(--text);
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-count {
    font-size: 11px;
    font-weight: 200;
    color: var(--text-tertiary);
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.history-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 0.5px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 200;
    cursor: pointer;
    transition: all 0.25s ease;
}

.history-btn:hover {
    border-color: rgba(0, 122, 255, 0.3);
    color: var(--accent);
    background: rgba(0, 122, 255, 0.05);
}

.history-btn svg {
    stroke-width: 2;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 0.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.history-item:hover {
    background: rgba(0, 122, 255, 0.05);
    border-color: rgba(0, 122, 255, 0.2);
}

.history-item-title {
    font-size: 13px;
    font-weight: 300;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.history-item-time {
    font-size: 11px;
    font-weight: 200;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.history-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 200;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .input-with-btn {
        flex-direction: column;
    }
    
    .input-with-btn input,
    .input-with-btn .primary-btn {
        width: 100%;
    }
    
    .page-hero {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .token-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .history-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .history-list {
        max-height: 200px;
    }
}
