/* Optoguide chatbot — styles for the [optoguide] widget on the chatbot page template.
   Selectors match the markup generated by plugins/optoguide/dist/optoguide.js. */

.content.chatbot {
    --og-primary: #18d8c7;
    --og-primary-dark: #365463;
    --og-text-dark: #1b2429;
    --og-agent-bg: #f2f5f6;
    --og-border: #e2e8ea;
    --og-muted: #4a5a63;

    padding: 160px 0 120px;
}

/* Intro: heading + description */
.chatbot__intro {
    max-width: 760px;
    margin: 0 0 28px;
}

.chatbot__title {
    margin: 0 0 12px;
}

.chatbot__description {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: var(--og-muted);
}

/* Two-column layout: chatbot (left) + form (right) */
.chatbot__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.chatbot__col {
    min-width: 0;
}

/* Right column: request form on the site's dark section styling (#365463, white text).
   The theme's .input__wrapper fields are built for a dark background, so they now
   render exactly like the site's request form. */
.chatbot__col--form {
    background: var(--og-primary-dark);
    color: #fff;
    border-radius: 16px;
    padding: 40px;
}

/* Heading above the manual form — signals it as an alternative to the chat */
.chatbot__form-intro {
    margin-bottom: 24px;
}

.chatbot__form-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.chatbot__form-note {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
}

/* Single clean padded card — drop the nested translucent panel/padding */
.chatbot__col--form .form-wrapper {
    height: 100%;
    padding: 0;
    background: transparent;
}

/* Remove the default fieldset border CF7 draws around its hidden fields (the line on top) */
.chatbot__col--form fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

/* Desktop: cap the form column to the chatbot window height and scroll the form
   internally with a thin branded scrollbar (the CF7 form is longer than the chat). */
@media (min-width: 901px) {
    .chatbot__col--form {
        display: flex;
        flex-direction: column;
        height: 640px;                     /* = .optoguide__window height */
        max-height: calc(100dvh - 8rem);   /* = .optoguide__window max-height */
    }

    .chatbot__form-intro {
        flex: none;
    }

    .chatbot__col--form .form-wrapper {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-right: 10px;               /* room for the scrollbar */
        scrollbar-width: thin;             /* Firefox */
        scrollbar-color: var(--og-primary) transparent;
    }

    .chatbot__col--form .form-wrapper::-webkit-scrollbar {
        width: 6px;                        /* thinner than the chat's 8px */
    }

    .chatbot__col--form .form-wrapper::-webkit-scrollbar-track {
        background: transparent;
    }

    .chatbot__col--form .form-wrapper::-webkit-scrollbar-thumb {
        background: var(--og-primary);
        border-radius: 6px;
    }
}

/* Widget mount inside its column */
.optoguide {
    display: block;
    width: 100%;
}

.optoguide__window {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 640px;
    max-height: calc(100dvh - 8rem);
    background: #fff;
    border: 1px solid var(--og-border);
    border-radius: 16px;
    box-shadow: 0 20px 40px -12px rgba(27, 36, 41, 0.18);
    overflow: hidden;
    font-family: inherit;
}

/* Header */
.optoguide__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 18px;
    background: var(--og-primary-dark);
    color: #fff;
}

.optoguide__title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.optoguide__reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 5px;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.optoguide__reset-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
}

.optoguide__reset-btn svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Messages area */
.optoguide__messages {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
}

.optoguide__messages::-webkit-scrollbar {
    width: 8px;
}

.optoguide__messages::-webkit-scrollbar-thumb {
    background: var(--og-border);
    border-radius: 8px;
}

/* Message bubbles */
.optoguide__message {
    position: relative;
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.optoguide__message--agent {
    align-self: flex-start;
    background: var(--og-agent-bg);
    color: var(--og-text-dark);
    border-bottom-left-radius: 4px;
}

.optoguide__message--user {
    align-self: flex-end;
    background: var(--og-primary);
    color: var(--og-text-dark);
    border-bottom-right-radius: 4px;
}

/* Markdown content inside bubbles */
.optoguide__message p {
    margin: 0 0 8px;
}

.optoguide__message p:last-child {
    margin-bottom: 0;
}

.optoguide__message a {
    color: var(--og-primary-dark);
    text-decoration: underline;
}

.optoguide__message--user a {
    color: var(--og-text-dark);
}

.optoguide__message ul,
.optoguide__message ol {
    margin: 4px 0;
    padding-left: 20px;
    list-style: revert;
}

.optoguide__message li {
    margin: 2px 0;
}

.optoguide__message strong {
    font-weight: 700;
}

.optoguide__message code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
    padding: 1px 5px;
    background: rgba(27, 36, 41, 0.08);
    border-radius: 4px;
}

.optoguide__message table {
    border-collapse: collapse;
    width: 100%;
    margin: 6px 0;
    font-size: 13px;
}

.optoguide__message th,
.optoguide__message td {
    border: 1px solid var(--og-border);
    padding: 4px 8px;
    text-align: left;
}

/* Retry button */
.optoguide__retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--og-text-dark);
    background: var(--og-primary);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.optoguide__retry-btn:hover {
    opacity: 1;
}

.optoguide__retry-btn svg {
    width: 14px;
    height: 14px;
}

/* Typing indicator */
.optoguide__message--typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    max-width: none;
    align-self: flex-start;
    background: var(--og-agent-bg);
    padding: 12px 14px;
}

.optoguide__typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--og-primary-dark);
    opacity: 0.4;
    animation: optoguide-typing 1.4s infinite ease-in-out;
}

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

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

@keyframes optoguide-typing {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: scale(0.7);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Composer */
.optoguide__composer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--og-border);
    background: #fff;
}

.optoguide__composer-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--og-text-dark);
    background: var(--og-agent-bg);
    border: 1px solid var(--og-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease;
}

.optoguide__composer-input:focus {
    border-color: var(--og-primary);
}

.optoguide__composer-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.optoguide__composer-submit {
    flex: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--og-text-dark);
    background: var(--og-primary);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.optoguide__composer-submit:hover {
    filter: brightness(1.05);
}

.optoguide__composer-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Hide the reCAPTCHA v3 badge injected by the widget */
.grecaptcha-badge {
    visibility: hidden;
}

/* Stack columns on tablets and below */
@media (max-width: 900px) {
    .chatbot__layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .chatbot__col--form {
        padding: 20px;
    }

    .optoguide__window {
        height: 520px;
        border-radius: 12px;
    }
}
