/* ==========================================================================
   Modal "Falar com especialista" (2026-10-22) — tenant Meet Digital.
   widgets/especialista-modal.inc.php + md-especialista.js. Todo CTA do site e o
   balão da Maria abrem este formulário. Usa os tokens de :root do meetdigital.css.
   ========================================================================== */

.md-esp[hidden], .md-esp__step[hidden], .md-esp__feedback[hidden],
.md-esp__typing[hidden], .md-esp__alt[hidden], .md-esp__wa[hidden] { display: none !important; }

.md-esp {
    position: fixed; inset: 0; z-index: 10050;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    font-family: var(--md-font-body, 'Inter', sans-serif);
}
.md-esp__overlay {
    position: absolute; inset: 0;
    background: rgba(8, 10, 14, .74);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    animation: md-esp-fade .2s ease;
}

.md-esp__box {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    width: 100%; max-width: 600px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
    background: #fff; color: #2b3242;
    border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .5);
    animation: md-esp-up .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes md-esp-up { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes md-esp-fade { from { opacity: 0; } to { opacity: 1; } }

.md-esp__close {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .1); border: 0; color: #fff;
    font-size: 1.05rem; cursor: pointer; transition: background var(--md-transition, .25s);
}
.md-esp__close:hover { background: rgba(255, 255, 255, .2); }
.md-esp__close:focus-visible { outline: 2px solid var(--md-orange, #f5a623); outline-offset: 2px; }

/* ---------- Cabeçalho: foto + mensagem digitada ---------- */
.md-esp__head {
    flex: none;
    position: relative;
    padding: 22px 24px 20px;
    background:
        radial-gradient(120% 140% at 100% 0, rgba(245, 166, 35, .22), transparent 55%),
        linear-gradient(160deg, var(--md-dark-2, #1c1f26), var(--md-darker, #0d0e11));
    color: var(--md-text, #e9ebef);
    border-top: 4px solid var(--md-orange, #f5a623);
}

.md-esp__person { display: flex; align-items: center; gap: 14px; padding-right: 40px; }
.md-esp__avatar {
    position: relative; flex: none;
    width: 60px; height: 60px; border-radius: 50%;
    padding: 3px; background: linear-gradient(135deg, var(--md-orange-light, #ffbe3d), var(--md-orange-dark, #e0951a));
}
.md-esp__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--md-dark, #15171c); }
.md-esp__online {
    position: absolute; right: 1px; bottom: 3px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--md-green, #3fbf5f); border: 2px solid var(--md-dark, #15171c);
}
.md-esp__who { display: flex; flex-direction: column; line-height: 1.25; }
.md-esp__who strong { font-family: var(--md-font-head, 'Montserrat', sans-serif); font-size: 1.12rem; color: #fff; }
.md-esp__who span { font-size: .82rem; color: var(--md-muted, #a7adb8); }

.md-esp__bubble {
    position: relative;
    display: grid;
    margin: 16px 0 0 74px;
    padding: 13px 16px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 4px 16px 16px 16px;
    font-size: .95rem; line-height: 1.55; color: #f1f3f6;
}
.md-esp__bubble > * { grid-area: 1 / 1; margin: 0; }
.md-esp__msg--ghost { visibility: hidden; }
.md-esp__msg.is-typing::after {
    content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 2px;
    vertical-align: -2px; background: var(--md-orange, #f5a623);
    animation: md-esp-caret .8s steps(1) infinite;
}
@keyframes md-esp-caret { 50% { opacity: 0; } }

.md-esp__typing { display: inline-flex; align-items: center; gap: 5px; height: 1.5em; }
.md-esp__typing i {
    width: 7px; height: 7px; border-radius: 50%; background: var(--md-muted, #a7adb8);
    animation: md-esp-dot 1.1s infinite ease-in-out;
}
.md-esp__typing i:nth-child(2) { animation-delay: .15s; }
.md-esp__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes md-esp-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.md-esp__sr {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Corpo ---------- */
.md-esp__step { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 22px 24px 22px; }
.md-esp__form { display: flex; flex-direction: column; gap: 16px; margin: 0; }

.md-esp__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.md-esp__row--city { grid-template-columns: 1fr 1.35fr; }
.md-esp__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.md-esp__group { border: 0; margin: 0; padding: 0; min-width: 0; }
.md-esp__group > .md-esp__label { padding: 0; margin-bottom: 6px; }

.md-esp__label {
    display: block;
    font-family: var(--md-font-head, 'Montserrat', sans-serif);
    font-weight: 700; font-size: .8rem; letter-spacing: .01em; color: #2b3242;
}

.md-esp__input {
    width: 100%; font: inherit; font-size: .95rem; color: #1d2330;
    padding: 12px 14px;
    background: #f7f8fa; border: 1.5px solid #e1e5ec; border-radius: 10px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.md-esp__input::placeholder { color: #9aa3b2; }
.md-esp__input:hover { border-color: #cdd3dd; }
.md-esp__input:focus { outline: none; background: #fff; border-color: var(--md-orange, #f5a623); box-shadow: 0 0 0 4px rgba(245, 166, 35, .18); }
.md-esp__input[aria-invalid="true"] { border-color: #e5484d; background: #fff7f7; }
.md-esp__textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

/* Chips (radio estilizado — o input segue focável para teclado e leitor de tela) */
.md-esp__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.md-esp__chip { position: relative; cursor: pointer; }
.md-esp__chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.md-esp__chip span {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 999px;
    font-size: .86rem; font-weight: 600; color: #3a4252;
    background: #fff; border: 1.5px solid #e1e5ec;
    transition: border-color .2s, background .2s, color .2s, transform .15s;
}
.md-esp__chips--sm .md-esp__chip span { padding: 7px 12px; font-size: .82rem; }
.md-esp__chip:hover span { border-color: #cdd3dd; transform: translateY(-1px); }
.md-esp__chip input:checked + span {
    background: #fff6e5; border-color: var(--md-orange, #f5a623); color: #7a4d00;
    box-shadow: 0 4px 14px rgba(245, 166, 35, .2);
}
.md-esp__chip input:checked + span::before { content: '\2713'; font-weight: 800; }
.md-esp__chip input:focus-visible + span { outline: 2px solid var(--md-orange, #f5a623); outline-offset: 2px; }
.md-esp__group[aria-invalid="true"] .md-esp__chip span { border-color: #f1b0b2; }

.md-esp__shortcuts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.md-esp__shortcut {
    font: inherit; font-size: .76rem; font-weight: 500; color: #5b6475; cursor: pointer;
    padding: 5px 10px; border-radius: 999px;
    background: #f2f4f7; border: 1px dashed #cfd5df;
    transition: background .2s, color .2s, border-color .2s;
}
.md-esp__shortcut:hover { background: #fff6e5; color: #7a4d00; border-color: var(--md-orange, #f5a623); }
.md-esp__shortcut:focus-visible { outline: 2px solid var(--md-orange, #f5a623); outline-offset: 2px; }

.md-esp__feedback {
    margin: 0; padding: 10px 14px; border-radius: 10px;
    font-size: .86rem; line-height: 1.45;
    background: #fff1f1; color: #b4232a; border: 1px solid #f6c9cb;
}

.md-esp__submit { width: 100%; justify-content: center; gap: 10px; margin-top: 2px; }
.md-esp__submit[disabled] { opacity: .7; cursor: wait; transform: none; }

.md-esp__lgpd { margin: -4px 0 0; font-size: .74rem; line-height: 1.5; color: #7a8394; text-align: center; }
.md-esp__lgpd i { margin-right: 4px; color: #a7adb8; }
.md-esp__lgpd a { color: inherit; text-decoration: underline; }

.md-esp__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Confirmação (veio de um CTA) ---------- */
.md-esp__done { text-align: center; padding: 30px 28px 30px; }
.md-esp__done-icon { display: inline-block; font-size: 2.6rem; color: var(--md-green, #3fbf5f); margin-bottom: 8px; }
.md-esp__title { font-family: var(--md-font-head, 'Montserrat', sans-serif); font-size: 1.4rem; color: #1d2330; margin: 0 0 8px; }
.md-esp__title:focus { outline: none; }
.md-esp__intro { margin: 0 auto 20px; max-width: 420px; font-size: .95rem; line-height: 1.55; color: #4a5263; }
.md-esp__wa { width: 100%; max-width: 360px; justify-content: center; }
.md-esp__alt {
    display: block; margin: 14px auto 0; padding: 6px 10px;
    font: inherit; font-size: .88rem; font-weight: 600; color: #5b6475;
    background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.md-esp__alt:hover { color: #1d2330; }
.md-esp__alt:focus-visible { outline: 2px solid var(--md-orange, #f5a623); outline-offset: 2px; border-radius: 6px; }

/* ---------- Celular: vira "folha" que sobe do rodapé ---------- */
@media (max-width: 600px) {
    .md-esp { padding: 0; align-items: flex-end; }
    .md-esp__box { max-width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 20px 20px 0 0; }
    .md-esp__head { padding: 18px 18px 16px; }
    .md-esp__avatar { width: 52px; height: 52px; }
    .md-esp__bubble { margin: 12px 0 0; font-size: .9rem; }
    .md-esp__step { padding: 18px 18px 22px; }
    .md-esp__row, .md-esp__row--city { grid-template-columns: 1fr; gap: 16px; }
    .md-esp__input { font-size: 16px; } /* evita o zoom automático do iOS */
}

@media (prefers-reduced-motion: reduce) {
    .md-esp__box, .md-esp__overlay { animation: none; }
    .md-esp__typing i, .md-esp__msg.is-typing::after { animation: none; }
    .md-esp__chip span, .md-esp__chip:hover span { transition: none; transform: none; }
}
