/* Chatbot Widget Styles - Royal AI */
/* Enhanced for better readability and accessibility */

:root {
    --chat-primary: #002366; /* Royal Blue */
    --chat-accent: #8b5cf6; /* Neon Purple */
    --chat-glass: rgba(15, 12, 29, 0.92);
    --chat-border: rgba(139, 92, 246, 0.3);
    --chat-text: #f8fafc;
    --chat-text-secondary: #a8b4c7;
}

#royal-chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Outfit', sans-serif;
}

/* Chat Bubble Container - includes text */
.chat-bubble-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row-reverse;
}

/* Invitation text next to bubble */
.chat-bubble-text {
    background: var(--chat-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--chat-border);
    padding: 12px 18px;
    border-radius: 25px;
    color: var(--chat-text);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: text-pulse 2s ease-in-out infinite;
}

.chat-bubble-text:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateX(-5px);
}

@keyframes text-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Chat Bubble Icon */
.chat-bubble {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(109, 40, 217, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: bubble-float 3s ease-in-out infinite;
    flex-shrink: 0;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.7);
}

.chat-bubble i {
    color: white;
    font-size: 32px;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 95px;
    right: 0;
    width: 420px;
    height: 620px;
    background: var(--chat-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    transform-origin: bottom right;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-window.active {
    display: flex;
    animation: window-appear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Header */
.chat-header {
    padding: 18px 20px;
    background: rgba(0, 35, 102, 0.5);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--chat-accent);
}

.chat-header-info {
    flex: 1;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 18px;
    color: white;
    font-weight: 600;
}

.chat-header-info p {
    margin: 0;
    font-size: 13px;
    color: var(--chat-accent);
    font-weight: 600;
}

.chat-close-btn,
.chat-settings-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: var(--chat-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-close-btn:hover,
.chat-settings-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-close-btn i,
.chat-settings-btn i {
    font-size: 18px;
}

/* Settings Panel */
.chat-settings-panel {
    background: rgba(0, 35, 102, 0.3);
    border-bottom: 1px solid var(--chat-border);
    padding: 12px 20px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--chat-text);
    font-size: 14px;
    cursor: pointer;
}

.settings-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--chat-accent);
}

.settings-reset-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.settings-reset-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    border-color: #8b5cf6;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 3px;
}

.message {
    max-width: 82%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 16px; /* Increased from 14px */
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--chat-primary), #003399);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 35, 102, 0.3);
}

/* Typing Indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 10px;
    color: var(--chat-text-secondary);
    font-size: 14px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chat-accent);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Input Area */
.chat-input-area {
    padding: 18px 20px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    flex-wrap: wrap;
}

.chat-input-area input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--chat-border);
    border-radius: 25px;
    padding: 14px 22px;
    color: white;
    font-family: inherit;
    font-size: 16px; /* Increased */
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--chat-accent);
    background: rgba(255, 255, 255, 0.1);
}

.chat-input-area input::placeholder {
    color: var(--chat-text-secondary);
}

.char-counter {
    position: absolute;
    right: 80px;
    bottom: 8px;
    font-size: 11px;
    color: var(--chat-text-secondary);
    opacity: 0.7;
}

.chat-input-area button#chat-send {
    background: linear-gradient(135deg, var(--chat-accent), #6d28d9);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chat-input-area button#chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
}

.chat-input-area button#chat-send i {
    font-size: 22px;
}

/* Slot Buttons */
.slot-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-top: 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid var(--chat-accent);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.slot-btn:hover {
    background: var(--chat-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Animations */
@keyframes bubble-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes window-appear {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 480px) {
    #royal-chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    .chat-bubble-text {
        display: none; /* Hide on mobile to save space */
    }

    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        bottom: 85px;
        right: -5px;
        border-radius: 16px;
    }

    .chat-bubble {
        width: 60px;
        height: 60px;
    }

    .chat-bubble i {
        font-size: 28px;
    }

    .message {
        font-size: 15px;
        max-width: 88%;
    }

    .chat-input-area input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
    .message.bot {
        background: rgba(255, 255, 255, 0.15);
        border: 2px solid rgba(255, 255, 255, 0.3);
    }

    .message.user {
        background: var(--chat-primary);
        border: 2px solid var(--chat-accent);
    }
}
