* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(93, 13, 205, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.8s ease-out;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 380px;
    height: 550px;
    z-index: 9999;
    border: 1px solid rgba(93, 13, 205, 0.1);
}

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

.chat-header {
    background: linear-gradient(135deg, #5d0dcd 0%, #9b59b6 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><radialGradient id="a" cx="50%" cy="50%"><stop offset="0%" stop-color="white" stop-opacity="0.1"/><stop offset="100%" stop-color="white" stop-opacity="0"/></radialGradient></defs><circle cx="10" cy="10" r="1" fill="url(%23a)"><animate attributeName="opacity" dur="3s" repeatCount="indefinite" values="0;1;0"/></circle><circle cx="30" cy="5" r="1" fill="url(%23a)"><animate attributeName="opacity" dur="4s" repeatCount="indefinite" values="0;1;0"/></circle><circle cx="60" cy="15" r="1" fill="url(%23a)"><animate attributeName="opacity" dur="2s" repeatCount="indefinite" values="0;1;0"/></circle></svg>');
    pointer-events: none;
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
    color: #ffffff; /* Explicitly set header text color to white */
}

.chat-header p {
    font-size: 14px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    color: #ffffff; /* Explicitly set subheader text color to white */
}

.status-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    z-index: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-button:hover {
    opacity: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #5d0dcd 0%, #9b59b6 100%);
    border-radius: 3px;
}

.message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease-out;
}

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

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

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, #5d0dcd 0%, #9b59b6 100%);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 15px rgba(93, 13, 205, 0.3);
}

.message.bot .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f5f5f5;
    color: #5d0dcd;
}

.action-btn.active {
    color: #5d0dcd;
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
    order: 1;
}

/* Remove the old bot avatar styling as we're now setting it directly in JavaScript */
.message.bot .message-avatar {
    /* Background now set directly in JavaScript using asset helper */
    border-radius: 50%;
    color: transparent; /* Hide any text inside the avatar */
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    min-height: 44px;
    max-height: 120px;
    /* Hide scrollbar for all browsers */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;     /* Firefox */
}

/* Hide scrollbar for WebKit browsers */
.chat-input::-webkit-scrollbar {
    display: none;
}

.chat-input:focus {
    border-color: #9b59b6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.send-button {
    background: linear-gradient(135deg, #5d0dcd 0%, #9b59b6 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(93, 13, 205, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Update bot-avatar class to maintain border-radius but let JS handle the background */
.bot-avatar {
    border-radius: 50%;
    width: 35px;
    height: 35px;
}

.typing-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    color: #666;
    font-style: italic;
    font-size: 13px;
    margin-top: 10px;
    margin-bottom: 15px;
    order: 999; /* Ensure it appears after other elements */
}

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

.typing-dot {
    width: 4px;
    height: 4px;
    background: #9b59b6;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.welcome-message {
    text-align: center;
    color: #666;
    margin: 50px 0;
}

.welcome-message h3 {
    margin-bottom: 10px;
    color: #5d0dcd;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.quick-action {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.quick-action:hover {
    background: linear-gradient(135deg, #5d0dcd 0%, #9b59b6 100%);
    color: white;
    transform: translateY(-2px);
}

.chat-icon-container {
    position: fixed;
    bottom: 20px;
    left: 20px; /* Changed from 'right: 20px' to position on left side */
    z-index: 9998;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5d0dcd 0%, #9b59b6 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(93, 13, 205, 0.4);
    transition: transform 0.3s ease;
}

.chat-icon:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(93, 13, 205, 0.5);
}

.chat-limit-reached {
    padding: 20px;
    background: white;
    border-top: 1px solid #eee;
    text-align: center;
}

.limit-message {
    color: #555;
    line-height: 1.5;
}

.limit-message p {
    margin-bottom: 15px;
}

.whatsapp-button, .whatsapp-chat-button {
    background: #25d366;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    margin: 5px;
    box-shadow: 0 2px 10px rgba(37, 211, 102, 0.3);
    transition: all 0.2s ease;
}

.whatsapp-button:hover, .whatsapp-chat-button:hover {
    background: #128c7e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.reset-button {
    background: #f1f1f1;
    color: #333;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 5px;
    transition: all 0.2s ease;
}

.reset-button:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.error-message .message-content {
    background: #fff0f0 !important;
    border: 1px solid #ffcdd2 !important;
    color: #d32f2f !important;
}

.retry-btn, .support-btn {
    margin-top: 10px;
}

@media (max-width: 768px) {
    .chat-container {
        width: 95%;
        height: 80vh;
        max-height: 600px;
        bottom: 10px;
        right: 10px;
        left: 10px;
        margin: 0;
        border-radius: 15px;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 15px;
    }
    
    .chat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}
