/* Widget do Robô com IA - TDesk Solutions */
/* Todos os seletores estão dentro de .robot-widget para NÃO afetar o layout do site */

.robot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.robot-widget .robot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #1e3a8a), var(--secondary-color, #3b82f6));
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.robot-widget .robot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(30, 58, 138, 0.5);
}

.robot-widget .robot-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.robot-widget .robot-toggle .robot-icon {
    transition: transform 0.3s;
}

.robot-widget.open .robot-toggle .robot-icon {
    transform: rotate(90deg);
}

.robot-widget .robot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--accent-color, #10b981);
    border-radius: 50%;
    font-size: 0.7rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    animation: robot-pulse-badge 2s infinite;
}

@keyframes robot-pulse-badge {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

.robot-widget .robot-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.robot-widget.open .robot-panel {
    display: flex;
    animation: robot-panel-in 0.3s ease;
}

@keyframes robot-panel-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.robot-widget .robot-header {
    background: linear-gradient(135deg, var(--primary-color, #1e3a8a), var(--secondary-color, #3b82f6));
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.robot-widget .robot-header-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.robot-widget .robot-header-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.robot-widget .robot-header-info p {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    opacity: 0.9;
}

.robot-widget .robot-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s;
}

.robot-widget .robot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.robot-widget .robot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--gray-100, #f1f5f9);
}

.robot-widget .robot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: robot-msg-in 0.3s ease;
}

@keyframes robot-msg-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.robot-widget .robot-msg.bot {
    align-self: flex-start;
    background: white;
    color: var(--gray-800, #1e293b);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 4px;
}

.robot-widget .robot-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-color, #1e3a8a), var(--secondary-color, #3b82f6));
    color: white;
    border-bottom-right-radius: 4px;
}

.robot-widget .robot-msg .robot-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.robot-widget .robot-msg .robot-typing span {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.6;
    animation: robot-typing 1.4s ease-in-out infinite;
}

.robot-widget .robot-msg .robot-typing span:nth-child(2) { animation-delay: 0.2s; }
.robot-widget .robot-msg .robot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes robot-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.robot-widget .robot-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid var(--gray-200, #e2e8f0);
}

.robot-widget .robot-input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.robot-widget .robot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray-300, #cbd5e1);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s;
}

.robot-widget .robot-input:focus {
    outline: none;
    border-color: var(--primary-color, #1e3a8a);
}

.robot-widget .robot-input::placeholder {
    color: var(--gray-400, #94a3b8);
}

.robot-widget .robot-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color, #1e3a8a), var(--secondary-color, #3b82f6));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.robot-widget .robot-send:hover {
    transform: scale(1.05);
}

.robot-widget .robot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.robot-widget .robot-send-whatsapp {
    margin-top: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    background: #22c55e;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.robot-widget .robot-send-whatsapp:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.robot-widget .robot-send-whatsapp i {
    font-size: 1rem;
}

.robot-widget .robot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.robot-widget .robot-suggestion {
    padding: 6px 12px;
    background: var(--gray-100, #f1f5f9);
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--gray-700, #334155);
    cursor: pointer;
    transition: all 0.2s;
}

.robot-widget .robot-suggestion:hover {
    background: var(--primary-color, #1e3a8a);
    color: white;
    border-color: var(--primary-color, #1e3a8a);
}

@media (max-width: 480px) {
    .robot-widget {
        bottom: 16px;
        right: 16px;
    }

    .robot-widget .robot-panel {
        width: calc(100vw - 32px);
        right: -8px;
        height: 70vh;
    }

    .robot-widget .robot-toggle {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}
