/* Myraa Chatbot Styles */

#myraa-chatbot-widget {
    --primary-color: #0a2f6b;
    --secondary-color: #FF6B35;
    --text-light: #f5f5f5;
    --text-dark: #333;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --chatbot-dyn-width: 320px;
    --chatbot-dyn-height: 300px;
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 0;
    max-height: 600px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9998;
}

.chatbot-container.open {
    height: 600px;
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 16px);
        max-width: 440px;
        height: 0;
        max-height: 88dvh;
        bottom: calc(8px + env(safe-area-inset-bottom));
        right: 8px;
        left: 8px;
        margin: 0 auto;
        border-radius: 18px;
    }

    .chatbot-container.open {
        height: 78dvh;
        max-height: 88dvh;
    }
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a5f9f 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border-bottom: 2px solid var(--secondary-color);
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.chatbot-icon {
    width: 20px;
    height: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.chatbot-close:hover {
    transform: scale(1.2);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Messages */
.message {
    display: flex;
    animation: slideIn 0.3s ease;
}

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

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ff8c5a 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.bot-message .message-content {
    background: white;
    color: var(--text-dark);
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
}

.message-content strong {
    color: inherit;
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

/* Quick Replies */
.quick-replies {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

.quick-reply {
    background: white;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-reply:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateX(4px);
}

/* Input Area */
.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.chatbot-input::placeholder {
    color: #aaa;
}

.chatbot-send {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ff8c5a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.chatbot-send svg {
    width: 16px;
    height: 16px;
}

/* Toggle Button */
#chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 18px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ff8c5a 100%);
    border: 3px solid #fff;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(4, 14, 31, 0.3);
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: myraaChatPulse 1.8s ease-out infinite;
}

@keyframes myraaChatPulse {
    0% { box-shadow: 0 10px 24px rgba(4, 14, 31, 0.3), 0 0 0 0 rgba(255, 140, 90, 0.6); }
    70% { box-shadow: 0 10px 24px rgba(4, 14, 31, 0.3), 0 0 0 18px rgba(255, 140, 90, 0); }
    100% { box-shadow: 0 10px 24px rgba(4, 14, 31, 0.3), 0 0 0 0 rgba(255, 140, 90, 0); }
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.5);
    animation-play-state: paused;
}

#chatbot-toggle:active {
    transform: scale(0.95);
}

#chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.chatbot-agent-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chatbot-container.open ~ #chatbot-toggle {
    opacity: 0;
    pointer-events: none;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .chatbot-container {
        width: min(420px, calc(100vw - 24px));
        max-height: 82dvh;
        bottom: calc(86px + env(safe-area-inset-bottom));
        right: 12px;
    }

    .chatbot-container.open {
        height: 70dvh;
        max-height: 82dvh;
    }

    .message-content {
        max-width: 90%;
        font-size: 13px;
    }

    .chatbot-header {
        padding: 12px;
    }

    .chatbot-title {
        font-size: 14px;
    }

    .quick-reply {
        padding: 7px 10px;
        font-size: 11px;
    }
}

@media (max-width: 640px) {
    #chatbot-toggle {
        width: 56px;
        height: 56px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 12px;
    }
}

@media (max-width: 480px) {
    #chatbot-toggle {
        width: 56px;
        height: 56px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 12px;
    }

    #chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }

    .chatbot-input-area {
        padding: 10px;
        gap: 6px;
    }

    .chatbot-send {
        width: 36px;
        height: 36px;
        padding: 8px;
    }

    .message-content {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #myraa-chatbot-widget {
        --text-dark: #f5f5f5;
        --text-light: #333;
    }

    .chatbot-container {
        background: #2a2a2a;
    }

    .chatbot-messages {
        background: #1e1e1e;
    }

    .message-content {
        color: var(--text-dark);
    }

    .bot-message .message-content {
        background: #333;
        border-color: #444;
    }

    .chatbot-input {
        background: #333;
        color: #fff;
        border-color: #444;
    }

    .quick-reply {
        background: #333;
        border-color: var(--secondary-color);
        color: var(--secondary-color);
    }

    .quick-reply:hover {
        background: var(--secondary-color);
    }
}
