/* Chatbot and WhatsApp Button Styles */

/* ===== CHATBOT STYLES ===== */

.chatbot-container {
    position: fixed;
    top: 50%;
    right: 90px;
    transform: translateY(-50%) translateX(20px);
    width: 350px;
    max-height: calc(100vh - 40px);
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    display: none;
    flex-direction: column;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.08);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.chatbot-container.chatbot-open {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
}

.chatbot-header {
    background: linear-gradient(135deg, #333, #555);
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-info .status {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10001;
    position: relative;
    backdrop-filter: blur(5px);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}

.chatbot-close:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.1);
    box-shadow: 0 2px 10px rgba(255,255,255,0.2);
}

/* Collected Details Section */
.chatbot-details {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
    max-height: 120px;
    overflow-y: auto;
}

.chatbot-details-content h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #31738c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-details-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-item {
    font-size: 12px;
    color: #333;
    padding: 4px 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #31738c;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-item strong {
    color: #31738c;
    font-weight: 600;
}

.chatbot-close:active {
    transform: scale(0.95);
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    scrollbar-width: thin;
    scrollbar-color: #31738c transparent;
    max-height: 350px;
    min-height: 200px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #31738c;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #2c5f7a;
}

.chatbot-message {
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-content {
    background: white;
    padding: 14px 18px;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid rgba(0,0,0,0.05);
}

.bot-message .message-content {
    background: #2c3e50;
    border: 1px solid #34495e;
    border-bottom-left-radius: 5px;
    color: white;
}

.user-message .message-content {
    background: #31738c;
    color: white;
    border-bottom-right-radius: 5px;
}

.info-message .message-content {
    background: #34495e;
    border: 1px solid #2c3e50;
    font-size: 13px;
    color: white;
}

.chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-bottom: 10px;
}

.chatbot-option {
    background: #34495e;
    border: 2px solid #2c3e50;
    color: white;
    padding: 12px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chatbot-option:hover {
    background: #31738c;
    color: white;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(49, 115, 140, 0.3);
}

.chatbot-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #34495e;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #2c3e50;
    color: white;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: transparent;
}

.chatbot-input input::placeholder {
    color: #bdc3c7;
}

.chatbot-input input:focus {
    border-color: #31738c;
    box-shadow: 0 0 0 2px rgba(49, 115, 140, 0.2);
}

.chatbot-input button {
    background: #31738c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(49, 115, 140, 0.2);
}

.chatbot-input button:hover {
    background: #2c5f7a;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(49, 115, 140, 0.3);
}

.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #333, #555);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(51, 51, 51, 0.4);
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbotPulse 2s infinite;
}

@keyframes chatbotPulse {
    0% {
        box-shadow: 0 5px 20px rgba(51, 51, 51, 0.4);
    }
    50% {
        box-shadow: 0 5px 30px rgba(51, 51, 51, 0.6);
    }
    100% {
        box-shadow: 0 5px 20px rgba(51, 51, 51, 0.4);
    }
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(51, 51, 51, 0.5);
}

.chatbot-toggle-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle-text {
    display: none;
}

/* ===== WHATSAPP BUTTON STYLES ===== */

.whatsapp-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #25D366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(37, 211, 102, 0.4);
    z-index: 9997;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: whatsappPulse 2s infinite;
    text-decoration: none;
}

@keyframes whatsappPulse {
    0% {
        box-shadow: 0 5px 20px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 5px 30px rgba(37, 211, 102, 0.6);
    }
    100% {
        box-shadow: 0 5px 20px rgba(37, 211, 102, 0.4);
    }
}

.whatsapp-button:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.5);
    background: #20ba5a;
}

.whatsapp-button svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.whatsapp-tooltip {
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #333;
}

.whatsapp-button:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        height: 500px;
        max-height: 500px;
        bottom: 20px;
        right: 20px;
        left: 20px;
        border-radius: 15px;
        position: fixed;
        top: auto;
        transform: translateY(20px);
    }
    
    .chatbot-container.chatbot-open {
        transform: translateY(0);
    }
    
    .chatbot-messages {
        max-height: 300px;
        padding: 15px;
    }
    
    .chatbot-close {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 22px;
        background: rgba(255,255,255,0.15);
    }
    
    .chatbot-close:hover {
        background: rgba(255,255,255,0.3);
        transform: scale(1.05);
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 10px;
        width: 50px;
        height: 50px;
    }
    
    .chatbot-toggle-text {
        display: none;
    }
    
    .whatsapp-button {
        bottom: 15px;
        left: 10px;
        width: 50px;
        height: 50px;
    }
    
    .whatsapp-button svg {
        width: 28px;
        height: 28px;
    }
    
    .whatsapp-tooltip {
        display: none;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 20px);
        height: 450px;
        max-height: 450px;
        bottom: 15px;
        right: 10px;
        left: 10px;
    }
    
    .chatbot-header {
        padding: 12px;
    }
    
    .chatbot-messages {
        padding: 10px;
        max-height: 250px;
    }
    
    /* Prevent keyboard from affecting chatbot position */
    .chatbot-container {
        position: fixed !important;
        bottom: 15px !important;
        top: auto !important;
        transform: translateY(20px) !important;
        height: 450px !important;
        max-height: 450px !important;
    }
    
    .chatbot-container.chatbot-open {
        transform: translateY(0) !important;
    }
    
    /* Ensure close button is always visible */
    .chatbot-close {
        position: relative !important;
        z-index: 10001 !important;
        pointer-events: auto !important;
        display: flex !important;
        visibility: visible !important;
    }
    
    .message-content {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .chatbot-option {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ===== ACCESSIBILITY ===== */

@media (prefers-reduced-motion: reduce) {
    .chatbot-container,
    .chatbot-toggle,
    .whatsapp-button,
    .chatbot-option,
    .chatbot-input button {
        transition: none;
        animation: none;
    }
    
    .chatbot-message {
        animation: none;
    }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    .chatbot-container {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .chatbot-messages {
        background: #2a2a2a;
    }
    
    .message-content {
        background: #333;
        color: #fff;
    }
    
    .bot-message .message-content {
        background: #404040;
    }
    
    .info-message .message-content {
        background: #2a4a5a;
        border-color: #4a6a7a;
    }
    
    .chatbot-option {
        background: #333;
        color: #31738c;
        border-color: #31738c;
    }
    
    .chatbot-input {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .chatbot-input input {
        background: #333;
        border-color: #555;
        color: #fff;
    }
}
