:root {
    --tp-border-color: #DBE2E6;
    --tp-bg-light: #ffffff;
    --tp-bg-sidebar: #f8fafc;
    --tp-text-main: #1e293b;
    --tp-text-muted: #64748b;
    --tp-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tp-radius: 12px;
}

.tp-chatbot-wrapper {
    all: initial;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    display: block;
    width: 100%;
    min-height: 600px;
    height: 80vh;
    max-height: 90vh;
    border: 1px solid var(--tp-border-color);
    border-radius: var(--tp-radius);
    overflow: clip;
    background: var(--tp-bg-light);
    box-shadow: var(--tp-shadow);
    color: var(--tp-text-main);
    margin: 20px 0;
}

.tp-chatbot-layout {
    display: flex;
    height: 100%;
    position: relative;
}

/* Sidebar Styling */
.tp-chatbot-sidebar {
    width: 280px;
    background: var(--tp-bg-sidebar);
    border-right: 1px solid var(--tp-border-color);
    display: flex;
    flex-direction: column;
}

.tp-sidebar-header {
    height: 70px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--tp-border-color);
    box-sizing: border-box;
}

.tp-new-chat-item {
    width: 100%;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    box-sizing: border-box;
    color: var(--tp-text-main);
}

.tp-new-chat-item:hover {
    background: var(--chatbot-primary-bgcolor);
    color: var(--chatbot-primary-color);
}

.tp-new-chat-item:hover .tp-new-chat-icon {
    color: var(--chatbot-primary-color);
}

.tp-new-chat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tp-text-muted);
}

.tp-new-chat-text {
    font-size: 14px;
    font-weight: 500;
}

.tp-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tp-sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tp-text-muted);
    margin-bottom: 12px;
}

.tp-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--tp-border-color);
    font-size: 14px;
}

.tp-sidebar-footer a {
    color: var(--chatbot-primary-bgcolor);
    text-decoration: none;
}

.tp-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tp-history-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
}

.tp-history-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-history-delete {
    background: transparent;
    border: none;
    padding: 4px;
    color: inherit;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    border-radius: 4px;
}

.tp-history-item:hover .tp-history-delete {
    opacity: 0.7;
    background: transparent !important;
}

.tp-history-delete:hover {
    opacity: 1 !important;
    background: transparent !important;
}

.tp-history-item:hover,
.tp-history-item.active {
    background: var(--chatbot-primary-bgcolor);
    color: var(--chatbot-primary-color);
}

.tp-history-item.active {
    border-left: 3px solid var(--chatbot-primary-bgcolor);
}

/* Main Content Area */
.tp-chatbot-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    height: 100%;
    min-height: 0;
}

.tp-chatbot-header {
    height: 70px;
    padding: 0 25px;
    border-bottom: 1px solid var(--tp-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
    gap: 15px;
}

.tp-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--tp-text-main);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tp-sidebar-toggle:hover {
    background: #f1f5f9;
}

.tp-header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-header-logo img {
    height: 32px;
    width: auto;
}

.tp-header-info {
    display: flex;
    flex-direction: column;
}

.tp-brand-name {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.tp-version {
    font-size: 10px;
    color: var(--tp-text-muted);
}

.tp-help-link {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--tp-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--tp-text-muted);
    font-size: 14px;
}

/* Chat History Display */
.tp-chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tp-greeting {
    text-align: center;
    padding: 20px;
    color: var(--tp-text-muted);
    font-style: italic;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tp-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
}

.tp-message-user {
    align-self: flex-end;
    background: var(--chatbot-primary-bgcolor);
    color: var(--chatbot-primary-color);
    border-bottom-right-radius: 2px;
}

.tp-message-assistant {
    align-self: flex-start;
    background: transparent !important;
    padding: 0 !important;
    display: flex;
    gap: 12px;
    max-width: 90% !important;
}

.tp-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid var(--tp-border-color);
}

.tp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tp-message-content {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    color: var(--tp-text-main);
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    min-width: 0;
}

/* Footer & Input */
.tp-chatbot-footer {
    padding: 10px 15px;
    border-top: 1px solid var(--tp-border-color);
    flex-shrink: 0;
    background: white;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.tp-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tp-suggestion-chip {
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tp-suggestion-chip:hover {
    background: white;
    border-color: var(--chatbot-primary-bgcolor);
    color: var(--chatbot-primary-bgcolor);
}

.tp-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 25px;
    border: 1px solid var(--tp-border-color);
    transition: border-color 0.2s;
    position: relative;
    padding-right: 60px;
}

.tp-input-wrapper:focus-within {
    border-color: var(--chatbot-primary-bgcolor);
}

.tp-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--tp-text-main);
}

.tp-input-wrapper input:focus,
.tp-input-wrapper input:hover {
    border: 0 !important;
}

.tp-chatbot-wrapper .tp-send-btn {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: var(--chatbot-primary-bgcolor) !important;
    color: var(--chatbot-primary-color) !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: opacity 0.2s !important;
    padding: 0 !important;
    margin: 0 !important;
}

.tp-send-btn:hover {
    opacity: 0.9;
}

.tp-send-btn svg {
    width: 17px;
    height: 18px;
    overflow: visible;
}

.tp-powered-by {
    margin-top: 15px;
    font-size: 10px;
    text-align: right;
    color: var(--tp-text-muted);
}

.tp-powered-by a {
    text-decoration: none;
    color: var(--chatbot-primary-bgcolor);
    font-weight: 600;
}

/* Loading States */
.tp-loading-dots {
    display: flex;
    gap: 4px;
    padding: 10px;
}

.tp-loading-dot {
    width: 6px;
    height: 6px;
    background: var(--tp-text-muted);
    border-radius: 50%;
    animation: mf-bounce 1.4s infinite ease-in-out;
}

.tp-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.tp-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes tp-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}


/* Code blocks */
.tp-code-container {
    background: #0d0d0d;
    border-radius: 8px;
    margin: 12px 0;
    overflow: hidden;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.tp-code-header {
    background: #2f2f2f;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #b4b4b4;
    font-size: 12px;
}

.tp-code-lang {
    text-transform: lowercase;
}

.tp-code-copy {
    background: var(--chatbot-primary-bgcolor);
    border: none;
    color: var(--chatbot-primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: opacity 0.2s, background 0.2s;
    font-weight: 500;
}

.tp-code-copy:hover {
    opacity: 0.9;
}

.tp-code-copy svg {
    opacity: 0.8;
}

.tp-code-container pre {
    margin: 0 !important;
    padding: 16px !important;
    overflow-x: auto !important;
    background: transparent !important;
    border: none !important;
}

.tp-code-container code {
    color: #e6e6e6 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    background: transparent !important;
    padding: 0 !important;
    font-family: inherit !important;
}

/* Scrollbar for code blocks */
.tp-code-container pre::-webkit-scrollbar {
    height: 8px;
}

.tp-code-container pre::-webkit-scrollbar-track {
    background: transparent;
}

.tp-code-container pre::-webkit-scrollbar-thumb {
    background: #3f3f3f;
    border-radius: 4px;
}

.tp-code-container pre::-webkit-scrollbar-thumb:hover {
    background: #4f4f4f;
}

/* Sidebar Overlay */
.tp-sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 95;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tp-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tp-sidebar-toggle {
        display: flex;
    }

    .tp-chatbot-sidebar {
        position: absolute;
        top: 0;
        left: -280px;
        height: 100%;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.15);
        visibility: hidden;
    }

    .tp-chatbot-sidebar.active {
        left: 0;
        visibility: visible;
    }

    .tp-chatbot-main {
        width: 100%;
    }

    .tp-message {
        max-width: 92%;
    }

    .tp-chatbot-header {
        padding: 0 15px;
    }

    .tp-chatbot-footer {
        padding: 15px;
    }

    .tp-input-wrapper {
        padding-right: 55px;
    }

    .tp-brand-name {
        font-size: 14px !important;
    }
}