/* PurjiLagao.com - Chatbot Styles */
/* Modern, healthcare-themed chatbot interface */

/* Chat Button - Floating Action Button */
.chat-button {
    position: fixed;
    bottom: 30px;
    right: 110px; /* Moved left to avoid WhatsApp button */
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow: hidden;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.6);
}

.chat-button-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-icon {
    width: 28px;
    height: 28px;
    color: white;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.chat-button-text {
    position: absolute;
    right: 70px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-button:hover .chat-button-text {
    opacity: 1;
    transform: translateX(0);
}

/* Chatbot Container States */
.chatbot-hidden {
    opacity: 0;
    pointer-events: none;
}

.chatbot-hidden .chat-button {
    opacity: 1 !important;
    pointer-events: all !important;
    display: flex !important;
}

.chatbot-open {
    opacity: 1;
    pointer-events: all;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 420px; /* Slightly wider for better UX */
    max-width: calc(100vw - 60px);
    height: 650px; /* Taller for more content */
    max-height: calc(100vh - 200px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 
                0 0 0 1px rgba(16, 185, 129, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.chatbot-open .chat-window {
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-action-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.bot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.bot-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.bot-status {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: statusBlink 2s infinite;
}

@keyframes statusBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message Styles */
.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: messageSlideIn 0.4s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.message .bot-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    max-width: 280px;
}

.bot-message .message-content {
    background: white;
    padding: 15px 18px;
    border-radius: 20px 20px 20px 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.user-message .message-content {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 15px 18px;
    border-radius: 20px 20px 8px 20px;
    text-align: right;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.message-content p:not(:last-child) {
    margin-bottom: 8px;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    font-size: 14px;
}

/* Welcome Message */
.welcome-message {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
}

.welcome-message .bot-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.welcome-message .message-content {
    background: none;
    padding: 0;
    box-shadow: none;
    border: none;
    max-width: none;
}

/* Quick Replies */
.quick-replies {
    padding: 0 20px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: white;
}

.quick-reply-btn {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #059669;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Inline Quick Replies */
.inline-quick-replies {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inline-quick-reply {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #059669;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-quick-reply:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: translateY(-1px);
}

/* Chat Input */
.chat-input-container {
    background: white;
    border-top: 1px solid rgba(229, 231, 235, 0.5);
    padding: 20px;
    border-radius: 0 0 20px 20px;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

#chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: #374151;
    font-family: inherit;
}

#chat-input::placeholder {
    color: #9ca3af;
}

.voice-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.voice-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.send-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    color: #6b7280;
    font-size: 13px;
}

.typing-indicator.show {
    display: flex;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Mobile Responsiveness - Enhanced for Better UX */
@media (max-width: 480px) {
    .chat-button {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .chat-icon {
        width: 24px;
        height: 24px;
    }
    
    /* Enhanced Mobile Chat Window - Larger & Full Vertical */
    .chat-window {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        height: calc(100vh - 130px) !important; /* Much larger vertical space */
        max-height: calc(100vh - 130px) !important;
        min-height: 500px !important;
        border-radius: 20px !important;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25) !important;
    }
    
    .chat-header {
        padding: 18px 20px;
        border-radius: 20px 20px 0 0;
    }
    
    .bot-info h3 {
        font-size: 16px;
    }
    
    /* Enhanced Messages Area - More Space */
    .chat-messages {
        flex: 1;
        padding: 15px 20px;
        max-height: none !important;
        overflow-y: auto;
    }
    
    .message-content {
        max-width: none;
        padding: 12px 16px;
    }
    
    /* Larger Input Area on Mobile */
    .chat-input-container {
        padding: 18px 20px;
        border-radius: 0 0 20px 20px;
    }
    
    .chat-input-wrapper {
        padding: 14px 18px;
        border-radius: 25px;
    }
    
    #chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.4;
    }
    
    /* Better Quick Replies on Mobile */
    .quick-replies {
        padding: 10px 20px 18px;
    }
    
    .quick-reply-btn {
        font-size: 13px;
        padding: 10px 14px;
        margin: 4px;
        border-radius: 20px;
    }
}
    
    .chat-input-container {
        padding: 16px;
    }
}

/* Tablet Responsiveness - Medium Screens */
@media (max-width: 768px) and (min-width: 481px) {
    .chat-window {
        bottom: 15px !important;
        right: 15px !important;
        left: 15px !important;
        width: auto !important;
        height: calc(100vh - 150px) !important;
        max-height: calc(100vh - 150px) !important;
        min-height: 550px !important;
    }
    
    .chat-messages {
        padding: 18px 22px;
    }
    
    .chat-input-container {
        padding: 20px 22px;
    }
}

/* Small Mobile Phones - Extra Enhancements */
@media (max-width: 360px) {
    .chat-window {
        height: calc(100vh - 120px) !important; /* Even more vertical space on small screens */
        min-height: 480px !important;
        border-radius: 18px !important;
    }
    
    .chat-header {
        padding: 16px 18px;
    }
    
    .chat-messages {
        padding: 12px 18px;
    }
    
    .chat-input-container {
        padding: 16px 18px;
    }
    
    .quick-reply-btn {
        font-size: 12px;
        padding: 8px 12px;
        margin: 3px;
    }
    
    /* Optimize message content for very small screens */
    .message-content {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .bot-info h3 {
        font-size: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #1f2937;
        border-color: rgba(16, 185, 129, 0.3);
    }
    
    .chat-messages {
        background: linear-gradient(to bottom, #1f2937, #111827);
    }
    
    .bot-message .message-content {
        background: #374151;
        color: #f9fafb;
        border-color: rgba(16, 185, 129, 0.2);
    }
    
    .welcome-message {
        background: linear-gradient(135deg, #064e3b, #065f46);
        border-color: rgba(16, 185, 129, 0.3);
    }
    
    .chat-input-container {
        background: #1f2937;
        border-color: rgba(16, 185, 129, 0.2);
    }
    
    .chat-input-wrapper {
        background: #374151;
        border-color: #4b5563;
    }
    
    #chat-input {
        color: #f9fafb;
    }
    
    #chat-input::placeholder {
        color: #9ca3af;
    }
    
    .quick-replies {
        background: #1f2937;
    }
}

/* Mobile-Specific Enhancements */
@media (max-width: 768px) {
    /* Full-screen feel for mobile chat */
    .chatbot-open .chat-window {
        animation: mobileSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes mobileSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* Enhanced touch targets for mobile */
    .send-btn, .voice-btn, .chat-action-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        touch-action: manipulation;
    }
    
    /* Better message spacing on mobile */
    .message {
        margin-bottom: 16px;
    }
    
    /* Optimize avatar sizes for mobile */
    .bot-avatar, .user-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    /* Better typing indicator on mobile */
    .typing-indicator {
        margin: 15px 20px;
        font-size: 14px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for keyboard navigation */
.chat-button:focus,
.send-btn:focus,
.voice-btn:focus,
.quick-reply-btn:focus,
.inline-quick-reply:focus,
.chat-action-btn:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-button {
        border: 2px solid #000;
    }
    
    .chat-window {
        border: 2px solid #000;
    }
    
    .message-content {
        border: 1px solid #000;
    }
}

/* Chatbot notification tooltip animations */
@keyframes tooltipSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(-50%) translateX(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(-50%) translateX(0); 
    }
}
