/* ============================================
   iDOCx Assistant – Floating Chat Widget v2
   Robot EVE + Sleep/Wake + GPT-4o-mini
   ============================================ */

/* --- Robot Container (floating) --- */
.idocx-bot-wrap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9990;
    cursor: pointer;
    user-select: none;
}
.idocx-bot-wrap svg {
    width: 90px;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35))
            drop-shadow(0 0 10px rgba(60,180,255,0.2));
    transition: filter 0.4s ease;
}
.idocx-bot-wrap:hover svg {
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.45))
            drop-shadow(0 0 18px rgba(60,180,255,0.45));
}

/* Badge */
.idocx-bot-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #DAC8A5;
    color: #333;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    pointer-events: none;
    font-family: 'Segoe UI', sans-serif;
    transition: opacity 0.3s;
}

/* Sleep indicator */
.idocx-bot-zzz {
    position: absolute;
    top: -2px;
    left: -14px;
    font-size: 16px;
    font-weight: 700;
    color: rgba(60,180,255,0.7);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    font-family: 'Segoe UI', sans-serif;
}
.idocx-bot-zzz.visible { opacity: 1; }

/* Tooltip bubble */
.idocx-bot-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #0c2750;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
    font-family: 'Segoe UI', sans-serif;
}
.idocx-bot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 30px;
    width: 10px;
    height: 10px;
    background: #0c2750;
    transform: rotate(45deg);
}
.idocx-bot-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- Chat Window --- */
.idocx-chat {
    position: fixed;
    bottom: 120px;
    right: 16px;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.18);
    z-index: 9991;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.idocx-chat.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.idocx-chat-header {
    background: linear-gradient(135deg, #0c2750 0%, #1a3a5c 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.idocx-chat-header svg {
    width: 36px;
    height: auto;
    flex-shrink: 0;
}
.idocx-chat-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.idocx-chat-header-info span {
    font-size: 11px;
    opacity: 0.8;
}
.idocx-chat-header-info .online-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    margin-right: 4px;
    vertical-align: middle;
}
.idocx-chat-minimize {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px 8px;
    margin-left: auto;
}
.idocx-chat-minimize:hover { opacity: 1; }
.idocx-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px;
}
.idocx-chat-close:hover { opacity: 1; }

/* Messages area */
.idocx-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    min-height: 200px;
    background: #f8f9fa;
}

.idocx-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}
.idocx-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.idocx-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #0c2750, #1a3a5c);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.idocx-msg.error {
    align-self: flex-start;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-bottom-left-radius: 4px;
    font-size: 12px;
}

/* Quick replies */
.idocx-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.idocx-quick-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    font-weight: 500;
}
.idocx-quick-btn:hover {
    background: #0c2750;
    color: #fff;
    border-color: #0c2750;
}

/* Input area */
.idocx-chat-input {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    gap: 8px;
}
.idocx-chat-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.idocx-chat-input input:focus { border-color: #0c2750; }
.idocx-chat-input button {
    background: linear-gradient(135deg, #0c2750, #1a3a5c);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.idocx-chat-input button:hover { transform: scale(1.05); }
.idocx-chat-input button:disabled { opacity: 0.5; cursor: default; transform: none; }

/* Typing indicator */
.idocx-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
}
.idocx-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    animation: typingBounce 1.4s infinite ease-in-out;
}
.idocx-typing span:nth-child(2) { animation-delay: 0.2s; }
.idocx-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Footer with WhatsApp button */
.idocx-chat-footer {
    text-align: center;
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.idocx-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}
.idocx-whatsapp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    color: #fff;
}
.idocx-whatsapp-btn i {
    font-size: 16px;
}

/* Responsive */
@media (max-width: 480px) {
    .idocx-chat {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 110px;
        max-height: 70vh;
    }
}
