/* 前台样式文件 */

/* 重置和基础样式 */
.tptp-model-frontend * {
    box-sizing: border-box;
}
        .tptp-nav-toggle {
            display: none;
            align-items: center;
            justify-content: center;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 1px solid rgba(255, 255, 255, 0.3);
            background: rgba(255, 255, 255, 0.12);
            color: #fff;
            cursor: pointer;
            transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
        }

        .tptp-nav-toggle:hover,
        .tptp-nav-toggle:focus-visible {
            background: rgba(255, 255, 255, 0.18);
            border-color: rgba(255, 255, 255, 0.45);
            transform: translateY(-1px);
        }

        .tptp-nav-auth {
            display: none;
            padding: 0;
            margin: 0;
            list-style: none;
        }

        .tptp-nav-toggle-bar,
        .tptp-nav-toggle-bar::before,
        .tptp-nav-toggle-bar::after {
            display: block;
            width: 18px;
            height: 2px;
            border-radius: 999px;
            background: currentColor;
            transition: transform 0.2s ease, opacity 0.2s ease;
        }

        .tptp-nav-toggle-bar {
            position: relative;
        }

        .tptp-nav-toggle-bar::before,
        .tptp-nav-toggle-bar::after {
            content: '';
            position: absolute;
            left: 0;
        }

        .tptp-nav-toggle-bar::before {
            top: -6px;
        }

        .tptp-nav-toggle-bar::after {
            top: 6px;
        }

        .tptp-nav-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.55);
            z-index: 950;
            opacity: 0;
            transition: opacity 0.2s ease;
            pointer-events: none;
        }

        body.tptp-nav-open .tptp-nav-toggle-bar {
            background: transparent;
        }

        body.tptp-nav-open .tptp-nav-toggle-bar::before {
            transform: translateY(6px) rotate(45deg);
        }

        body.tptp-nav-open .tptp-nav-toggle-bar::after {
            transform: translateY(-6px) rotate(-45deg);
        }
.tptp-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    line-height: 1.2;
    padding: 0;
    margin: 0;
    color: inherit;
}

.tptp-nav-btn:focus {
    outline: none;
}

.tptp-nav-btn[disabled] {
    cursor: default;
}

.tptp-nav-btn-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tptp-agent-selector h3,
.tptp-chat-history h3 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.02em;
}

.tptp-agent-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.tptp-agent-btn {
    position: relative;
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(248, 250, 252, 0.9);
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tptp-agent-btn::after {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.45);
    transition: border-color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.tptp-agent-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
    border-color: rgba(37, 99, 235, 0.45);
}

.tptp-agent-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 22px 36px rgba(37, 99, 235, 0.25);
}

.tptp-agent-btn.active::after {
    content: '✓';
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.65);
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tptp-agent-more-wrap {
    margin-top: 4px;
}

.tptp-agent-more-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(248, 250, 252, 0.9);
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    appearance: auto;
}

.tptp-agent-more-select:hover,
.tptp-agent-more-select:focus {
    border-color: rgba(37, 99, 235, 0.45);
    outline: none;
}

.tptp-chat-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.tptp-chat-history {
    margin-top: 26px;
}

.tptp-history-list {
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    padding: 18px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tptp-mobile-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(248, 250, 252, 0.9);
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tptp-mobile-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.16);
}

.tptp-toggle-icon {
    position: relative;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: background 0.2s ease;
}

.tptp-toggle-icon::before,
.tptp-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.2s ease;
}

        
            .tptp-user-actions {
                order: 2;
            }
body.tptp-mobile-sidebar-open .tptp-toggle-icon::after {
    transform: translateY(-6px) rotate(-45deg);
}

.tptp-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1095;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.tptp-sidebar-close {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tptp-sidebar-close:hover {
    background: rgba(59, 130, 246, 0.18);
}

@media (max-width: 900px) {
    .tptp-model-frontend {
        padding: 24px 0 32px;
    }

    .tptp-chat-container {
        padding: 0 20px 32px;
    }

    .tptp-chat-layout {
        grid-template-columns: 1fr;
        position: relative;
    }

    .tptp-chat-header {
        flex-direction: column;
        align-items: center;
        gap: 14px;
        text-align: center;
    }

    .tptp-chat-header h2 {
        width: 100%;
        font-size: 18px;
        text-align: center;
    }

    .tptp-mobile-toggle {
        display: inline-flex;
        width: 100%;
        justify-content: center;
    }

    .tptp-chat-info {
        width: 100%;
        text-align: center;
    }

    body.tptp-mobile-sidebar-open {
        overflow: hidden;
    }

    body.tptp-nav-open {
        overflow: hidden;
    }

    .tptp-chat-sidebar {
        position: fixed;
        inset: 64px 0 0 0;
        max-width: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -6px 38px rgba(15, 23, 42, 0.28);
        padding: 24px 22px 32px;
        overflow-y: auto;
        background: rgba(255, 255, 255, 0.98);
        transform: translateY(20px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.25s ease, opacity 0.25s ease;
        z-index: 1100;
    }

    .tptp-header-container {
        gap: 10px;
    }

    .tptp-nav-toggle {
        display: inline-flex;
        order: 2;
    }

    .tptp-header nav {
        order: 3;
        flex: 0 0 auto;
    }

    .tptp-user-actions {
        display: none;
    }

    .tptp-nav-auth {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 12px;
        padding: 0;
        width: 45%;
    }

    .tptp-nav-auth .tptp-nav-btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.28);
        background: rgba(255, 255, 255, 0.12);
        color: #f8fafc;
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.01em;
        text-align: center;
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
    }

    .tptp-nav-auth .tptp-nav-btn:hover,
    .tptp-nav-auth .tptp-nav-btn:focus-visible {
        background: rgba(255, 255, 255, 0.22);
        border-color: rgba(255, 255, 255, 0.4);
        transform: translateY(-1px);
    }

    .tptp-nav-auth .tptp-nav-btn.tptp-nav-identity {
        pointer-events: none;
        background: rgba(15, 23, 42, 0.45);
        border-color: rgba(148, 163, 184, 0.38);
        color: #e2e8f0;
        cursor: default;
        box-shadow: none;
    }

    .tptp-nav-auth .tptp-nav-btn.tptp-nav-identity:hover,
    .tptp-nav-auth .tptp-nav-btn.tptp-nav-identity:focus-visible {
        transform: none;
    }

    nav .tptp-nav {
        position: fixed;
        top: 64px;
        left: 16px;
        right: 16px;
        margin-top: 0;
        padding: 18px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        background: rgba(30, 60, 114, 0.96);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
        transform: translateY(-16px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
        z-index: 960;
        overflow-y: auto;
        max-height: calc(100vh - 80px);
        backdrop-filter: blur(12px);
    }

    .tptp-nav li {
        margin: 0;
    }

    .tptp-nav a {
        width: 100%;
        padding: 12px 14px;
        border-radius: 12px;
        opacity: 1;
        text-align: left;
    }

    body.tptp-nav-open nav .tptp-nav {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .tptp-nav-overlay {
        display: block;
    }

    body.tptp-nav-open .tptp-nav-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    body.tptp-mobile-sidebar-open .tptp-chat-sidebar {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .tptp-sidebar-content {
        padding: 10px 0 40px;
    }

    .tptp-sidebar-close {
        display: inline-flex;
        margin-bottom: 16px;
    }

    .tptp-sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
    }

    body.tptp-mobile-sidebar-open .tptp-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .tptp-chat-messages {
        padding: 20px 16px;
    }

    .tptp-chat-input {
        padding: 18px 16px;
    }
}

@media (max-width: 1024px) {
    .tptp-user-actions {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .tptp-chat-container {
        padding: 0 20px 28px;
    }

    .tptp-chat-sidebar {
        padding: 22px 18px 28px;
        inset: 68px 0 0 0;
        border-radius: 18px 18px 0 0;
        max-height: calc(100vh - 68px);
    }

    .tptp-sidebar-content {
        padding: 6px 0 32px;
    }

    .tptp-mobile-toggle {
        padding: 9px 14px;
        font-size: 13px;
        align-self: center;
        width: 100%;
        justify-content: center;
    }

    .tptp-chat-header {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
    }

    .tptp-chat-header h2 {
        font-size: 17px;
        width: 100%;
        text-align: center;
    }

    .tptp-chat-info {
        width: 100%;
        text-align: center;
    }

    .tptp-message {
        padding: 14px 16px;
        gap: 14px;
    }

    .tptp-message-content {
        gap: 10px;
    }

    .tptp-message-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.tptp-action-btn {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tptp-action-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.tptp-action-warm {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.tptp-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
}

.tptp-chat-history {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tptp-history-list {
    flex: 1;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    padding: 12px;
    overflow-y: auto;
}

.tptp-history-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tptp-history-items li {
    margin: 0;
}

.tptp-history-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-align: left;
    appearance: none;
}

.tptp-history-item:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

.tptp-history-item:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.65);
    outline-offset: 2px;
}

.tptp-history-item.active {
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.18);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(59, 130, 246, 0.16) 100%);
}

.tptp-history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.tptp-history-item-preview {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    max-height: 3.2em;
    overflow: hidden;
}

.tptp-history-item-meta {
    font-size: 11px;
    color: #64748b;
    letter-spacing: 0.03em;
}

.tptp-history-empty {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    padding: 40px 0;
}

.tptp-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    width: 100%;
    min-width: 0;
}

.tptp-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    backdrop-filter: blur(12px);
}

.tptp-chat-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.tptp-chat-info {
    font-size: 13px;
    color: #64748b;
}

.tptp-chat-messages {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.tptp-welcome-message {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.18) 100%);
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 24px;
    color: #1d4ed8;
}

.tptp-welcome-content h3 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
}

.tptp-welcome-content p {
    margin: 0 0 12px;
    color: #1e3a8a;
}

.tptp-chat-input {
    padding: 20px 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    background: #ffffff;
}

.tptp-input-container {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.tptp-input-container textarea {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.tptp-input-container textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tptp-knowledge-panel {
    margin-top: 14px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.tptp-knowledge-panel[open] {
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.12);
}

.tptp-knowledge-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    color: #1d4ed8;
    list-style: none;
    margin: 0;
}

.tptp-knowledge-summary::-webkit-details-marker {
    display: none;
}

.tptp-knowledge-icon {
    font-size: 18px;
}

.tptp-knowledge-label {
    font-size: 14px;
    letter-spacing: 0.02em;
}

.tptp-knowledge-count {
    margin-left: auto;
    font-size: 12px;
    color: #1e40af;
    background: rgba(37, 99, 235, 0.15);
    padding: 2px 8px;
    border-radius: 999px;
}

.tptp-knowledge-collapse {
    border-top: 1px solid rgba(37, 99, 235, 0.18);
    padding: 12px 16px 16px;
}

.tptp-knowledge-body {
    color: #1f2937;
    font-size: 14px;
    line-height: 1.6;
}

.tptp-knowledge-body ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tptp-knowledge-item {
    background: #ffffff;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.08);
}

.tptp-knowledge-item-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    padding: 4px 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tptp-knowledge-item-btn:hover .tptp-knowledge-item-title {
    color: #1e40af;
}

.tptp-knowledge-item-index {
    color: #64748b;
    min-width: 2.4em;
    display: inline-block;
}

.tptp-knowledge-item-title {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
}

.tptp-knowledge-link-icon {
    font-size: 12px;
    color: #2563eb;
}

.tptp-knowledge-meta {
    color: #475569;
    font-size: 12px;
    margin: 2px 0 4px 2.6em;
}

.tptp-knowledge-preview {
    color: #334155;
    font-size: 12px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 6px;
    padding: 8px 10px;
    margin-left: 2.6em;
    line-height: 1.6;
}

.tptp-knowledge-empty {
    color: #6b7280;
    font-size: 13px;
}

.tptp-chat-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tptp-action-btn {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tptp-action-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.tptp-action-warm {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.tptp-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
}

.tptp-chat-history {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tptp-history-list {
    flex: 1;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    padding: 12px;
    overflow-y: auto;
}

.tptp-history-empty {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    padding: 40px 0;
}

.tptp-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    width: 100%;
    min-width: 0;
}

.tptp-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    backdrop-filter: blur(12px);
}

.tptp-chat-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.tptp-chat-info {
    font-size: 13px;
    color: #64748b;
}

.tptp-chat-messages {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.tptp-welcome-message {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.18) 100%);
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 24px;
    color: #1d4ed8;
}

.tptp-welcome-content h3 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
}

.tptp-welcome-content p {
    margin: 0 0 12px;
    color: #1e3a8a;
}

.tptp-chat-input {
    padding: 20px 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    background: #ffffff;
}

.tptp-input-container {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.tptp-input-container textarea {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.tptp-input-container textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tptp-message {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    position: relative;
}

.tptp-message.user {
    margin-left: auto;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-color: transparent;
}

.tptp-message.assistant {
    margin-right: auto;
    color: #0f172a;
}

.tptp-message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.tptp-message.user .tptp-message-avatar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(226, 232, 240, 0.25) 100%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #1d4ed8;
    backdrop-filter: blur(6px);
}

.tptp-message-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: transparent;
    border-radius: 12px;
    padding: 4px;
    color: inherit;
}

.tptp-message.assistant .tptp-message-content {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
}

.tptp-message-text {
    font-size: 15px;
    line-height: 1.7;
    word-break: break-word;
}

.tptp-message-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tptp-message.assistant .tptp-message-actions {
    opacity: 1;
    position: static;
}

.tptp-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(37, 99, 235, 0.12);
    border: none;
    border-radius: 999px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.tptp-copy-btn .tptp-copy-text {
    line-height: 1;
}

.tptp-copy-btn:hover {
    background: rgba(37, 99, 235, 0.22);
    transform: translateY(-1px);
}

.tptp-message.user .tptp-copy-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tptp-message.user .tptp-copy-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.tptp-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    color: #64748b;
    background: #f8fafc;
}

.tptp-loading.show {
    display: flex;
}

.tptp-chat-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 120px 20px;
}

.tptp-empty-state {
    max-width: 520px;
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 48px;
    text-align: center;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.tptp-empty-state h2 {
    margin: 0 0 12px;
    font-size: 22px;
    color: #1d4ed8;
}

.tptp-empty-state p {
    margin: 0;
    color: #475569;
    font-size: 15px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .tptp-chat-sidebar {
        top: 24px;
    }
}

@media (max-width: 768px) {
    .tptp-header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 0;
    }
    .tptp-message-content {
        max-width: 100%;
    }
    
    .tptp-input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tptp-input-actions {
        align-self: flex-end;
    }
    
    .tptp-sidebar-content {
        padding: 15px;
    }
    
    .tptp-chat-messages {
        padding: 15px;
    }
    
    .tptp-chat-input {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .tptp-header {
        padding: 0 10px;
    }
    
    .tptp-site-title {
        font-size: 16px;
    }
    
    .tptp-nav a {
        padding: 5px 8px;
        font-size: 14px;
    }

    .tptp-chat-container {
        padding: 0 20px 26px;
    }

    .tptp-nav-auth {
        gap: 8px;
    }

    .tptp-nav-auth .tptp-nav-btn {
        flex: 1 1 calc(50% - 4px);
        padding: 9px 10px;
        font-size: 13px;
    }

    .tptp-chat-sidebar {
        inset: 72px 0 0 0;
        padding: 20px 16px 26px;
        max-height: calc(100vh - 72px);
    }

    .tptp-sidebar-close {
        width: 100%;
        justify-content: center;
    }

    .tptp-mobile-toggle {
        width: 100%;
        justify-content: center;
    }

    .tptp-chat-header {
        align-items: center;
    }

    .tptp-chat-info {
        width: 100%;
        font-size: 12px;
        text-align: center;
    }
    
    .tptp-message-content {
        max-width: 100%;
        padding: 10px;
    }
    
    .tptp-message-avatar {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}

/* 动画效果 */
.tptp-message {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tptp-message.assistant.tptp-message-pending .tptp-message-text {
    color: #9ca3af;
    font-style: italic;
}

.tptp-message.assistant.tptp-message-pending .tptp-message-actions {
    display: none;
}

.tptp-message-placeholder {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.05em;
}

.tptp-message-error {
    color: #ef4444;
    font-weight: 600;
}

.tptp-thinking-panel {
    margin-top: 10px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 14px 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tptp-thinking-panel > summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #1f2937;
    padding: 12px 0;
    margin: 0;
    list-style: none;
}

.tptp-thinking-panel summary::-webkit-details-marker {
    display: none;
}

.tptp-thinking-panel[open] {
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12);
}

.tptp-thinking-body {
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    padding-top: 10px;
}

.tptp-thinking-icon {
    font-size: 16px;
}

.tptp-thinking-label {
    font-size: 14px;
    letter-spacing: 0.03em;
}

.tptp-knowledge-detail {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
    color: #0f172a;
    line-height: 1.7;
}

.tptp-knowledge-detail-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(37, 99, 235, 0.12);
    border-radius: 6px;
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.tptp-knowledge-detail-link a:hover {
    background: rgba(37, 99, 235, 0.18);
}

.tptp-knowledge-detail-meta {
    color: #475569;
    font-size: 13px;
}

/* 滚动条样式 */
.tptp-chat-messages::-webkit-scrollbar,
.tptp-history-list::-webkit-scrollbar {
    width: 6px;
}

.tptp-chat-messages::-webkit-scrollbar-track,
.tptp-history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tptp-chat-messages::-webkit-scrollbar-thumb,
.tptp-history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.tptp-chat-messages::-webkit-scrollbar-thumb:hover,
.tptp-history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 代码块样式 */
.tptp-message-text pre {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    overflow-x: auto;
    margin: 10px 0;
}

.tptp-message-text code {
    background: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* 链接样式 */
.tptp-message-text a {
    color: #0073aa;
    text-decoration: none;
}

.tptp-message-text a:hover {
    text-decoration: underline;
}

/* 列表样式 */
.tptp-message-text ul,
.tptp-message-text ol {
    margin: 10px 0;
    padding-left: 20px;
}

.tptp-message-text li {
    margin: 5px 0;
}

/* 引用样式 */
.tptp-message-text blockquote {
    border-left: 4px solid #0073aa;
    margin: 10px 0;
    padding-left: 15px;
    color: #666;
    font-style: italic;
}

/* 表格样式 */
.tptp-message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.tptp-message-text th,
.tptp-message-text td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.tptp-message-text th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* 加载动画 */
.tptp-loading-dots {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 20px;
}

.tptp-loading-dots div {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0073aa;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
    transform: translateY(-50%);
}

.tptp-loading-dots div:nth-child(1) {
    left: 4px;
    animation: loading-dots1 0.6s infinite;
}

.tptp-loading-dots div:nth-child(2) {
    left: 4px;
    animation: loading-dots2 0.6s infinite;
}

.tptp-loading-dots div:nth-child(3) {
    left: 16px;
    animation: loading-dots2 0.6s infinite;
}

.tptp-loading-dots div:nth-child(4) {
    left: 28px;
    animation: loading-dots3 0.6s infinite;
}

@keyframes loading-dots1 {
    0% {
        transform: translateY(-50%) scale(0);
    }
    100% {
        transform: translateY(-50%) scale(1);
    }
}

@keyframes loading-dots3 {
    0% {
        transform: translateY(-50%) scale(1);
    }
    100% {
        transform: translateY(-50%) scale(0);
    }
}

@keyframes loading-dots2 {
    0% {
        transform: translateY(-50%) translateX(0);
    }
    100% {
        transform: translateY(-50%) translateX(12px);
    }
}

/* 错误状态样式 */
.tptp-error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    color: #721c24;
}

.tptp-error-message::before {
    content: "⚠️ ";
    margin-right: 5px;
}

/* 成功状态样式 */
.tptp-success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    color: #155724;
}

.tptp-success-message::before {
    content: "✅ ";
    margin-right: 5px;
}

/* 提示样式 */
.tptp-tip {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    color: #0c5460;
}

.tptp-tip::before {
    content: "💡 ";
    margin-right: 5px;
}

/* 桌面端两列布局修复 */
@media (min-width: 901px) {
    .tptp-chat-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 30px 32px 48px;
    }

    .tptp-chat-layout {
        display: grid;
        grid-template-columns: 320px minmax(0, 1fr);
        gap: 28px;
        align-items: start;
    }

    .tptp-chat-sidebar {
        position: sticky;
        top: 96px;
        align-self: start;
        height: calc(100vh - 140px);
        overflow-y: auto;
        padding: 28px 24px;
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.92);
        border: 1px solid rgba(148, 163, 184, 0.25);
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
    }

    .tptp-chat-main {
        border-radius: 24px;
        overflow: hidden;
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
        background: rgba(248, 250, 252, 0.95);
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .tptp-model-frontend {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .tptp-header {
        background: #2d2d2d;
        border-bottom-color: #404040;
    }
    
    .tptp-chat-sidebar {
        background: #2d2d2d;
        border-right-color: #404040;
    }
    
    .tptp-chat-main {
        background: #1a1a1a;
    }
    
    .tptp-chat-header {
        background: #2d2d2d;
        border-bottom-color: #404040;
    }
    
    .tptp-chat-messages {
        background: #1a1a1a;
    }
    
    .tptp-chat-input {
        background: #2d2d2d;
        border-top-color: #404040;
    }
    
    .tptp-message.assistant .tptp-message-content {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .tptp-footer {
        background: #2d2d2d;
        border-top-color: #404040;
    }
}

/* 打印样式 */
@media print {
    .tptp-header,
    .tptp-chat-sidebar,
    .tptp-chat-input,
    .tptp-footer {
        display: none;
    }
    
    .tptp-chat-main {
        width: 100%;
        height: auto;
    }
    
    .tptp-chat-messages {
        overflow: visible;
        height: auto;
    }
    
    .tptp-message {
        page-break-inside: avoid;
    }
}
