/* AI consultant chat widget (views/layouts/_consultant.php, js/consultant.js).
   The site colours every div/span/p itself, so text colours are set on each element. */
.ai-chat {
    --ai-dark: #1e2124;
    --ai-accent: #d33f21;
    --ai-accent-dark: #b2341a;
    --ai-bg: #ffffff;
    --ai-muted: #6e747a;
    --ai-line: #e4e6e8;
    --ai-soft: #f3f3f3;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ai-dark);
}

.ai-chat *,
.ai-chat *::before,
.ai-chat *::after {
    box-sizing: border-box;
}

.ai-chat__toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    /* Same as the bxslider arrows: the widget comes later in the page, so it covers them;
       site popups and the mobile menu (10000+) stay above it. */
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 26px;
    background: var(--ai-accent);
    color: #fff;
    font: 600 15px/1 'Inter', Arial, sans-serif;
    box-shadow: 0 6px 20px rgba(30, 33, 36, .25);
    cursor: pointer;
    transition: background .2s, transform .2s;
}

.ai-chat__toggle:hover {
    background: var(--ai-accent-dark);
    transform: translateY(-2px);
}

.ai-chat__toggle-label {
    color: #fff;
}

.ai-chat__toggle-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.ai-chat--open .ai-chat__toggle {
    display: none;
}

.ai-chat__panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    width: 380px;
    height: min(600px, calc(100vh - 40px));
    background: var(--ai-bg);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(30, 33, 36, .3);
    overflow: hidden;
}

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

.ai-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--ai-dark);
    color: #fff;
}

.ai-chat__title {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
}

.ai-chat__subtitle {
    font-size: 12px;
    color: #c4c7ca;
}

.ai-chat__close {
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.ai-chat__close:hover {
    background: rgba(255, 255, 255, .12);
}

.ai-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--ai-soft);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.ai-chat__msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 12px;
}

.ai-chat__msg--user {
    align-items: flex-end;
}

.ai-chat__bubble {
    max-width: 88%;
    padding: 10px 13px;
    border-radius: 14px 14px 14px 4px;
    background: #fff;
    border: 1px solid var(--ai-line);
    color: var(--ai-dark);
    font-size: 14px;
    white-space: pre-line;
    word-wrap: break-word;
}

.ai-chat__msg--user .ai-chat__bubble {
    border-radius: 14px 14px 4px 14px;
    background: var(--ai-accent);
    border-color: var(--ai-accent);
    color: #fff;
}

.ai-chat__msg--error .ai-chat__bubble {
    background: #fdf0f0;
    border-color: #f2c4c4;
    color: #a12b2b;
}

.ai-chat__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ai-chat__suggestion {
    padding: 7px 11px;
    border: 1px solid var(--ai-accent);
    border-radius: 16px;
    background: #fff;
    color: var(--ai-accent);
    font: 500 13px/1.2 'Inter', Arial, sans-serif;
    text-align: left;
    cursor: pointer;
}

.ai-chat__suggestion:hover {
    background: var(--ai-accent);
    color: #fff;
}

.ai-chat__items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.ai-chat__item {
    display: flex;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--ai-line);
    border-radius: 10px;
    background: #fff;
    color: var(--ai-dark);
    text-decoration: none;
    transition: border-color .2s, box-shadow .2s;
}

.ai-chat__item:hover {
    border-color: var(--ai-accent);
    box-shadow: 0 2px 8px rgba(211, 63, 33, .15);
    text-decoration: none;
}

.ai-chat__item-pic {
    flex: none;
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: #fff;
}

.ai-chat__item-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ai-chat__item-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--ai-dark);
}

.ai-chat__item-price {
    font-weight: 700;
    color: var(--ai-dark);
}

.ai-chat__item-old {
    margin-left: 6px;
    font-weight: 400;
    color: var(--ai-muted);
    text-decoration: line-through;
}

.ai-chat__item-why {
    font-size: 12px;
    color: var(--ai-muted);
}

.ai-chat__item-sold {
    font-size: 12px;
    color: #a12b2b;
}

.ai-chat__phone {
    display: flex;
    gap: 6px;
    width: 88%;
    margin-top: 8px;
}

.ai-chat__phone input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--ai-line);
    border-radius: 8px;
    font: 16px 'Inter', Arial, sans-serif;
}

.ai-chat__phone button {
    flex: none;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: var(--ai-accent);
    color: #fff;
    font: 600 14px 'Inter', Arial, sans-serif;
    cursor: pointer;
}

.ai-chat__typing .ai-chat__bubble {
    color: var(--ai-muted);
}

.ai-chat__typing .ai-chat__bubble::after {
    content: '';
    display: inline-block;
    width: 1.2em;
    text-align: left;
    animation: ai-chat-dots 1.2s steps(4, end) infinite;
}

@keyframes ai-chat-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

.ai-chat__form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--ai-line);
    background: #fff;
}

.ai-chat__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.ai-chat__input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 9px 12px;
    border: 1px solid var(--ai-line);
    border-radius: 10px;
    font: 15px/1.4 'Inter', Arial, sans-serif;
    color: var(--ai-dark);
    resize: none;
    outline: none;
}

.ai-chat__input:focus {
    border-color: var(--ai-accent);
}

.ai-chat__send {
    flex: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--ai-accent);
    cursor: pointer;
}

.ai-chat__send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    vertical-align: middle;
}

.ai-chat__send:disabled {
    opacity: .5;
    cursor: default;
}

/* Phones: the button shrinks to an icon, the chat takes the whole screen. */
@media (max-width: 600px) {
    .ai-chat__toggle {
        right: 14px;
        bottom: 14px;
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .ai-chat__toggle-label {
        display: none;
    }

    .ai-chat__panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .ai-chat__input {
        font-size: 16px; /* no zoom on focus in iOS Safari */
    }

    html.ai-chat-locked,
    html.ai-chat-locked body {
        overflow: hidden;
    }
}
