/* AI 聊天页 V1.1 — 与首页色调一致 */

/* 顶栏渐隐/展开（仅 /ai/ 页） */
.top-header.ai-top-header {
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    max-height: 56px;
}
.top-header.ai-top-header--no-transition {
    transition: none !important;
}
.top-header.ai-top-header--hidden {
    max-height: 0;
    opacity: 0;
    border-bottom-color: transparent;
    box-shadow: none;
    pointer-events: none;
}
body.ai-header-hidden .ai-chat-page {
    min-height: 100vh;
}
body.ai-header-hidden .ai-chat-layout {
    min-height: calc(100vh - 24px);
}

.ai-chat-page {    /*max-width: 1400px;*/
    margin: 0 auto;
    padding-bottom: 24px;
    /*padding: 0 16px 24px;*/
    box-sizing: border-box;
    min-height: calc(100vh - 49px);
    display: flex;
    flex-direction: column;
}

.ai-chat-breadcrumb {
    font-size: 13px;
    color: #9ca3af;
    padding: 12px 0 8px;
}
.ai-chat-breadcrumb a {
    color: #6b7280;
}
.ai-chat-breadcrumb a:hover {
    color: #1e90ff;
}
.ai-chat-breadcrumb .sep {
    margin: 0 6px;
}

.ai-chat-layout {
    flex: 1;
    display: flex;
    gap: 0;
    min-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

/* ── Sidebar tabs ── */
.ai-chat-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.ai-chat-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 6px;
}
.ai-chat-sidebar-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}
.ai-chat-sidebar-title-link {
    color: inherit;
    text-decoration: none;
}
.ai-chat-sidebar-title-link:hover {
    color: #1e90ff;
}
.ai-chat-sidebar-title i {
    color: #1e90ff;
}
.ai-header-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    padding: 4px 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #1e90ff;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.ai-header-toggle:hover {
    background: rgba(30, 144, 255, 0.1);
}
.ai-header-toggle.ai-header-toggle--active {
    color: #059669;
}
.ai-header-toggle.ai-header-toggle--active:hover {
    background: rgba(5, 150, 105, 0.1);
}.ai-chat-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
}
.ai-chat-sidebar-tip {
    margin: 0 14px 10px;
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.4;
}
.ai-chat-draft-nav {
    padding: 0 12px 10px;
}
.ai-chat-draft-link {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.ai-chat-draft-link:hover {
    color: #1e90ff;
    border-color: #1e90ff;
    background: #f0f8ff;
}
.ai-chat-draft-link--active {
    color: #1e90ff;
    border-color: #1e90ff;
    background: #f0f8ff;
}
.ai-chat-main--draft {
    overflow: auto;
}
.ai-chat-group {
    padding: 0 8px 12px;
}
.ai-chat-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 8px 6px;
}
.ai-chat-badge {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}
.ai-chat-tab-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.ai-chat-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    margin-bottom: 2px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: #374151;
    transition: background 0.15s, color 0.15s;
    box-sizing: border-box;
}
.ai-chat-tab:hover {
    background: rgba(30, 144, 255, 0.06);
}
.ai-chat-tab.active {
    background: rgba(30, 144, 255, 0.12);
    color: #1e90ff;
    font-weight: 600;
}
.ai-chat-tab-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.ai-chat-tab-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-chat-tab-tag {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.06);
    color: #6b7280;
    flex-shrink: 0;
}

/* ── Main content ── */
.ai-chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #f5f6f8;
}
.ai-chat-seo {
    padding: 14px 18px 10px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.ai-chat-seo.collapsed {
    display: none;
}
.ai-chat-seo-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}
.ai-chat-seo-intro {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.65;
}

.ai-chat-panes {
    flex: 1;
    position: relative;
    min-height: 480px;
}
.ai-chat-pane {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    background: #fff;
}
.ai-chat-pane.active {
    display: flex;
}
.ai-chat-pane-frame-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
    background: #fff;
}
.ai-chat-pane iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.ai-chat-pane-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 14px;
    z-index: 2;
}
.ai-chat-pane-loading.hidden {
    display: none;
}
.ai-chat-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(30, 144, 255, 0.15);
    border-top-color: #1e90ff;
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-chat-fallback {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    gap: 12px;
    background: #f9fafb;
}
.ai-chat-fallback-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}
.ai-chat-fallback h3 {
    margin: 0;
    font-size: 18px;
    color: #111827;
}
.ai-chat-fallback p {
    margin: 0;
    max-width: 420px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
}
.ai-chat-fallback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}
.ai-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s;
}
.ai-chat-btn-primary {
    background: #1e90ff;
    color: #fff;
}
.ai-chat-btn-primary:hover {
    background: #1873cc;
    color: #fff;
}
.ai-chat-btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.ai-chat-btn-secondary:hover {
    background: #f3f4f6;
    color: #111827;
}

.ai-chat-pane-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 16px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 13px;
}
.ai-chat-pane-footer a {
    color: #1e90ff;
}
.ai-chat-pane-footer a:hover {
    text-decoration: underline;
}
.ai-chat-pane-footer .sep {
    color: #d1d5db;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .ai-chat-layout {
        flex-direction: column;
        min-height: calc(100vh - 90px);
    }
    .ai-chat-sidebar {
        width: 100%;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
    .ai-chat-sidebar-toggle {
        display: block;
    }
    .ai-chat-sidebar.collapsed .ai-chat-group,
    .ai-chat-sidebar.collapsed .ai-chat-sidebar-tip {
        display: none;
    }
    .ai-chat-panes {
        min-height: 360px;
    }
    .ai-chat-seo {
        padding: 10px 14px;
    }
}

/* /ai/ 提示词草稿页 */
.ai-index-page {
    max-width: none;
    margin: 0;
    padding: 24px 28px 40px;
    box-sizing: border-box;
}

.ai-index-hero {
    margin-bottom: 28px;
}

.ai-index-title {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-index-title i {
    color: #1e90ff;
    font-size: 22px;
}

.ai-index-lead {
    margin: 0;
    font-size: 15px;
    line-height: 1.75;
    color: #4b5563;
}
.ai-index-lead strong {
    color: #111827;
    font-weight: 600;
}

.ai-index-draft {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 20px 22px 18px;
    margin-bottom: 28px;
}

.ai-index-draft-heading {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.ai-index-draft-desc {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
}

.ai-index-draft-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.ai-index-textarea {
    display: block;
    width: 100%;
    min-height: 320px;
    padding: 16px 18px;
    font-size: 15px;
    line-height: 1.65;
    color: #1f2937;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-index-textarea:focus {
    outline: none;
    border-color: #1e90ff;
    box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.12);
    background: #fff;
}
.ai-index-textarea::placeholder {
    color: #9ca3af;
}

.ai-index-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.ai-index-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.ai-index-btn:hover {
    background: #e5e7eb;
}
.ai-index-btn--primary {
    color: #fff;
    background: #1e90ff;
    border-color: #1e90ff;
}
.ai-index-btn--primary:hover {
    background: #1873cc;
    border-color: #1873cc;
}

.ai-index-copy-tip {
    font-size: 13px;
    color: #059669;
}

.ai-index-action-tip {
    font-size: 13px;
    color: #059669;
}
.ai-index-action-tip--muted {
    color: #9ca3af;
}

.ai-index-about {
    padding: 0 2px;
}

.ai-index-about-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.ai-index-about-text {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.75;
    color: #4b5563;
}
.ai-index-about-text code {
    padding: 2px 6px;
    font-size: 13px;
    background: #f3f4f6;
    border-radius: 4px;
    color: #1e40af;
}

.ai-index-about-list {
    margin: 0 0 22px;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.8;
    color: #6b7280;
}
.ai-index-about-list code {
    padding: 1px 5px;
    font-size: 12px;
    background: #f3f4f6;
    border-radius: 4px;
}

@media (max-width: 640px) {
    .ai-index-page {
        padding: 20px 14px 36px;
    }
    .ai-index-title {
        font-size: 22px;
    }
    .ai-index-textarea {
        min-height: 260px;
        font-size: 16px;
    }
    .ai-index-draft {
        padding: 16px;
    }
}
