/* support-widget.css - Estilo Premium para o Widget de Suporte */

/* Reset interno para o widget e evitar interferência externa */
.nct-support-widget, 
.nct-support-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.nct-support-widget,
.nct-support-widget button,
.nct-support-widget input,
.nct-support-widget span,
.nct-support-widget p,
.nct-support-widget strong {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Roboto, sans-serif;
}

:root {
    --nct-bg-dark: #09090b;
    --nct-bg-card: #121214;
    --nct-bg-input: #18181b;
    --nct-bg-glass: rgba(18, 18, 20, 0.82);
    --nct-primary: #e11d48;
    --nct-primary-hover: #f43f5e;
    --nct-primary-glow: rgba(225, 29, 72, 0.4);
    --nct-text-main: #f4f4f5;
    --nct-text-muted: #a1a1aa;
    --nct-border: rgba(255, 255, 255, 0.08);
    --nct-shadow: 0 15px 40px -10px rgba(0, 0, 0, 0.8);
    --nct-radius-sm: 8px;
    --nct-radius-md: 12px;
    --nct-radius-lg: 20px;
}

/* Container principal fixado */
.nct-support-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 20000;
}

/* Botão Flutuante de Suporte */
.nct-chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nct-primary) 0%, #b91c1c 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--nct-primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.nct-chat-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.6);
}

.nct-chat-btn:active {
    transform: scale(0.95);
}

/* Animação de Pulsar ao redor do botão */
.nct-chat-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--nct-primary);
    opacity: 0;
    animation: nctPulse 2s infinite;
    pointer-events: none;
}

@keyframes nctPulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { opacity: 0.4; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Distintivo de notificação */
.nct-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background-color: #22c55e;
    border: 2.5px solid var(--nct-bg-dark);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    display: none;
}

.nct-chat-badge.active {
    display: block;
    animation: nctBadgePop 0.3s ease-out;
}

@keyframes nctBadgePop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Janela de Conversa */
.nct-chat-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 370px;
    height: 520px;
    max-height: 80vh;
    border-radius: var(--nct-radius-lg);
    background-color: var(--nct-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--nct-border);
    box-shadow: var(--nct-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.nct-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Cabeçalho do Chat */
.nct-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(225, 29, 72, 0.15) 0%, rgba(9, 9, 11, 0) 100%);
    border-bottom: 1px solid var(--nct-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nct-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nct-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nct-bg-input) 0%, #1e1b4b 100%);
    border: 1px solid var(--nct-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nct-primary);
    font-size: 18px;
    position: relative;
}

/* Ponto verde de status */
.nct-chat-avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #22c55e;
    border: 2px solid var(--nct-bg-card);
    box-shadow: 0 0 6px #22c55e;
}

.nct-chat-title-container {
    display: flex;
    flex-direction: column;
}

.nct-chat-title {
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
}

.nct-chat-status {
    color: var(--nct-text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nct-chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #22c55e;
    display: inline-block;
    animation: nctStatusPulse 1.5s infinite alternate;
}

@keyframes nctStatusPulse {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.nct-chat-close-btn {
    color: var(--nct-text-muted);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nct-chat-close-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

/* Corpo do Chat (Onde tudo rola) */
.nct-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background-color: rgba(9, 9, 11, 0.4);
}

/* Custom Scrollbar no widget */
.nct-chat-body::-webkit-scrollbar {
    width: 4px;
}
.nct-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.nct-chat-body::-webkit-scrollbar-thumb {
    background: var(--nct-border);
    border-radius: 2px;
}

/* Tela do Formulário de Lead */
.nct-chat-lead-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: auto 0;
    animation: nctFadeIn 0.3s ease-out;
}

@keyframes nctFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.nct-chat-lead-intro {
    text-align: center;
    margin-bottom: 8px;
}

.nct-chat-lead-intro p {
    color: var(--nct-text-muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.nct-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nct-form-group label {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

.nct-form-group input {
    background-color: var(--nct-bg-input);
    border: 1px solid var(--nct-border);
    border-radius: var(--nct-radius-sm);
    color: #ffffff;
    padding: 10px 12px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
}

.nct-form-group input:focus {
    border-color: var(--nct-primary);
    box-shadow: 0 0 0 2px var(--nct-primary-glow);
}

.nct-lead-submit-btn {
    background: linear-gradient(135deg, var(--nct-primary) 0%, #b91c1c 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--nct-radius-sm);
    padding: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--nct-primary-glow);
    transition: all 0.2s ease;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nct-lead-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(225, 29, 72, 0.5);
}

/* Lista de Mensagens */
.nct-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Balão de Mensagem */
.nct-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
    animation: nctMsgPop 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes nctMsgPop {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mensagem do usuário */
.nct-msg-user {
    background: linear-gradient(135deg, var(--nct-primary) 0%, #be123c 100%);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.15);
}

/* Mensagem da IA/Admin */
.nct-msg-bot {
    background-color: var(--nct-bg-input);
    color: #f4f4f5;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--nct-border);
}

/* Balão especial informando takeover humano */
.nct-msg-info {
    background-color: rgba(225, 29, 72, 0.08);
    color: var(--nct-primary);
    border: 1px solid rgba(225, 29, 72, 0.2);
    align-self: center;
    max-width: 90%;
    font-size: 11.5px;
    text-align: center;
    border-radius: 30px;
    padding: 6px 14px;
    font-weight: 500;
}

/* Indicador de Digitação (Typing Indicator) */
.nct-typing-indicator {
    align-self: flex-start;
    background-color: var(--nct-bg-input);
    border: 1px solid var(--nct-border);
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: none;
    align-items: center;
    gap: 4px;
}

.nct-typing-indicator.active {
    display: flex;
    animation: nctMsgPop 0.2s ease-out;
}

.nct-typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--nct-text-muted);
    border-radius: 50%;
    animation: nctTyping 1.4s infinite ease-in-out both;
}

.nct-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.nct-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes nctTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Rodapé do Chat (Input de Mensagem) */
.nct-chat-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--nct-border);
    display: flex;
    gap: 8px;
    background-color: var(--nct-bg-card);
    align-items: center;
}

.nct-chat-footer.hidden {
    display: none;
}

.nct-chat-input {
    flex: 1;
    background-color: var(--nct-bg-input);
    border: 1px solid var(--nct-border);
    border-radius: var(--nct-radius-sm);
    color: #ffffff;
    padding: 10px 14px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
}

.nct-chat-input:focus {
    border-color: var(--nct-primary);
    box-shadow: 0 0 0 2px var(--nct-primary-glow);
}

.nct-chat-input::placeholder {
    color: var(--nct-text-muted);
}

.nct-chat-send-btn {
    background-color: var(--nct-primary);
    color: #ffffff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: var(--nct-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 2px 8px var(--nct-primary-glow);
    transition: all 0.2s ease;
}

.nct-chat-send-btn:hover {
    background-color: var(--nct-primary-hover);
    transform: scale(1.05);
}

.nct-chat-send-btn:active {
    transform: scale(0.95);
}

/* Responsividade para celulares */
@media (max-width: 480px) {
    .nct-support-widget {
        bottom: 16px;
        right: 16px;
    }
    .nct-chat-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    .nct-chat-window {
        bottom: 56px;
        right: 0;
        width: calc(100vw - 32px);
        height: 480px;
    }
    .nct-chat-tooltip {
        width: calc(100vw - 32px);
        bottom: 56px;
    }
}

/* =====================================================
   Tooltip Proativo - Bolha de mensagem incoming (WhatsApp style)
   ===================================================== */
.nct-chat-tooltip {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 285px;
    background-color: var(--nct-bg-card);
    border: 1px solid var(--nct-border);
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    padding: 14px 40px 14px 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
    z-index: 9998;
    opacity: 0;
    transform: translateY(12px) scale(0.93);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
    cursor: pointer;
    user-select: none;
}

/* Cauda/seta da bolha apontando para o botão */
.nct-chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 14px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-top: 10px solid var(--nct-bg-card);
}

/* Borda externa da cauda */
.nct-chat-tooltip::before {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 13px;
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-top: 11px solid var(--nct-border);
}

.nct-chat-tooltip.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    animation: nctTooltipBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes nctTooltipBounce {
    0%   { opacity: 0; transform: translateY(16px) scale(0.9); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.nct-chat-tooltip-inner {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nct-chat-tooltip-sender {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 11.5px;
    color: var(--nct-primary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.nct-chat-tooltip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 5px #22c55e;
    flex-shrink: 0;
    animation: nctStatusPulse 1.5s infinite alternate;
}

.nct-chat-tooltip-text {
    color: var(--nct-text-main);
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.nct-chat-tooltip-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--nct-text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: sans-serif;
}

.nct-chat-tooltip-close:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}
