/* TipCMS AI Website Assistant - prototype */

.tipcms-ai-agent {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 99999;
    font-family: Roboto, Arial, sans-serif;
    color: #222;
}

.tipcms-ai-toggle {
    border: 1px solid #9F7E41;
    border-radius: 8px;
    background: #fff;
    color: #333;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .18);
}

.tipcms-ai-toggle:hover,
.tipcms-ai-toggle:focus {
    background: #f7f3eb;
}

.tipcms-ai-panel {
    position: absolute;
    right: 0;
    bottom: 58px;
    width: min(380px, calc(100vw - 28px));
    height: min(520px, calc(100vh - 110px));
    background: #fff;
    border: 1px solid #9F7E41;
    border-radius: 10px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.tipcms-ai-panel[hidden] {
    display: none;
}

.tipcms-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 12px 0 16px;
    background: #fff;
    border-bottom: 1px solid #d8c8a6;
}

.tipcms-ai-title {
    font-size: 17px;
    font-weight: 700;
}

.tipcms-ai-close {
    border: 0;
    background: transparent;
    color: #555;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
}

.tipcms-ai-messages {
    height: calc(100% - 114px);
    overflow-y: auto;
    padding: 14px;
    background: #fafafa;
}

.tipcms-ai-message {
    max-width: 84%;
    margin: 0 0 12px;
    padding: 9px 11px;
    border-radius: 10px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tipcms-ai-assistant {
    margin-right: auto;
    background: #fff;
    border: 1px solid #ddd;
}

.tipcms-ai-user {
    margin-left: auto;
    background: #f2eadb;
    border: 1px solid #d8c8a6;
}

.tipcms-ai-thinking {
    font-style: italic;
    color: #666;
}

.tipcms-ai-form {
    display: flex;
    gap: 8px;
    height: 64px;
    box-sizing: border-box;
    padding: 10px;
    border-top: 1px solid #ddd;
    background: #fff;
}

.tipcms-ai-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #bbb;
    border-radius: 8px;
    padding: 9px 10px;
    font: inherit;
}

.tipcms-ai-input:focus {
    outline: 2px solid #d8c8a6;
    outline-offset: 1px;
}

.tipcms-ai-send {
    border: 1px solid #9F7E41;
    border-radius: 8px;
    background: #9F7E41;
    color: #fff;
    padding: 0 13px;
    font-weight: 600;
    cursor: pointer;
}

.tipcms-ai-send:disabled,
.tipcms-ai-input:disabled {
    opacity: .65;
}

@media (max-width: 600px) {
    .tipcms-ai-agent {
        right: 12px;
        bottom: 12px;
    }

    .tipcms-ai-panel {
        right: 0;
        bottom: 56px;
        width: calc(100vw - 24px);
        height: min(520px, calc(100vh - 90px));
    }
}
