/* ============================================
   FLOATING CHAT - COMPLETE STYLES
   ============================================ */

.floating-chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.floating-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A63B8, #2C3E70);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 20px rgba(74, 99, 184, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.floating-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(74, 99, 184, 0.5);
}

.floating-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: #ffffff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    min-width: 22px;
    text-align: center;
    animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.floating-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.floating-chat-window.open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.floating-chat-header {
    background: linear-gradient(135deg, #4A63B8, #2C3E70);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.floating-chat-header span {
    font-weight: 600;
    font-size: 16px;
}

.floating-chat-header span i {
    margin-right: 8px;
}

.floating-chat-header-actions {
    display: flex;
    gap: 8px;
}

.floating-chat-header-actions button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.floating-chat-header-actions button:hover {
    opacity: 1;
}

.floating-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    min-height: 200px;
    max-height: 350px;
}

.floating-chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #6B7280;
}

.floating-chat-welcome i {
    font-size: 48px;
    color: #4A63B8;
    display: block;
    margin-bottom: 16px;
}

.floating-chat-welcome h5 {
    color: #2C3E70;
    margin-bottom: 8px;
    font-size: 18px;
}

.floating-chat-welcome p {
    font-size: 14px;
    margin: 0;
}

.floating-chat-msg {
    margin-bottom: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.floating-chat-msg.user {
    margin-left: auto;
    text-align: right;
}

.floating-chat-msg.assistant {
    margin-right: auto;
}

.floating-chat-msg-error .floating-chat-msg-bubble {
    background: #fdecea !important;
    color: #b3261e !important;
}

.floating-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.floating-chat-msg.user .floating-chat-msg-bubble {
    background: #4A63B8;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.floating-chat-msg.assistant .floating-chat-msg-bubble {
    background: #ffffff;
    color: #333333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.floating-chat-msg-time {
    font-size: 10px;
    color: #999999;
    margin-top: 4px;
    padding: 0 4px;
}

.floating-chat-msg.user .floating-chat-msg-time {
    text-align: right;
}

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

.floating-chat-footer {
    display: flex;
    padding: 10px 14px;
    border-top: 1px solid #e9ecef;
    background: #ffffff;
    gap: 8px;
    flex-shrink: 0;
}

.floating-chat-footer input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.floating-chat-footer input:focus {
    border-color: #4A63B8;
    box-shadow: 0 0 0 3px rgba(74, 99, 184, 0.1);
}

.floating-chat-footer input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.floating-chat-footer button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #4A63B8;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.floating-chat-footer button:hover {
    background: #2C3E70;
    transform: scale(1.05);
}

.floating-chat-footer button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.floating-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.floating-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.floating-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 3px;
}

.floating-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a7ae;
}

@media (max-width: 768px) {
    .floating-chat-window {
        width: 90vw;
        max-width: 90vw;
        height: 60vh;
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    .floating-chat-container {
        bottom: 15px;
        right: 15px;
    }

    .floating-chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .floating-chat-window {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .floating-chat-messages {
        max-height: none;
    }

    .floating-chat-footer input {
        font-size: 16px;
        padding: 8px 14px;
    }

    .floating-chat-footer button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .floating-chat-window {
        height: 100vh;
        max-height: 100vh;
    }

    .floating-chat-header {
        padding: 10px 14px;
    }

    .floating-chat-header span {
        font-size: 14px;
    }

    .floating-chat-messages {
        padding: 10px;
    }

    .floating-chat-msg-bubble {
        font-size: 13px;
        padding: 8px 12px;
    }

    .floating-chat-footer {
        padding: 8px 10px;
    }
}

/* -----------------------------------------------------------
 * Inline SVG icons: Font Awesome only ships with the Odoo
 * backend, so external screens and the website rely on these
 * rules to line the SVGs up inside buttons, headers and the
 * welcome block.
 * ----------------------------------------------------------- */
.floating-chat-container svg {
    display: inline-block;
    vertical-align: middle;
}

.floating-chat-welcome svg {
    display: block;
    margin: 0 auto 10px;
}
