/* ========================================
   Digital Wellness Platform Chatbot Styles
   ======================================== */

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a6fa5 0%, #5a7fb8 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 111, 165, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(74, 111, 165, 0.5);
}

.chat-toggle:active {
    transform: scale(0.95);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* Header */
.chat-header {
    background: linear-gradient(135deg, #4a6fa5 0%, #5a7fb8 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-minimize {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 16px;
    animation: messageSlide 0.3s ease;
}

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

.bot-message .message-content {
    background: white;
    color: #2c3e50;
    border-radius: 12px 12px 12px 4px;
    padding: 12px 16px;
    max-width: 85%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.user-message .message-content {
    background: linear-gradient(135deg, #4a6fa5 0%, #5a7fb8 100%);
    color: white;
    border-radius: 12px 12px 4px 12px;
    padding: 12px 16px;
    max-width: 85%;
    box-shadow: 0 2px 4px rgba(74, 111, 165, 0.3);
}

.message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
}

.message-content p:last-of-type {
    margin-bottom: 0;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

.bot-message .message-content a {
    color: #4a6fa5;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}

/* Typing Indicator */
.typing-indicator .message-content {
    padding: 16px;
    width: fit-content;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #4a6fa5;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Quick Actions */
.quick-actions {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quick-action-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
    font-weight: 500;
    text-align: left;
}

.quick-action-btn:hover {
    background: #e9ecef;
    border-color: #4a6fa5;
    color: #4a6fa5;
    transform: translateY(-1px);
}

/* Input */
.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #4a6fa5;
}

.chat-send {
    background: linear-gradient(135deg, #4a6fa5 0%, #5a7fb8 100%);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(74, 111, 165, 0.4);
}

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

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        max-height: 600px;
    }

    .chatbot-container {
        right: 10px;
        bottom: 10px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .chat-toggle,
    .chat-window,
    .chat-message,
    .quick-action-btn,
    .chat-send {
        animation: none;
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .chat-toggle {
        border: 2px solid currentColor;
    }

    .chat-input {
        border-width: 2px;
    }

    .quick-action-btn {
        border-width: 2px;
    }
}
