/* VARIABLES */
:root {
    --pxa-primary: #FFC727;
    --pxa-text: #333;
    --pxa-bg: #fff;
    --pxa-bot-bg: #f4f4f4;
    --pxa-user-text: #fff;
    --pxa-radius: 5px;
    --pxa-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.pxa-typing { margin: 10px 15px; font-style: italic; color: #aaa; display: flex; gap: 3px; }
.pxa-typing span { animation: pxa-blink 1.4s infinite both; font-size: 24px; line-height: 10px; }
.pxa-typing span:nth-child(2) { animation-delay: 0.2s; }
.pxa-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pxa-blink { 0% { opacity: 0.2; } 20% { opacity: 1; } 100% { opacity: 0.2; } }

#pxa-bubble { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background: var(--pxa-primary); border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 999999; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: transform 0.3s, background 0.3s; }
#pxa-bubble:hover { transform: scale(1.1); }

#pxa-window { position: fixed; bottom: 30px; right: 30px; width: 380px; height: 600px; max-height: 80vh; background: #fff; border-radius: var(--pxa-radius); box-shadow: var(--pxa-shadow); display: none; flex-direction: column; z-index: 999999; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; opacity: 0; transform: translateY(20px); transition: opacity 0.3s, transform 0.3s; }
#pxa-window.active { opacity: 1; transform: translateY(0); }

#pxa-header { background: var(--pxa-primary); color: #fff; padding: 20px; display: flex; justify-content: space-between; align-items: center; }
#pxa-title { font-weight: 700; font-size: 18px; }
#pxa-status { font-size: 12px; opacity: 0.9; }
#pxa-close { background:none; border:none; color:rgba(255,255,255,0.8); font-size:24px; cursor:pointer; transition: color 0.2s; }
#pxa-close:hover { color: #fff; }

#pxa-messages { flex: 1; padding: 20px; overflow-y: auto; background: #fff; display: flex; flex-direction: column; gap: 15px; scrollbar-width: thin; }
.pxa-msg { max-width: 85%; padding: 12px 16px; border-radius: 5px; font-size: 15px; line-height: 1.5; word-wrap: break-word; }
.pxa-msg.bot { background: var(--pxa-bot-bg); color: var(--pxa-text); align-self: flex-start; border-bottom-left-radius: 4px; }
.pxa-msg.user { background: var(--pxa-primary); color: var(--pxa-user-text); align-self: flex-end; border-bottom-right-radius: 4px; }

.pxa-quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; margin-bottom: 15px; align-self: flex-start; }
.pxa-quick-btn { background: #fff; border: 1px solid var(--pxa-primary); color: var(--pxa-primary); padding: 8px 16px; border-radius: 5px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.pxa-quick-btn:hover { background: var(--pxa-primary); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

#pxa-input-area { padding: 15px; border-top: 1px solid #eee; background: #fff; display: flex; align-items: center; gap: 10px; }
#pxa-input { flex: 1; padding: 12px 15px; border: 1px solid #ddd; border-radius: 5px; outline: none; font-size: 16px; transition: border-color 0.2s; min-width: 0; }
#pxa-input:focus { border-color: var(--pxa-primary); }

#pxa-send, #pxa-mic { background: var(--pxa-primary); color: #fff; border: none; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; padding: 0px; transition: transform 0.2s, background-color 0.2s; flex-shrink: 0;}
#pxa-send:hover, #pxa-mic:hover { transform: scale(1.1); }
#pxa-mic { background: #f0f2f5; color: #666; font-size: 20px;}

.pxa-recording { animation: pxa-pulse-red 1.5s infinite !important; background-color: #ffeaea !important; border: 1px solid #ff4d4d; }
@keyframes pxa-pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 77, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); } }

#pxa-clip { font-size: 24px; cursor: pointer; color: #999; transition: color 0.3s; padding: 5px; flex-shrink: 0;}
#pxa-clip:hover { color: var(--pxa-primary); }

#pxa-confetti { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; display:none; }

@media (max-width: 768px) {
    #pxa-window { bottom: 0; right: 0; width: 100%; height: 100%; max-height: 100%; border-radius: 0; margin: 0; top: 0; left: 0; }
    #pxa-header { padding-top: env(safe-area-inset-top); border-radius: 0; }
    #pxa-input-area { padding-bottom: env(safe-area-inset-bottom); }
    #pxa-bubble { bottom: 20px; right: 20px; }
}