/* ===== Maya Chatbot Styles ===== */

/* Chatbot Float Button */
.chatbot-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-orange), #e66a1f);
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(255, 127, 50, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: chatbotPulse 3s ease-in-out infinite;
}

.chatbot-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 127, 50, 0.6);
}

.chatbot-float.minimized {
    background: linear-gradient(135deg, var(--primary-blue), #1a1f4e);
    animation: none;
}

.chatbot-float.minimized:hover {
    box-shadow: 0 6px 25px rgba(35, 41, 98, 0.6);
}

.chatbot-float i {
    font-size: 24px;
    color: var(--white);
    transition: transform 0.3s ease;
}

.chatbot-float:hover i {
    transform: scale(1.1);
}

.chatbot-float.minimized i {
    transform: rotate(180deg);
}

/* Notification Badge */
.chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4444;
    border-radius: 50%;
    color: white;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: notificationBounce 0.6s ease-in-out;
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: chatbotSlideUp 0.4s ease-out;
}

.chatbot-window.show {
    display: flex;
}

.chatbot-window.minimized {
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary-blue), #1a1f4e);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
}

.chatbot-title i {
    font-size: 18px;
    color: var(--primary-orange);
}

.chatbot-controls {
    display: flex;
    gap: 8px;
}

.chatbot-control {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
}

.chatbot-control:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chatbot-control.close:hover {
    background: #ff4444;
}

/* Chatbot Status */
.chatbot-status {
    padding: 8px 20px;
    background: rgba(255, 127, 50, 0.1);
    font-size: 12px;
    color: var(--primary-orange);
    text-align: center;
    border-bottom: 1px solid rgba(255, 127, 50, 0.1);
}

.chatbot-status.online {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
}

.chatbot-status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--light-gray);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(35, 41, 98, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(35, 41, 98, 0.5);
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: messageSlide 0.3s ease-out;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--white);
    flex-shrink: 0;
}

.message.maya .message-avatar {
    background: linear-gradient(135deg, var(--primary-orange), #e66a1f);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary-blue), #1a1f4e);
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message.maya .message-content {
    background: var(--light-gray);
    color: var(--dark-gray);
    border-bottom-left-radius: 6px;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary-orange), #e66a1f);
    color: var(--white);
    border-bottom-right-radius: 6px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.typing-indicator .message-avatar {
    background: linear-gradient(135deg, var(--primary-orange), #e66a1f);
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--light-gray);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-gray);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: var(--text-gray);
    font-size: 14px;
}

.welcome-message h3 {
    color: var(--primary-blue);
    margin-bottom: 10px;
    font-size: 16px;
}

.welcome-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.suggestion-chip {
    background: rgba(255, 127, 50, 0.1);
    color: var(--primary-orange);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 127, 50, 0.2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.suggestion-chip:hover {
    background: var(--primary-orange);
    color: var(--white);
    transform: translateY(-1px);
}

/* Chatbot Input */
.chatbot-input {
    padding: 15px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--white);
    border-radius: 0 0 20px 20px;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-field {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    transition: all 0.3s ease;
    outline: none;
}

.input-field:focus {
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(255, 127, 50, 0.1);
}

.send-button {
    width: 40px;
    height: 40px;
    background: var(--primary-orange);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: #e66a1f;
    transform: scale(1.05);
}

.send-button:disabled {
    background: rgba(255, 127, 50, 0.5);
    cursor: not-allowed;
}

/* Error States */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
    margin: 10px 0;
}

.retry-button {
    background: #dc2626;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.retry-button:hover {
    background: #b91c1c;
}

/* Animations */
@keyframes chatbotPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 127, 50, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(255, 127, 50, 0.6), 0 0 0 8px rgba(255, 127, 50, 0.1);
    }
}

@keyframes chatbotSlideUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.message.streaming .streaming-text {
    position: relative;
}

.message.streaming .streaming-text::after {
    content: '|';
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes messageSlide {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

@keyframes notificationBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ===== Responsive Design ===== */

/* Tablets */
@media screen and (max-width: 768px) {
    .chatbot-window {
        width: 350px;
        right: 20px;
        bottom: 90px;
    }
    
    .chatbot-float {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .chatbot-float i {
        font-size: 22px;
    }
}

/* Mobile Devices */
@media screen and (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 30px);
        height: 450px;
        right: 15px;
        bottom: 80px;
        border-radius: 15px;
    }
    
    .chatbot-header {
        padding: 12px 15px;
        border-radius: 15px 15px 0 0;
    }
    
    .chatbot-title {
        font-size: 15px;
    }
    
    .chatbot-messages {
        padding: 15px;
        gap: 12px;
    }
    
    .chatbot-input {
        padding: 12px 15px;
        border-radius: 0 0 15px 15px;
    }
    
    .input-field {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 15px;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .chatbot-float {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .chatbot-float i {
        font-size: 20px;
    }
}

/* Small Mobile Devices */
@media screen and (max-width: 360px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: 400px;
        right: 10px;
        bottom: 70px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
    
    .chatbot-input {
        padding: 10px 12px;
    }
    
    .message-content {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* Landscape Mobile */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .chatbot-window {
        height: 350px;
        bottom: 70px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
}

/* High Resolution Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    .chatbot-float,
    .message-avatar,
    .chatbot-control,
    .send-button {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .chatbot-float {
        animation: none !important;
    }
    
    .chatbot-window {
        animation: none !important;
    }
    
    .message {
        animation: none !important;
    }
    
    .typing-dot {
        animation: none !important;
    }
    
    .chatbot-notification {
        animation: none !important;
    }
    
    .chatbot-float:hover,
    .chatbot-control:hover,
    .send-button:hover,
    .suggestion-chip:hover {
        transform: none !important;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .chatbot-control,
    .send-button,
    .suggestion-chip {
        min-height: 44px;
        min-width: 44px;
    }
    
    .input-field {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .chatbot-float:hover,
    .chatbot-control:hover,
    .send-button:hover,
    .suggestion-chip:hover {
        transform: none;
    }
    
    .chatbot-float:active {
        transform: scale(0.95);
    }
    
    .chatbot-control:active,
    .send-button:active {
        transform: scale(0.9);
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* 
    Add dark mode styles if needed
    Currently keeping light theme for consistency
    */
}

/* Print Styles */
@media print {
    .chatbot-float,
    .chatbot-window {
        display: none !important;
    }
}
