/*
 * chatbot.css — Previtali Braga
 * Widget de atendimento digital (toggle + janela flutuante)
 * Vai em: /wp-content/themes/previtali-braga/assets/css/chatbot.css
 */

/* ═══════════════════════════════════════════════════════════════
   BOTÃO FLUTUANTE (canto inferior direito)
═══════════════════════════════════════════════════════════════ */
#chatbot-toggle {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9998;
    background: var(--accent);
    color: var(--navy);
    border: none;
    padding: 14px 28px;
    font-family: 'Josefin Sans', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
    transition: background .25s ease, transform .2s ease, box-shadow .25s ease;
    transform: translateZ(0);
}

#chatbot-toggle:hover {
    box-shadow: 0 12px 40px rgb(203 203 203 / 55% 55%);
    transform: translateZ(0) translateY(-2px);
    background: #ffffff00;
    color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════
   JANELA DO CHAT
═══════════════════════════════════════════════════════════════ */
#chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 32px;
    z-index: 9999;
    width: 360px;
    max-height: 580px;
    background: var(--navy-mid);
    border: 1px solid var(--accent-line);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
    opacity: 0;
    transform: translateY(16px) translateZ(0);
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
    overflow: hidden;
}

#chatbot-window.active {
    opacity: 1;
    transform: translateY(0) translateZ(0);
    pointer-events: all;
}

/* ─── Cabeçalho ────────────────────────────────────────────── */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--navy);
    border-bottom: 1px solid var(--accent-line);
    flex-shrink: 0;
}

.chat-header strong {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #d3d4d9;
}

#chatbot-close {
    background: none;
    border: none;
    color: #7d818c;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color .2s ease;
}

#chatbot-close:hover {
    color: #d3d4d9;
}

/* ─── Corpo ────────────────────────────────────────────────── */
#chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#chat-body::-webkit-scrollbar {
    width: 4px;
}

#chat-body::-webkit-scrollbar-track {
    background: transparent;
}

#chat-body::-webkit-scrollbar-thumb {
    background: rgba(196, 199, 208, .2);
    border-radius: 2px;
}

/* ─── Mensagens ────────────────────────────────────────────── */
.chat-message {
    max-width: 88%;
    padding: 12px 14px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 300;
    line-height: 1.7;
    border-radius: 2px;
}

.chat-message.bot {
    background: var(--navy-card);
    color: rgba(232, 233, 237, .85);
    border: 1px solid rgba(203, 181, 138, .16);
    align-self: flex-start;
}

.chat-message.user {
    background: rgba(196, 199, 208, .12);
    color: #d3d4d9;
    border: 1px solid var(--accent-line);
    align-self: flex-end;
}

/* ─── Digitando ────────────────────────────────────────────── */
.chat-typing {
    display: flex;
    gap: 5px;
    padding: 14px;
    background: var(--navy-card);
    border: 1px solid rgba(203, 181, 138, .16);
    align-self: flex-start;
    border-radius: 2px;
    width: 56px;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(196, 199, 208, .4);
    animation: pb-pulse 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) {
    animation-delay: .2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes pb-pulse {

    0%,
    80%,
    100% {
        transform: scale(.8);
        opacity: .5;
    }

    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* ─── Botões de opção ──────────────────────────────────────── */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}

.chat-options button,
button[data-op],
button[data-quick] {
    background: var(--navy-card);
    border: 1px solid var(--accent-line);
    color: #a9acb6;
    padding: 10px 14px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    border-radius: 2px;
    transition: background .2s, border-color .2s, color .2s;
    line-height: 1.5;
}

.chat-options button:hover,
button[data-op]:hover,
button[data-quick]:hover {
    background: #1a2235;
    border-color: rgba(196, 199, 208, .45);
    color: #d3d4d9;
}

/* ─── Áreas de ação ────────────────────────────────────────── */
.chat-action-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid rgba(203, 181, 138, .18);
    background: var(--navy-light);
    flex-shrink: 0;
}

.pb-date-input {
    background: var(--navy-card);
    border: 1px solid var(--accent-line);
    color: #d3d4d9;
    padding: 10px 12px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 12px;
    border-radius: 2px;
    width: 100%;
    outline: none;
    color-scheme: dark;
}

.pb-date-input:focus {
    border-color: rgba(196, 199, 208, .5);
}

.pb-action-btn {
    background: var(--accent);
    border: none;
    color: var(--navy);
    padding: 11px 16px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: background .2s;
}

.pb-action-btn:hover {
    background: var(--accent-strong);
}

.pb-file-real {
    display: none;
}

.pb-file-label {
    display: block;
    background: var(--navy-card);
    border: 1px dashed rgba(203, 181, 138, .32);
    color: #a9acb6;
    padding: 12px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 11.5px;
    text-align: center;
    cursor: pointer;
    border-radius: 2px;
    transition: border-color .2s, color .2s;
}

.pb-file-label:hover {
    border-color: rgba(196, 199, 208, .6);
    color: #d3d4d9;
}

/* ─── Rodapé ───────────────────────────────────────────────── */
.chat-footer {
    padding: 10px 16px;
    background: var(--navy);
    border-top: 1px solid rgba(196, 199, 208, .1);
    font-family: 'Josefin Sans', sans-serif;
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(196, 199, 208, .35);
    text-align: center;
    flex-shrink: 0;
}

/* ─── Campo de input livre ─────────────────────────────────── */
#chat-body .chat-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
    align-self: stretch;
    border: 1px solid rgba(196, 199, 208, .3);
    border-radius: 2px;
    background: var(--navy-card);
    transition: border-color .2s ease;
    margin-top: 4px;
}

#chat-body .chat-input-wrap:focus-within {
    border-color: rgba(196, 199, 208, .6);
    box-shadow: 0 0 0 2px rgba(196, 199, 208, .06);
}

#chat-body .pb-inp,
#chat-body .chat-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 300;
    color: #e8e9ed;
    line-height: 1.5;
    min-width: 0;
}

#chat-body .pb-inp::placeholder,
#chat-body .chat-input-field::placeholder {
    color: rgba(196, 199, 208, .35);
    font-style: italic;
    font-weight: 300;
}

#chat-body .pb-send,
#chat-body .chat-send-btn {
    flex-shrink: 0;
    background: rgba(211, 212, 217, .12);
    border: none;
    border-left: 1px solid rgba(203, 181, 138, .22);
    color: #a9acb6;
    width: 46px;
    padding: 0;
    font-size: 18px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-body .pb-send:hover,
#chat-body .chat-send-btn:hover {
    background: rgba(211, 212, 217, .22);
    color: #e8e9ed;
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOM DATE PICKER CALENDAR
═══════════════════════════════════════════════════════════════ */
#pb-agendar-area {
    flex-direction: column;
    gap: 0;
    padding: 0 !important;
    background: var(--navy-mid);
    border-top: 1px solid rgba(196, 199, 208, .15);
}

/* Cabeçalho: mês + navegação */
.pb-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    border-bottom: 1px solid rgba(196, 199, 208, .1);
}

.pb-cal-title {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #d3d4d9;
}

.pb-cal-nav {
    background: none;
    border: 1px solid rgba(196, 199, 208, .18);
    color: #a9acb6;
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, color .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    padding: 0;
}

.pb-cal-nav:hover {
    background: rgba(196, 199, 208, .12);
    color: #e8e9ed;
}

/* Linha dos dias da semana */
.pb-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px 12px 4px;
    gap: 2px;
}

.pb-cal-weekdays span {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(196, 199, 208, .35);
    text-align: center;
    padding: 4px 0;
}

/* Grade de dias */
.pb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    padding: 4px 12px 12px;
}

.pb-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 300;
    border-radius: 2px;
    transition: background .15s, color .15s;
    cursor: default;
}

.pb-cal-empty {
    background: transparent;
}

.pb-cal-disabled {
    color: rgba(196, 199, 208, .2);
}

.pb-cal-available {
    color: #a9acb6;
    cursor: pointer;
    border: 1px solid transparent;
}

.pb-cal-available:hover {
    background: rgba(196, 199, 208, .1);
    color: #e8e9ed;
    border-color: rgba(196, 199, 208, .2);
}

.pb-cal-selected {
    background: #d3d4d9 !important;
    color: #040925 !important;
    font-weight: 600;
    border-color: #d3d4d9 !important;
}

/* Seletor de horário */
.pb-cal-time-label {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(196, 199, 208, .4);
    padding: 8px 16px 6px;
    border-top: 1px solid rgba(196, 199, 208, .1);
    margin: 0;
}

.pb-cal-time-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 0 12px 10px;
}

.pb-cal-time-slot {
    background: var(--navy-card);
    border: 1px solid rgba(196, 199, 208, .15);
    color: #a9acb6;
    padding: 8px 4px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 11px;
    font-weight: 400;
    text-align: center;
    cursor: pointer;
    border-radius: 2px;
    transition: background .15s, color .15s, border-color .15s;
}

.pb-cal-time-slot:hover {
    background: rgba(196, 199, 208, .1);
    color: #e8e9ed;
    border-color: rgba(196, 199, 208, .35);
}

.pb-cal-time-slot.pb-cal-selected {
    background: #d3d4d9 !important;
    color: #040925 !important;
    border-color: #d3d4d9 !important;
    font-weight: 700;
}

/* Botão confirmar */
.pb-cal-confirm {
    margin: 0 12px 14px;
    width: calc(100% - 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   WRAPPER — nunca cria stacking context
═══════════════════════════════════════════════════════════════ */
#chatbot-wrapper {
    position: static;
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE ≤ 480px
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    #chatbot-toggle {
        bottom: 20px;
        right: 16px;
        padding: 12px 22px;
        font-size: 10px;
    }

    #chatbot-window {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: 75svh;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }
}