/**
 * Floating Ije Chatbot Styles
 * Modern, responsive design with emerald/green color scheme
 */

/* Main Container */
.floating-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Figtree', sans-serif;
}

/* Chat Bubble */
.chat-bubble {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow:
        0 8px 25px rgba(5, 150, 105, 0.3),
        0 0 20px rgba(5, 150, 105, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    pointer-events: auto;
    user-select: none;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow:
        0 12px 35px rgba(5, 150, 105, 0.4),
        0 0 30px rgba(5, 150, 105, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Pause beacon animation on hover */
.chat-bubble:hover::before,
.chat-bubble:hover::after,
.chat-bubble:hover .chat-bubble-pulse,
.chat-bubble:hover .chat-bubble-content::before {
    animation-play-state: paused;
}

/* Add a subtle breathing effect when chat is open */
.floating-chatbot[data-chat-open="true"] .chat-bubble {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}



.chat-bubble-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-bubble-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Beacon Effect */
.chat-bubble-pulse {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid rgba(5, 150, 105, 0.8);
    border-radius: 50%;
    animation: beacon 2s infinite;
}

/* Additional beacon rings */
.chat-bubble::before,
.chat-bubble::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 2px solid rgba(5, 150, 105, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.chat-bubble::before {
    animation: beacon 3s infinite 0.7s;
}

.chat-bubble::after {
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    border-color: rgba(5, 150, 105, 0.3);
    animation: beacon 3s infinite 1.4s;
}

/* Additional beacon ring using a pseudo-element approach */
.chat-bubble-content::before {
    content: '';
    position: absolute;
    top: -18px;
    left: -18px;
    right: -18px;
    bottom: -18px;
    border: 1px solid rgba(5, 150, 105, 0.2);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    animation: beacon 3s infinite 2.1s;
}

@keyframes beacon {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    25% {
        transform: scale(1.1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.4;
    }
    75% {
        transform: scale(1.6);
        opacity: 0.2;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Enhanced pulse for the main ring */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Notification Badge */
.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
}

/* Tooltip */
.chat-bubble-tooltip {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-bubble-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.chat-bubble:hover .chat-bubble-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    position: relative;
}

.chat-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-header-status {
    font-size: 12px;
    opacity: 0.8;
    margin: 0;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

.chat-message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-message .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-bubble {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.user-bubble {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    padding: 0 4px;
}

/* Quick Actions */
.chat-quick-actions {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    max-height: 120px;
    min-height: 44px;
}

.chat-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.chat-send-btn {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn.sending {
    background: #6b7280;
}

/* Chat Footer */
.chat-footer {
    padding: 8px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.chat-powered-by {
    text-align: center;
    font-size: 11px;
    color: #6b7280;
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .floating-chatbot {
        bottom: 80px; /* Account for mobile bottom nav */
        right: 16px;
    }

    .chat-window {
        width: calc(100vw - 32px);
        height: 70vh;
        max-height: 500px;
    }

    .chat-bubble {
        width: 56px;
        height: 56px;
    }

    .chat-bubble-avatar {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 16px);
        right: 8px;
    }

    .floating-chatbot {
        right: 8px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Animation Classes */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
