/**
 * Cliverse AI Chat — "Get in Touch" page.
 *
 * Three stacked cards: the AI chat, the community forum hand-off (revealed once
 * the assistant has answered) and the Contact Us block that opens the modal form.
 */

.clv-git,
.clv-git-modal {
    --clv-navy: #2F375B;
    --clv-orange: var(--bb-primary-color, #EB673E);
    --clv-surface: #FFFFFF;
    --clv-border: #E2E5F1;
    --clv-field-border: #C9CEE9;
    --clv-soft-btn: #E6E8F5;
    --clv-soft-btn-hover: #D9DCEF;
    --clv-radio-ring: #B9BEE8;
    --clv-radio-on: #3F47A0;
    --clv-muted: #6B7280;
    --clv-text: var(--bb-body-text-color, #444444);
    --clv-radius: 20px;
    --clv-shadow: 0 9px 26px 0 rgba(198, 198, 198, 0.25);

    color: var(--clv-text);
}

.clv-git {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: 0 0 40px;
}

.clv-git *,
.clv-git *::before,
.clv-git *::after,
.clv-git-modal *,
.clv-git-modal *::before,
.clv-git-modal *::after {
    box-sizing: border-box;
}

.clv-git-card {
    background: var(--clv-surface);
    border: 1px solid var(--clv-border);
    border-radius: var(--clv-radius);
    box-shadow: var(--clv-shadow);
    padding: 32px;
}

/* ---------------------------------------------------------------- Chat card */

.clv-git-chat {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.clv-git-hero {
    text-align: center;
    padding: 24px 0 4px;
}

.clv-git-hero__title {
    margin: 0 0 14px;
    color: var(--clv-navy);
    font-size: clamp(24px, 3vw, 40px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.clv-git-hero__accent {
    color: var(--clv-orange);
}

.clv-git-hero__lead {
    margin: 0 auto;
    max-width: 780px;
    color: var(--clv-muted);
    font-size: 15px;
    line-height: 1.6;
}

.clv-git-hero[hidden] {
    display: none;
}

/* Messages */

/* The card grows with the conversation — no nested scroll area, per the design. */
.clv-git-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.clv-git-messages:empty {
    display: none;
}

.clv-git-msg {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.clv-git-msg--user {
    flex-direction: row-reverse;
}

.clv-git-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #F4F3EF;
    color: var(--clv-navy);
}

.clv-git-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.clv-git-avatar svg {
    width: 24px;
    height: 24px;
}

.clv-git-bubble {
    max-width: min(760px, calc(100% - 64px));
    padding: 14px 18px;
    border-radius: 16px;
    background: #F5F6FB;
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.clv-git-msg--user .clv-git-bubble {
    background: #EDEFF9;
    color: var(--clv-navy);
}

.clv-git-msg--assistant .clv-git-bubble {
    background: #FFFFFF;
    border: 1px solid var(--clv-border);
}

.clv-git-bubble > *:first-child {
    margin-top: 0;
}

.clv-git-bubble > *:last-child {
    margin-bottom: 0;
}

.clv-git-bubble a {
    color: var(--clv-orange);
    font-weight: 600;
    text-decoration: underline;
}

.clv-git-bubble ul,
.clv-git-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.clv-git-bubble li {
    margin: 0 0 4px;
}

.clv-git-bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* The n8n answer can carry a full-width call-to-action button. */
.clv-git-bubble a.button,
.clv-git-bubble .wp-block-button__link {
    display: block;
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--clv-navy);
    color: #FFFFFF;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.clv-git-attachment {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--clv-muted);
}

.clv-git-error {
    color: #B42318;
    font-weight: 600;
}

.clv-git-typing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--clv-muted);
}

.clv-git-typing::after {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: clv-git-spin 0.8s linear infinite;
}

@keyframes clv-git-spin {
    to { transform: rotate(360deg); }
}

/* Composer */

.clv-git-form {
    margin: 0;
}

.clv-git-composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 12px 10px 22px;
    border: 1px solid var(--clv-field-border);
    border-radius: 999px;
    background: #FFFFFF;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.clv-git-composer:focus-within {
    border-color: var(--clv-navy);
    box-shadow: 0 0 0 3px rgba(47, 55, 91, 0.08);
}

.clv-git-composer__input {
    flex: 1 1 auto;
    min-height: 28px;
    max-height: 180px;
    padding: 9px 0;
    border: 0;
    background: transparent;
    resize: none;
    overflow-y: auto;
    color: var(--clv-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
}

.clv-git-composer__input:focus {
    outline: none;
    box-shadow: none;
}

.clv-git-composer__input::placeholder {
    color: #9CA3AF;
}

.clv-git-attach {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--clv-navy);
    cursor: pointer;
    transition: background 0.2s ease;
}

.clv-git-attach:hover,
.clv-git-attach:focus-within {
    background: #F0F1F7;
}

.clv-git-attach svg {
    width: 22px;
    height: 22px;
}

.clv-git-attach input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.clv-git-send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--clv-navy);
    color: #FFFFFF;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.clv-git-send:hover:not(:disabled),
.clv-git-send:focus-visible:not(:disabled) {
    background: var(--clv-navy);
    transform: translateY(-1px);
}

.clv-git-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.clv-git-send svg {
    width: 18px;
    height: 18px;
}

.clv-git-filename {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    padding-left: 22px;
    color: var(--clv-muted);
    font-size: 13px;
}

.clv-git-filename.is-visible {
    display: flex;
}

.clv-git-filename button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--clv-orange);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.clv-git-note {
    margin: 14px 0 0;
    color: #9CA3AF;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

/* ------------------------------------------------------ Forum / contact CTA */

.clv-git-cta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.clv-git-cta__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #F4F3EF;
    color: var(--clv-navy);
}

.clv-git-cta__icon svg {
    width: 22px;
    height: 22px;
}

.clv-git-cta__body {
    flex: 1 1 auto;
    min-width: 0;
}

.clv-git-cta__title {
    margin: 0 0 4px;
    color: var(--clv-navy);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.clv-git-cta__text {
    margin: 0;
    color: var(--clv-muted);
    font-size: 14px;
    line-height: 1.5;
}

.clv-git-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 26px;
    border: 0;
    border-radius: 999px;
    background: var(--clv-orange);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.clv-git-btn:hover,
.clv-git-btn:focus-visible {
    color: #FFFFFF;
    filter: brightness(0.94);
    transform: translateY(-1px);
    text-decoration: none;
}

/* Secondary action — the two contact blocks, which must not compete with
   "Share your issue" for attention. */
.clv-git-btn--soft {
    min-height: 40px;
    padding: 0 20px;
    background: var(--clv-soft-btn);
    color: var(--clv-navy);
    font-size: 14px;
    font-weight: 700;
}

.clv-git-btn--soft:hover,
.clv-git-btn--soft:focus-visible {
    background: var(--clv-soft-btn-hover);
    color: var(--clv-navy);
    filter: none;
}

/* The two contact blocks sit side by side under the chat. */
.clv-git-contacts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.clv-git-contact {
    display: flex;
    align-items: center;
    padding: 20px 24px;
}

.clv-git-contact .clv-git-cta {
    width: 100%;
    gap: 14px;
}

.clv-git-contact .clv-git-cta__title {
    font-size: 16px;
}

.clv-git-contact .clv-git-cta__text {
    font-size: 13px;
}

/* Forum topic cards */

.clv-git-forum[hidden] {
    display: none;
}

.clv-git-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 24px 0 0;
}

.clv-git-topic {
    display: flex;
    flex-direction: column;
    flex: 0 1 240px;
    max-width: 240px;
    border: 1px solid var(--clv-border);
    border-radius: 14px;
    overflow: hidden;
    background: #FFFFFF;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.clv-git-topic:hover,
.clv-git-topic:focus-visible {
    color: inherit;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--clv-shadow);
}

.clv-git-topic__thumb {
    display: block;
    aspect-ratio: 16 / 10;
    background: #EDEFF9;
    overflow: hidden;
}

.clv-git-topic__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.clv-git-topic__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 16px;
}

.clv-git-topic__title {
    color: var(--clv-navy);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.clv-git-topic__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--clv-muted);
    font-size: 12px;
    line-height: 1.5;
}

.clv-git-topic__meta {
    margin-top: 2px;
    color: #9CA3AF;
    font-size: 11px;
}

/* ------------------------------------------------------------------- Modal */

.clv-git-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.clv-git-modal[hidden] {
    display: none;
}

.clv-git-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(28, 32, 54, 0.55);
}

.clv-git-modal__dialog {
    position: relative;
    width: 620px;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 34px;
    border-radius: 28px;
    background: #FFFFFF;
    box-shadow: 0 24px 60px rgba(15, 20, 45, 0.28);
}

.clv-git-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--clv-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.clv-git-modal__close:hover,
.clv-git-modal__close:focus-visible {
    background: #F0F1F7;
    color: var(--clv-navy);
}

.clv-git-modal__close svg {
    width: 16px;
    height: 16px;
}

.clv-git-modal__title {
    margin: 0 0 10px;
    padding-right: 40px;
    color: var(--clv-navy);
    font-size: 34px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.clv-git-modal__lead {
    margin: 0 0 24px;
    color: #4A5064;
    font-size: 14px;
    line-height: 1.6;
}

.clv-git-modal__unavailable {
    margin: 0;
    color: var(--clv-muted);
    font-size: 15px;
}

body.clv-git-modal-open {
    overflow: hidden;
}

/* WPForms inside the modal ------------------------------------------------ */

.clv-git-modal .wpforms-container {
    --wpforms-field-border-radius: 100px;
    --wpforms-field-border-color: var(--clv-field-border);
    --wpforms-field-size-input-height: 46px;
    --wpforms-field-size-font-size: 16px;
    --wpforms-field-size-padding-h: 24px;
    --wpforms-label-color: var(--clv-navy);
    --wpforms-label-size-font-size: 16px;
    --wpforms-button-border-radius: 100px;
    --wpforms-button-background-color: var(--clv-orange);
    --wpforms-button-text-color: #FFFFFF;
    --wpforms-button-size-height: 56px;
    --wpforms-button-size-font-size: 18px;

    margin: 0;
}

.clv-git-modal .wpforms-field-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
}

/* Visual order is fixed here so it does not depend on the stored field order. */
.clv-git-modal .wpforms-field {
    padding: 0 0 14px;
}

.clv-git-modal .wpforms-field-radio {
    grid-column: 1 / -1;
    order: 1;
}

.clv-git-modal .wpforms-field-name {
    grid-column: 1;
    order: 2;
}

.clv-git-modal .wpforms-field-email {
    grid-column: 2;
    order: 3;
}

.clv-git-modal .wpforms-field-textarea {
    grid-column: 1 / -1;
    order: 4;
}

.clv-git-modal .wpforms-field-hp,
.clv-git-modal .wpforms-field[class*='wpforms-field-captcha'] {
    grid-column: 1 / -1;
    order: 5;
}

/* The theme puts a bordered box around every fieldset; the radio group is flat. */
.clv-git-modal .wpforms-container fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.clv-git-modal .wpforms-field-label {
    display: block;
    float: none;
    width: auto;
    margin: 0 0 8px;
    padding: 0;
    color: var(--clv-navy);
    font-size: 16px;
    font-weight: 600;
}

/* "Message Type" is a plain heading in the design, not a bold field label. */
.clv-git-modal legend.wpforms-field-label {
    display: block;
    float: none;
    width: auto;
    margin: 0 0 12px;
    padding: 0;
    color: #3A4160;
    font-size: 18px;
    font-weight: 500;
}

/*
 * The design spells the requirement out instead of using a red asterisk.
 * The extra `.wpforms-container .wpforms-form` beats the theme's own
 * `div.wpforms-container-full .wpforms-form .wpforms-required-label` rule.
 */
.clv-git-modal .wpforms-container .wpforms-form .wpforms-required-label {
    font-size: 0;
    color: var(--clv-navy);
}

.clv-git-modal .wpforms-container .wpforms-form .wpforms-required-label::after {
    content: '(required)';
    font-size: 16px;
    font-weight: 600;
}

.clv-git-modal .wpforms-field input[type='text'],
.clv-git-modal .wpforms-field input[type='email'],
.clv-git-modal .wpforms-field input[type='tel'],
.clv-git-modal .wpforms-field input[type='url'],
.clv-git-modal .wpforms-field select,
.clv-git-modal .wpforms-field textarea {
    width: 100%;
    max-width: 100%;
}

.clv-git-modal .wpforms-field input[type='text'],
.clv-git-modal .wpforms-field input[type='email'] {
    height: 46px;
    padding: 0 22px;
    border-radius: 100px;
    font-size: 15px;
}

.clv-git-modal .wpforms-field textarea {
    min-height: 110px;
    padding: 14px 20px;
    border-radius: 18px;
    font-size: 15px;
    resize: vertical;
}

.clv-git-modal .wpforms-field ::placeholder {
    color: #9AA0AE;
}

.clv-git-modal .wpforms-field-radio ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.clv-git-modal .wpforms-field-radio li {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
}

/*
 * The design's radios are indigo rings, not the plugin's orange dots. WPForms
 * draws the ring with ::before and the dot with ::after, both absolutely
 * positioned; the extra `div.wpforms-container` is what outweighs its own
 * `div.wpforms-container-full:not(…) input[type="radio"]::after` rule.
 */
.clv-git-modal div.wpforms-container .wpforms-field-radio input[type='radio'] {
    position: relative;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin: 0;
    border: 2px solid var(--clv-radio-ring);
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: none;
}

.clv-git-modal div.wpforms-container .wpforms-field-radio input[type='radio']:checked {
    border-color: var(--clv-radio-on);
}

.clv-git-modal div.wpforms-container .wpforms-field-radio input[type='radio']::before {
    display: none;
}

.clv-git-modal div.wpforms-container .wpforms-field-radio input[type='radio']::after,
.clv-git-modal div.wpforms-container .wpforms-field-radio input[type='radio']:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 11px;
    height: 11px;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: var(--clv-radio-on);
    box-shadow: none;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.15s ease;
}

.clv-git-modal div.wpforms-container .wpforms-field-radio input[type='radio']:checked::after {
    transform: translate(-50%, -50%) scale(1);
}

.clv-git-modal .wpforms-field-label-inline {
    margin: 0;
    color: #33384A;
    font-size: 17px;
    font-weight: 400;
}

.clv-git-modal .wpforms-submit-container {
    grid-column: 1 / -1;
    order: 6;
    padding: 10px 0 0;
}

.clv-git-modal div.wpforms-container .wpforms-submit {
    width: 100%;
    min-height: 56px;
    border-radius: 100px;
    font-size: 18px;
    font-weight: 700;
}

.clv-git-modal .wpforms-confirmation-container-full {
    margin: 0;
}

/* ------------------------------------------------------------- Responsive */

/* The blocks need the full row before the button can sit beside the text. */
@media (max-width: 1100px) {
    .clv-git-contacts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 782px) {
    .clv-git-card {
        padding: 20px;
    }

    .clv-git-cta {
        flex-wrap: wrap;
    }

    .clv-git-cta__body {
        flex: 1 1 100%;
        order: 2;
    }

    .clv-git-cta__icon {
        order: 1;
    }

    .clv-git-btn {
        order: 3;
        width: 100%;
    }

    .clv-git-topic {
        flex: 1 1 100%;
        max-width: none;
    }

    .clv-git-bubble {
        max-width: calc(100% - 52px);
    }

    .clv-git-modal {
        padding: 0;
        align-items: flex-end;
    }

    .clv-git-modal__dialog {
        max-height: 94vh;
        padding: 24px 20px 28px;
        border-radius: 24px 24px 0 0;
    }

    .clv-git-modal__title {
        font-size: 24px;
    }

    .clv-git-modal .wpforms-field-container,
    .clv-git-modal .wpforms-field-radio ul {
        grid-template-columns: 1fr;
    }

    .clv-git-modal .wpforms-field-name,
    .clv-git-modal .wpforms-field-email {
        grid-column: 1 / -1;
    }
}
