.chatbot {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999; /* Increased z-index */
    visibility: visible !important; /* Ensure visibility */
}

.chatbot-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary), var(--success));
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
    animation: floatY 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px); /* Ensure it doesn't overflow viewport */
    background: var(--bg-dark);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    border: 1px solid var(--primary);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
}

.chatbot.active .chatbot-container {
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chatbot-header {
    padding: 0.75rem 1rem;
    background: linear-gradient(45deg, var(--primary), var(--success));
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-title {
    font-weight: 600;
    font-size: 1rem;
}

.chatbot-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: calc(100% - 120px); /* Account for header and input area */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-dark);
    background: rgba(13, 27, 42, 0.98);
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 3px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 15px;
    max-width: 85%;
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: 0.3px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.3s ease-in-out;
}

.bot-message {
    background: linear-gradient(45deg, var(--primary), var(--success));
    color: #FFFFFF;
    border-top-left-radius: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message {
    background: var(--secondary);
    color: #FFFFFF;
    margin-left: auto;
    border-top-right-radius: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
    padding: 0 5px;
}

.suggestion-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-btn:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

.suggestion-btn[class*="emergency"],
.suggestion-btn[class*="crisis"],
.suggestion-btn[class*="urgent"] {
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
}

.suggestion-btn[class*="emergency"]:hover,
.suggestion-btn[class*="crisis"]:hover,
.suggestion-btn[class*="urgent"]:hover {
    background: #dc3545;
    transform: translateY(-1px) scale(1.02);
}

.typing-indicator {
    padding: 15px;
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

.chatbot-input {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 10px;
}

.chatbot-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--primary);
    border-radius: 25px;
    background: var(--dark);
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.chatbot-input input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.chatbot-input .send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.chatbot-input .send-button:hover {
    transform: scale(1.1);
}
