/* Gabriel - guia digital do site Afazeres Curiosos */
.filipa-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 82px;
    height: 102px;
    padding: 0;
    overflow: visible;
    background: transparent;
    color: inherit;
    z-index: 9998;
    touch-action: none;
    transition: width 0.2s ease, height 0.2s ease;
}
.filipa-chat-mascot-button {
    position: relative;
    display: grid;
    place-items: end center;
    width: 82px;
    height: 102px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: grab;
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1), filter 0.28s ease;
}
.filipa-chat-mascot-button:hover,
.filipa-chat-mascot-button:focus-visible {
    transform: translateY(-8px) scale(1.06);
    filter: brightness(1.06) saturate(1.06);
    outline: none;
}
.filipa-chat-mascot-button:focus-visible {
    filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 5px #d6a52c);
}
.filipa-chat-fab.is-dragging {
    transform: scale(0.98);
}
.filipa-chat-hint {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    width: max-content;
    max-width: min(260px, calc(100vw - 150px));
    padding: 10px 14px;
    border: 1px solid rgba(111, 32, 40, 0.2);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(34, 17, 19, 0.18);
    color: #32151a;
    font: 700 14px/1.35 'Inter', sans-serif;
    opacity: 0;
    pointer-events: none;
    transform: translate(8px, -50%);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.filipa-chat-mascot-button:focus-visible ~ .filipa-chat-hint,
.filipa-chat-fab.show-touch-controls .filipa-chat-hint {
    opacity: 1;
    transform: translate(0, -50%);
}
.filipa-chat-collapse {
    position: absolute;
    z-index: 3;
    top: -3px;
    right: -7px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(111, 32, 40, 0.22);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 18px rgba(34, 17, 19, 0.2);
    color: #32151a;
    font: 700 21px/1 'Inter', sans-serif;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.filipa-chat-mascot-button:focus-visible ~ .filipa-chat-collapse,
.filipa-chat-fab.show-touch-controls .filipa-chat-collapse {
    opacity: 1;
    transform: scale(1);
}

@media (hover: hover) {
    .filipa-chat-fab:hover .filipa-chat-hint {
        opacity: 1;
        transform: translate(0, -50%);
    }
    .filipa-chat-fab:hover .filipa-chat-collapse {
        opacity: 1;
        transform: scale(1);
    }
}
@media (hover: none), (pointer: coarse) {
    .filipa-chat-hint { display: none; }
    .filipa-chat-collapse { top: -10px; right: -12px; width: 44px; height: 44px; }
}
.filipa-chat-compact {
    position: relative;
    display: none;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(214, 165, 44, 0.65);
    border-radius: 50%;
    background: #32151a;
    box-shadow: 0 10px 26px rgba(34, 17, 19, 0.3);
    color: #fff;
    cursor: pointer;
}
.filipa-chat-compact svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.filipa-chat-compact-status {
    position: absolute;
    right: -1px;
    bottom: 0;
    width: 13px;
    height: 13px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #2ecf73;
}
.filipa-chat-fab.is-collapsed {
    position: fixed;
    width: 48px;
    height: 48px;
}
.filipa-chat-fab.is-collapsed .filipa-chat-mascot-button,
.filipa-chat-fab.is-collapsed .filipa-chat-collapse,
.filipa-chat-fab.is-collapsed .filipa-chat-hint {
    display: none;
}
.filipa-chat-fab.is-collapsed .filipa-chat-compact {
    display: grid;
}
.gabriel-three-stage,
.gabriel-three-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.gabriel-three-stage {
    position: relative;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 10px 10px rgba(34, 17, 19, 0.22));
}
.gabriel-three-canvas {
    background: transparent;
}

/* Painel chat */
.filipa-chat-panel {
    position: fixed;
    bottom: 156px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}
.filipa-chat-panel.open {
    display: flex;
}

.filipa-chat-header {
    position: relative;
    z-index: 2;
    background: #6f2028;
    box-shadow: 0 16px 0 #f7f9fc;
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.filipa-chat-header-text {
    display: flex;
    flex-direction: column;
}
.filipa-chat-header-name {
    font-weight: 800;
    font-size: 15px;
}
.filipa-chat-header-status {
    font-size: 12px;
    opacity: 0.85;
}
.filipa-chat-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    font-size: 20px;
    line-height: 1;
}

.filipa-chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: #f7f9fc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-anchor: none;
}
.filipa-chat-history-tail {
    flex: 0 0 0;
    min-height: 0;
    pointer-events: none;
}

.filipa-case-toggle {
    margin: 10px 12px 0;
    min-height: 40px;
    border: 1px solid #d8c58a;
    background: #fff8e6;
    color: #331014;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(26, 61, 92, 0.08);
}
.filipa-case-toggle:hover,
.filipa-case-toggle:focus {
    outline: none;
    border-color: #b78a24;
    background: #fff3d0;
}

.filipa-intake-form {
    display: none;
    padding: 10px 12px 12px;
    background: #fff;
    border-top: 1px solid #e3e8ef;
    gap: 8px;
}
.filipa-intake-form.open {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.filipa-case-form-title {
    margin-bottom: 2px;
    color: #1a3d5c;
    font-size: 13px;
    font-weight: 700;
}
.filipa-intake-form input,
.filipa-intake-form select,
.filipa-intake-form textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d3dae5;
    border-radius: 8px;
    padding: 8px 10px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
}
.filipa-intake-form textarea {
    min-height: 74px;
    resize: vertical;
}
.filipa-intake-form input:focus,
.filipa-intake-form select:focus,
.filipa-intake-form textarea:focus {
    outline: none;
    border-color: #1a3d5c;
    box-shadow: 0 0 0 2px rgba(26, 61, 92, 0.12);
}
.filipa-consent {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}
.filipa-consent input {
    width: auto;
    min-height: 0;
    margin-top: 2px;
}
.filipa-intake-form button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #8b2b31;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.filipa-intake-form button:hover,
.filipa-intake-form button:focus {
    outline: none;
    background: #74242a;
}
.filipa-intake-form button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.filipa-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.filipa-msg-bot {
    background: #fff;
    border: 1px solid #e3e8ef;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.filipa-msg-user {
    background: #1a3d5c;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.filipa-msg-typing {
    align-self: flex-start;
    color: #94a3b8;
    font-style: italic;
    font-size: 13px;
}

.filipa-chat-input {
    border-top: 1px solid #e3e8ef;
    padding: 12px;
    display: flex;
    gap: 8px;
    background: #fff;
}
.filipa-chat-input textarea {
    flex: 1;
    border: 1px solid #d3dae5;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 38px;
    max-height: 100px;
}
.filipa-chat-input textarea:focus {
    outline: none;
    border-color: #1a3d5c;
}
.filipa-chat-input button {
    background: #1a3d5c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}
.filipa-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.filipa-chat-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #64748b;
    padding: 6px 12px 10px;
    background: #fff;
}

@media (max-width: 480px) {
    .filipa-chat-fab {
        right: 14px;
        bottom: 18px;
        width: 62px;
        height: 78px;
    }
    .filipa-chat-mascot-button { width: 62px; height: 78px; }
    .filipa-chat-fab.is-collapsed { width: 48px; height: 48px; }
    .filipa-chat-hint { display: none; }
    .filipa-chat-collapse { top: -10px; right: -12px; width: 44px; height: 44px; }
    .filipa-chat-panel {
        right: 8px;
        bottom: 100px;
        height: calc(100vh - 120px);
    }
    .filipa-intake-form {
        max-height: 46vh;
        overflow-y: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .filipa-chat-fab,
    .filipa-chat-mascot-button,
    .gabriel-three-stage {
        transition: none;
    }
}
