/* Pearl Tech Hub – AI Chatbot Widget */

#pth-chat-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F5820A, #d96e00);
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(245,130,10,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}
#pth-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(245,130,10,0.55);
}
#pth-chat-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: opacity 0.2s;
}
#pth-chat-btn .pth-icon-close { display: none; }

#pth-chat-btn.open .pth-icon-chat  { display: none; }
#pth-chat-btn.open .pth-icon-close { display: block; }

/* Pulse ring on button */
#pth-chat-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(245,130,10,0.4);
    animation: pth-pulse 2.2s ease-out infinite;
}
@keyframes pth-pulse {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Notification dot */
#pth-chat-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 2px solid #0b0c0b;
    border-radius: 50%;
}

/* Chat Panel */
#pth-chat-panel {
    position: fixed;
    bottom: 102px;
    right: 28px;
    width: 360px;
    height: 520px;
    background: #141514;
    border: 1px solid #252825;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(245,130,10,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
}
#pth-chat-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
#pth-chat-header {
    background: linear-gradient(135deg, #1a1c1a, #111311);
    border-bottom: 2px solid #F5820A;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.pth-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F5820A, #d96e00);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}
.pth-header-info { flex: 1; }
.pth-header-name {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.pth-header-status {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.72rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.pth-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    animation: pth-blink 2s ease-in-out infinite;
}
@keyframes pth-blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.3; }
}
#pth-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
#pth-chat-close:hover { color: #fff; }

/* Messages area */
#pth-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#pth-chat-messages::-webkit-scrollbar { width: 4px; }
#pth-chat-messages::-webkit-scrollbar-track { background: transparent; }
#pth-chat-messages::-webkit-scrollbar-thumb { background: #252825; border-radius: 4px; }

/* Bubbles */
.pth-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: pth-pop 0.2s ease;
}
@keyframes pth-pop {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pth-msg.bot  { align-self: flex-start; }
.pth-msg.user { align-self: flex-end; }

.pth-bubble {
    padding: 10px 13px;
    border-radius: 16px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.84rem;
    line-height: 1.55;
    word-wrap: break-word;
}
.pth-msg.bot  .pth-bubble {
    background: #1e201e;
    color: #e5e7eb;
    border-bottom-left-radius: 4px;
    border: 1px solid #252825;
}
.pth-msg.user .pth-bubble {
    background: linear-gradient(135deg, #F5820A, #d96e00);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Lead captured highlight */
.pth-msg.user.lead-captured .pth-bubble {
    box-shadow: 0 0 0 2px #22c55e;
}

/* Typing indicator */
#pth-typing {
    display: none;
    align-self: flex-start;
}
#pth-typing.visible { display: flex; }
.pth-typing-bubble {
    background: #1e201e;
    border: 1px solid #252825;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.pth-typing-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #F5820A;
    animation: pth-bounce 1.2s ease-in-out infinite;
}
.pth-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.pth-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pth-bounce {
    0%,60%,100% { transform: translateY(0); opacity: 0.5; }
    30%          { transform: translateY(-6px); opacity: 1; }
}

/* Lead capture notice */
#pth-lead-notice {
    display: none;
    margin: 0 14px 4px;
    padding: 7px 12px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 8px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.73rem;
    color: #4ade80;
    text-align: center;
}

/* Input area */
#pth-chat-form {
    border-top: 1px solid #1e201e;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
    background: #111311;
}
#pth-chat-input {
    flex: 1;
    background: #1e201e;
    border: 1px solid #252825;
    border-radius: 12px;
    color: #e5e7eb;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.84rem;
    padding: 10px 13px;
    resize: none;
    max-height: 96px;
    line-height: 1.45;
    outline: none;
    transition: border-color 0.15s;
    overflow-y: auto;
}
#pth-chat-input::placeholder { color: #4b5563; }
#pth-chat-input:focus { border-color: #F5820A; }

#pth-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #F5820A, #d96e00);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
}
#pth-chat-send:hover  { opacity: 0.9; transform: scale(1.05); }
#pth-chat-send:active { transform: scale(0.97); }
#pth-chat-send svg { width: 18px; height: 18px; fill: #fff; }
#pth-chat-send:disabled { opacity: 0.4; cursor: default; transform: none; }

/* Mobile */
@media (max-width: 480px) {
    #pth-chat-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 88px;
        height: 72vh;
        border-radius: 16px;
    }
    #pth-chat-btn { right: 16px; bottom: 20px; }
}
