/* Hey Trisha Chat Admin Interface - ChatGPT-like UI */

/* Keep chat page self-contained without breaking WP admin menu stacking. */
.wrap:has(#heytrisha-chat-admin-root) {
    position: relative;
    z-index: auto;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Remove WP default bottom padding that leaves a large blank strip under the chat UI. */
body.heytrisha-admin-page-new-chat #wpbody-content,
body.heytrisha-admin-page-new-chat .wrap:has(#heytrisha-chat-admin-root) {
    padding-bottom: 0;
    margin-bottom: 0;
}

#heytrisha-chat-admin-root {
    /* WP admin has varying toolbars/notices; prefer flexible sizing. */
    height: calc(100vh - 100px);
    height: calc(100dvh - 100px);
    min-height: 480px;
    display: flex;
    flex-direction: column;
    background: #343541;
    border-radius: 8px;
    overflow: hidden;
}

.heytrisha-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #343541;
}

.heytrisha-chat-main {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.heytrisha-chat-sidebar {
    width: 260px;
    min-width: 260px;
    background: #202123;
    border-right: 1px solid #4d4d4f;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
}

.heytrisha-chat-sidebar.hidden {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: hidden;
}

.heytrisha-chat-sidebar.hidden > * {
    opacity: 0;
    pointer-events: none;
}

.heytrisha-chat-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #4d4d4f;
}

.heytrisha-new-chat-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid #565869;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.heytrisha-new-chat-btn:hover {
    background: #343541;
}

.heytrisha-chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.heytrisha-chat-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    color: #c5c5d2;
    font-size: 14px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.heytrisha-chat-item:hover {
    background: #343541;
}

.heytrisha-chat-item.active {
    background: #343541;
}

.heytrisha-chat-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.heytrisha-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-width: 0;
}

.heytrisha-chat-header {
    padding: 16px 24px;
    background: #343541;
    border-bottom: 1px solid #4d4d4f;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.heytrisha-chat-header-start {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.heytrisha-chat-header h1 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.heytrisha-hybrid-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    color: #c5c5d2;
}

.heytrisha-hybrid-toggle.is-saving {
    opacity: 0.65;
    cursor: wait;
}

.heytrisha-hybrid-toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: #ececf1;
}

.heytrisha-hybrid-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.heytrisha-hybrid-toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #565869;
    transition: background 0.2s ease;
}

.heytrisha-hybrid-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.heytrisha-hybrid-toggle-input:checked + .heytrisha-hybrid-toggle-track {
    background: #10a37f;
}

.heytrisha-hybrid-toggle-input:checked + .heytrisha-hybrid-toggle-track .heytrisha-hybrid-toggle-thumb {
    transform: translateX(20px);
}

.heytrisha-hybrid-toggle-input:focus-visible + .heytrisha-hybrid-toggle-track {
    outline: 2px solid #10a37f;
    outline-offset: 2px;
}

.heytrisha-hybrid-toggle-input:disabled + .heytrisha-hybrid-toggle-track {
    opacity: 0.7;
}

.heytrisha-sidebar-toggle {
    background: transparent;
    border: none;
    color: #c5c5d2;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.heytrisha-sidebar-toggle:hover {
    background: #40414f;
}

.heytrisha-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* New chat empty view: place welcome text above the composer instead of vertical center. */
.heytrisha-chat-messages:has(> .heytrisha-empty-state) {
    justify-content: flex-end;
    padding-top: 12px;
    padding-bottom: 8px;
    gap: 0;
}

.heytrisha-message {
    display: flex;
    gap: 24px;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}

.heytrisha-message.user {
    flex-direction: row-reverse;
}

.heytrisha-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.heytrisha-message.user .heytrisha-message-avatar {
    background: #19c37d;
    color: #fff;
}

.heytrisha-message.assistant .heytrisha-message-avatar {
    background: #ab68ff;
    color: #fff;
}

.heytrisha-message-content {
    flex: 1;
    color: #d1d5db;
    line-height: 1.75;
    font-size: 16px;
}

.heytrisha-message.user .heytrisha-message-content {
    color: #fff;
}

.heytrisha-chat-input-container {
    padding: 24px;
    background: #343541;
    border-top: 1px solid #4d4d4f;
}

.heytrisha-chat-input-wrapper {
    max-width: 768px;
    margin: 0 auto;
    position: relative;
}

.heytrisha-chat-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    resize: none;
    min-height: 52px;
    max-height: 200px;
    font-family: inherit;
    box-sizing: border-box;
    overflow-y: auto;
}

@media (max-width: 782px) {
    #heytrisha-chat-admin-root {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
        min-height: 380px;
        border-radius: 6px;
    }

    .heytrisha-chat-messages {
        padding: 16px;
        gap: 16px;
    }

    .heytrisha-chat-input-container {
        padding: 16px;
    }

    .heytrisha-message {
        gap: 16px;
    }
}

.heytrisha-chat-input:focus {
    outline: none;
    border-color: #10a37f;
}

.heytrisha-chat-send-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 36px;
    height: 36px;
    background: #19c37d;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.heytrisha-chat-send-btn:hover:not(:disabled) {
    background: #15a169;
}

.heytrisha-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.heytrisha-chat-send-btn .heytrisha-send-icon svg {
    display: block;
}

.heytrisha-empty-state {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: #8e8ea0;
    text-align: center;
    padding: 8px 24px 0;
    max-width: 420px;
    margin: 0 auto;
}

.heytrisha-empty-state h2 {
    color: #fff;
    font-size: 24px;
    margin: 0 0 6px 0;
}

.heytrisha-empty-state p {
    font-size: 16px;
    margin: 0;
}

/* Scrollbar styling */
.heytrisha-chat-messages::-webkit-scrollbar,
.heytrisha-chat-list::-webkit-scrollbar {
    width: 8px;
}

.heytrisha-chat-messages::-webkit-scrollbar-track,
.heytrisha-chat-list::-webkit-scrollbar-track {
    background: #202123;
}

.heytrisha-chat-messages::-webkit-scrollbar-thumb,
.heytrisha-chat-list::-webkit-scrollbar-thumb {
    background: #565869;
    border-radius: 4px;
}

.heytrisha-chat-messages::-webkit-scrollbar-thumb:hover,
.heytrisha-chat-list::-webkit-scrollbar-thumb:hover {
    background: #6e6e80;
}

/* Loading indicator */
.heytrisha-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

.heytrisha-typing-dot {
    width: 8px;
    height: 8px;
    background: #8e8ea0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Formatted Data Display Styles */
.heytrisha-formatted-data {
    margin-top: 12px;
}

.heytrisha-data-summary {
    margin-bottom: 12px;
    font-weight: 600;
    color: #10a37f;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.heytrisha-data-table {
    border: 1px solid #4d4d4f;
    border-radius: 8px;
    background-color: #40414f;
    overflow: hidden;
}

.heytrisha-data-table > div {
    padding: 14px 16px;
    border-bottom: 1px solid #4d4d4f;
}

.heytrisha-data-table > div:last-child {
    border-bottom: none;
}

.heytrisha-data-table > div:nth-child(even) {
    background-color: #343541;
}

.heytrisha-data-table > div > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    gap: 12px;
}

.heytrisha-data-table > div > div:last-child {
    margin-bottom: 0;
}

.heytrisha-data-table > div > div > span:first-child {
    font-weight: 600;
    color: #ececf1;
    min-width: 140px;
    flex-shrink: 0;
}

.heytrisha-data-table > div > div > span:last-child {
    color: #8e8ea0;
    text-align: right;
    word-break: break-word;
    flex: 1;
}

/* Footer Styles */
.heytrisha-chat-footer {
    padding: 12px 24px;
    background: #343541;
    border-top: 1px solid #4d4d4f;
    text-align: center;
}

.heytrisha-footer-link {
    color: #8e8ea0;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.heytrisha-footer-link:hover {
    color: #10a37f;
    text-decoration: underline;
}

.heytrisha-ui-icon svg {
    display: block;
}
