/**
 * NavEd Atlas Chat Widget Styles
 * Matches feedback button styling for consistency
 */

/* Floating Atlas Button - matches feedback button style EXACTLY */
.atlas-floating-btn {
    position: fixed !important;
    bottom: 16px !important;
    right: 180px !important;  /* Left of feedback button with comfortable spacing */
    z-index: 1051;
    padding: 12px 20px !important;
    border-radius: 28px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.atlas-floating-btn:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
}


.atlas-floating-btn:active {
    transform: translateY(0) scale(0.98) !important;
}

/* Sparkle icon styling */
.atlas-floating-btn .atlas-icon {
    font-size: 18px;
    line-height: 1;
}

/* Mobile Responsive - icon only, matches feedback exactly */
@media (max-width: 767px) {
    .atlas-floating-btn {
        bottom: 16px !important;  /* Same as feedback */
        right: 90px !important;   /* Just enough space for feedback icon button */
        padding: 14px 16px !important;
        border-radius: 50% !important;
        min-width: 56px !important;
        min-height: 56px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .atlas-floating-btn .atlas-btn-text {
        display: none !important;
    }

    .atlas-floating-btn .atlas-icon {
        display: inline-block !important;
        font-size: 24px !important;
    }
}

/* Smooth scrolling for chat messages */
#atlasChatMessages {
    scroll-behavior: smooth;
}

/* Ensure chat bubbles display properly */
#atlasChatMessages .chat {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

/* Atlas messages - left aligned */
#atlasChatMessages .chat-start {
    align-items: flex-start;
}

#atlasChatMessages .chat-start .chat-header,
#atlasChatMessages .chat-start .chat-bubble {
    margin-left: 2.5rem; /* Space for avatar */
}

/* User messages - right aligned */
#atlasChatMessages .chat-end {
    align-items: flex-end;
}

#atlasChatMessages .chat-end .chat-header,
#atlasChatMessages .chat-end .chat-bubble {
    text-align: right;
}

#atlasChatMessages .chat-header {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

#atlasChatMessages .chat-image {
    position: absolute;
    left: 0;
    bottom: 0;
}

#atlasChatMessages .chat-start {
    position: relative;
}

#atlasChatMessages .chat-bubble {
    display: inline-block;
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Primary bubble (Atlas) - teal */
#atlasChatMessages .chat-bubble.bg-primary {
    background-color: #0D7C87 !important;
    color: white !important;
}

/* Accent bubble (User) - amber */
#atlasChatMessages .chat-bubble.bg-accent {
    background-color: #F59E0B !important;
    color: white !important;
}

/* Links in chat bubbles */
#atlasChatMessages .chat-bubble a {
    color: inherit;
    text-decoration: underline;
}

#atlasChatMessages .chat-bubble a:hover {
    opacity: 0.8;
}

/* Custom scrollbar styling for chat messages */
#atlasChatMessages::-webkit-scrollbar {
    width: 6px;
}

#atlasChatMessages::-webkit-scrollbar-track {
    background: transparent;
}

#atlasChatMessages::-webkit-scrollbar-thumb {
    background: oklch(var(--bc) / 0.2);
    border-radius: 3px;
}

#atlasChatMessages::-webkit-scrollbar-thumb:hover {
    background: oklch(var(--bc) / 0.3);
}

/* Floating button pulse animation on hover */
#atlasChatToggle:hover {
    animation: atlas-pulse 1.5s infinite;
}

@keyframes atlas-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 oklch(var(--p) / 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px oklch(var(--p) / 0);
    }
}

/* Message bubble animations */
.chat {
    animation: atlas-fade-in 0.3s ease-out;
}

@keyframes atlas-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading dots custom styling */
.atlas-loading .loading-dots {
    color: oklch(var(--pc));
}

/* Ensure panel is above everything except modals */
#atlasChatPanel {
    z-index: 1052;
    position: fixed !important;
    bottom: 80px !important;
    right: 16px !important;
    width: 400px !important;
    min-width: 400px !important;
    max-width: 400px !important;
    height: 500px !important;
    max-height: calc(100vh - 120px) !important;
}

/* Messages container - ensure scrolling works */
#atlasChatMessages {
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

/* Chat card - ensure proper flex layout */
#atlasChatPanel > .card {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Responsive adjustments for mobile */
@media (max-width: 640px) {
    #atlasChatPanel {
        width: calc(100vw - 2rem) !important;
        min-width: auto !important;
        max-width: none !important;
        height: calc(100vh - 120px) !important;
        max-height: calc(100vh - 120px) !important;
        bottom: 80px !important;
        right: 1rem !important;
    }
}

/* Accessibility: Focus states */
#atlasChatInput:focus {
    outline: 2px solid oklch(var(--p));
    outline-offset: 2px;
}

#atlasChatToggle:focus-visible,
#atlasChatMinimize:focus-visible,
#atlasChatSend:focus-visible {
    outline: 2px solid oklch(var(--p));
    outline-offset: 2px;
}
