/* Smart Assistant Styles */
:root {
    --sa-primary-color: #007bff;
    --sa-bg-color: #ffffff;
    --sa-header-bg: #f8f9fa;
    --sa-user-msg-bg: #007bff;
    --sa-user-msg-color: #ffffff;
    --sa-bot-msg-bg: #e9ecef;
    --sa-bot-msg-color: #212529;
    --sa-border-color: #dee2e6;
}

.o_smart_assistant_button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #20B2AA 0%, #008B8B 100%);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(32, 178, 170, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10000;
    transition: all .3s ease;
    border: 3px solid rgba(255, 255, 255, 0.3);
    animation: pulseGlow 2s infinite;
}

/* Pulsing glow animation */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 4px 15px rgba(32, 178, 170, 0.4), 0 0 0 0 rgba(32, 178, 170, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 6px 20px rgba(32, 178, 170, 0.6), 0 0 0 10px rgba(32, 178, 170, 0.1);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 4px 15px rgba(32, 178, 170, 0.4), 0 0 0 0 rgba(32, 178, 170, 0);
        transform: scale(1);
    }
}

.o_smart_assistant_button:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 25px rgba(32, 178, 170, 0.6);
    animation: pulseGlow 1s infinite;
}

.o_smart_assistant_button:active {
    transform: scale(0.95);
    animation: none;
}

.o_smart_assistant_button img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Logo container to handle the custom logo */
.sa_logo_container {
    width: 45px;
    height: 45px;
    background-image: url('/adh_smart_assistant/static/bot_logo.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
}

/* Additional hover effect for logo */
.o_smart_assistant_button:hover .sa_logo_container {
    filter: drop-shadow(0 4px 12px rgba(32, 178, 170, 0.5));
    transform: rotate(-5deg);
}

/* Breathing animation for extra attention */
@keyframes breathe {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.15) rotate(-2deg);
        opacity: 0.9;
    }
}

.o_smart_assistant_button.sa_breathing .sa_logo_container {
    animation: breathe 2.5s ease-in-out infinite;
}

/* Enhanced glow effect */
.o_smart_assistant_button.sa_breathing {
    box-shadow: 0 0 20px rgba(32, 178, 170, 0.6), 0 0 30px rgba(32, 178, 170, 0.4);
}

.o_smart_assistant_button .o_smart_assistant_close_icon {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.o_smart_assistant_chat_window {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.05);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

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

.o_smart_assistant_chat_window.sa-collapsed {
    display: none;
}

.sa_header {
    padding: 1.2rem;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    font-weight: 700;
    font-size: 1.1em;
    display: flex;
    justify-content: center;
    align-items: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

.sa_header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
}

.sa_messages_container {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sa_message {
    max-width: 80%;
    padding: .5rem .8rem;
    border-radius: 15px;
    margin-bottom: .5rem;
    line-height: 1.4;
}

.sa_message.sa_user {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.sa_message.sa_bot {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #212529;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0, 0.08);
    border: 1px solid rgba(0,0,0,0.05);
}

.sa_message.sa_bot a {
    color: var(--sa-primary-color);
    text-decoration: underline;
}

.sa_quick_replies {
    padding: 5px 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.sa_quick_replies button,
.sa_quick_reply_btn {
    background-color: transparent;
    border: 1px solid var(--sa-primary-color);
    color: var(--sa-primary-color);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: .9em;
    cursor: pointer;
    transition: background-color .2s;
    margin: 2px;
}

.sa_quick_replies button:hover,
.sa_quick_reply_btn:hover {
    background-color: var(--sa-primary-color);
    color: #fff;
}

.sa_service_login_reply {
    padding: 5px 10px 0;
}

.sa_service_login_reply a {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--sa-primary-color);
    color: #fff!important;
    padding: 10px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 10px;
    transition: opacity .2s;
}

.sa_service_login_reply a:hover {
    opacity: .9;
}

.sa_input_area {
    display: flex;
    padding: 1rem;
    background: linear-gradient(145deg, #f8f9fa 0%, #ffffff 100%);
    border-top: 1px solid rgba(0,0,0,0.05);
    gap: 0.5rem;
}

.sa_input_area input {
    flex-grow: 1;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 0.75rem 1.2rem;
    outline: 0;
    font-size: 0.95em;
    transition: all 0.3s ease;
    background: white;
}

.sa_input_area input:focus {
    border-color: var(--sa-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.sa_input_area button {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.sa_input_area button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.sa_input_area button:before {
    content: "➤";
    display: inline-block;
    transform: rotate(-45deg);
    position: relative;
    top: -2px;
}

/* RTL Support */
html[dir=rtl] .o_smart_assistant_button {
    left: auto;
    right: 20px;
}

html[dir=rtl] .o_smart_assistant_chat_window {
    left: auto;
    right: 20px;
}

html[dir=rtl] .sa_message.sa_user {
    align-self: flex-start;
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 5px;
}

html[dir=rtl] .sa_message.sa_bot {
    align-self: flex-end;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 5px;
}

html[dir=rtl] .sa_input_area button:before {
    transform: rotate(225deg);
    top: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .o_smart_assistant_chat_window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 10px;
        left: 20px;
        right: 20px;
    }

    html[dir=rtl] .o_smart_assistant_chat_window {
        right: 20px;
        left: 20px;
    }
}