/* Chatbot Styles */
.co10pal-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chatbot-toggle {
    background: linear-gradient(135deg, #4A90E2, #9013FE);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    border: none;
    font-size: 24px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-container {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    flex-direction: column;
    z-index: 10001;
}

.chatbot-header {
    background: linear-gradient(135deg, #4A90E2, #9013FE);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-title {
    font-weight: bold;
    font-size: 16px;
}

.chatbot-status {
    font-size: 11px;
    opacity: 0.8;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    color: black;
}

.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.bot-message {
    background: white;
    align-self: flex-start;
    border: 1px solid #e9ecef;
}

.user-message {
    background: #4A90E2;
    color: white;
    align-self: flex-end;
}

.message-sender {
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 5px;
}

.bot-sender {
    color: #4A90E2;
}

.user-sender {
    opacity: 0.9;
}

.message-content {
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-line;
}

.chatbot-input-area {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background: white;
    border-radius: 0 0 15px 15px;
}

.chatbot-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 16px; /* Larger font for mobile */
    min-height: 20px;
}

.chatbot-input:focus {
    border-color: #4A90E2;
}

.chatbot-send {
    background: #4A90E2;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #357ABD;
}

.quick-actions {
    padding: 10px 15px;
    background: #f1f3f4;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.quick-action:hover {
    background: #4A90E2;
    color: white;
    border-color: #4A90E2;
    transform: translateY(-1px);
}

.typing-indicator {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 100%;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.3s linear infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ===== ENHANCED RESPONSIVE DESIGN ===== */

/* Tablets and small laptops */
@media (max-width: 1024px) {
    .chatbot-container {
        width: 320px;
        height: 420px;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

/* Large phones and small tablets */
@media (max-width: 768px) {
    .co10pal-chatbot {
        bottom: 45px;
        right: 15px;
    }
    
    .chatbot-container {
        width: 300px;
        height: 400px;
        right: 0;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .message {
        max-width: 90%;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .co10pal-chatbot {
        bottom: 50px;
        right: 10px;
        left: 10px; /* Ensure it doesn't go off-screen */
    }
    
    .chatbot-container {
        width: calc(100vw - 20px);
        height: 70vh; /* Use viewport height */
        max-height: 400px;
        right: 0;
        left: 0;
        margin: 0 auto; /* Center horizontally */
        bottom: 60px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
        right: 10px;
        bottom: 55px;
        position: fixed;
    }
    
    .chatbot-header {
        padding: 12px 15px;
    }
    
    .chatbot-title {
        font-size: 14px;
    }
    
    .chatbot-messages {
        padding: 10px;
    }
    
    .message {
        padding: 10px 14px;
        max-width: 95%;
    }
    
    .message-content {
        font-size: 13px;
    }
    
    .chatbot-input-area {
        padding: 12px;
    }
    
    .chatbot-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 14px;
    }
    
    .quick-actions {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .quick-action {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .co10pal-chatbot {
        bottom: 18px;
        right: 8px;
        left: 8px;
    }
    
    .chatbot-container {
        width: calc(100vw - 16px);
        height: 65vh;
        bottom: 65px;
    }
    
    .chatbot-toggle {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .chatbot-header {
        padding: 10px 12px;
    }
    
    .chatbot-title {
        font-size: 13px;
    }
    
    .chatbot-status {
        font-size: 10px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-container {
        height: 80vh;
        max-height: 300px;
        bottom: 60px;
    }
    
    .chatbot-messages {
        max-height: 150px;
    }
    
    .chatbot-toggle {
        bottom: 10px;
        right: 10px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chatbot-toggle {
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    }
    
    .chatbot-input {
        -webkit-appearance: none; /* Remove iOS styling */
        -moz-appearance: none;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .chatbot-toggle:hover {
        transform: none; /* Disable hover effects on touch */
    }
    
    .quick-action:hover {
        transform: none;
        background: white;
        color: inherit;
        border-color: #ddd;
    }
    
    .chatbot-send:hover {
        background: #4A90E2;
    }
    
    /* Add active states for touch */
    .chatbot-toggle:active {
        transform: scale(0.95);
    }
    
    .quick-action:active {
        background: #4A90E2;
        color: white;
        border-color: #4A90E2;
    }
    
    .chatbot-send:active {
        background: #357ABD;
    }
}