/* atlaschat-frontend.css - Styles for AtlasChat WordPress Plugin v1.1.2 */

/* --- Root Variables & Base Styles (Local Surge Theme) --- */
:root {
    --ls-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --ls-chat-bg-primary: #0f172a; /* slate-900 */
    --ls-chat-bg-widget: #1e293b; /* slate-800 */
    --ls-chat-bg-header: #334155; /* slate-700 */
    --ls-chat-border: #475569; /* slate-600 */
    --ls-chat-text-primary: #e2e8f0; /* slate-200 */
    --ls-chat-text-secondary: #94a3b8; /* slate-400 */
    --ls-chat-text-accent: #5eead4; /* teal-300 */
    --ls-chat-accent-rgb: 20, 184, 166; /* Teal-500 for glows */
    --ls-chat-user-message-bg: #14b8a6; /* teal-500 */
    --ls-chat-user-message-text: white;
    --ls-chat-atlas-message-bg: #334155; /* slate-700 */
    --ls-chat-atlas-message-text: #e2e8f0; /* slate-200 */
    --ls-chat-input-bg: #334155; /* slate-700 */
    --ls-chat-input-border: #475569; /* slate-600 */
    --ls-chat-input-focus-border: #14b8a6; /* teal-500 */
    --ls-chat-input-focus-shadow: rgba(20, 184, 166, 0.3);
}

#atlaschat-container-root,
#atlaschat-container-root *,
#atlaschat-container-root *::before,
#atlaschat-container-root *::after {
    box-sizing: border-box; margin: 0; padding: 0; border-width: 0; 
    font-family: var(--ls-font-sans);
}

.atlaschat-bubble {
    position: fixed; bottom: 1.5rem; right: 1.5rem; 
    width: 60px; height: 60px; background-color: #14b8a6; color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2), 0 0 0 0 rgba(var(--ls-chat-accent-rgb), 0.5);
    cursor: pointer; z-index: 99998; 
    transition: transform 0.2s ease-in-out, box-shadow 0.3s ease-in-out, opacity 0.3s ease;
    border: 2px solid #0d9488; 
}
.atlaschat-bubble svg { width: 30px; height: 30px; }
.atlaschat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.25), 0 0 20px 5px rgba(var(--ls-chat-accent-rgb), 0.4);
}
.atlaschat-bubble.hidden { transform: scale(0); opacity: 0; pointer-events: none; }

.atlaschat-window {
    position: fixed; bottom: calc(1.5rem + 60px + 1rem); right: 1.5rem;
    width: 380px; max-width: calc(100vw - 2rem); 
    height: 550px; max-height: calc(100vh - 10rem); /* Adjusted max-height */
    background-color: var(--ls-chat-bg-widget);
    border: 1px solid var(--ls-chat-border); border-radius: 0.75rem; 
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3), 0 8px 10px -6px rgba(0,0,0,0.3); 
    display: flex; flex-direction: column; z-index: 99999;
    opacity: 0; transform: translateY(20px) scale(0.98);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
    overflow: hidden; 
}
.atlaschat-window.hidden { opacity: 0 !important; transform: translateY(20px) scale(0.98) !important; pointer-events: none; }
.atlaschat-window.visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.atlaschat-window::before { 
    content: ''; position: absolute; top: -1px; left: -1px; right: -1px; bottom: -1px;
    border-radius: calc(0.75rem + 1px); z-index: -1; pointer-events: none;
    box-shadow: 0 0 25px 7px rgba(var(--ls-chat-accent-rgb), 0.25); opacity: 0.9; 
}

.atlaschat-header {
    background-color: var(--ls-chat-bg-header); color: var(--ls-chat-text-primary);
    padding: 0.75rem 1rem; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--ls-chat-border); flex-shrink: 0;
}
.atlaschat-header h3 { font-size: 1rem; font-weight: 600; }
.atlaschat-close-btn {
    background: none; border: none; color: var(--ls-chat-text-secondary);
    cursor: pointer; padding: 0.25rem; border-radius: 50%;
    transition: color 0.2s, background-color 0.2s;
}
.atlaschat-close-btn svg { width: 20px; height: 20px; }
.atlaschat-close-btn:hover {
    color: var(--ls-chat-text-primary);
    background-color: rgba(var(--ls-chat-accent-rgb), 0.15);
}

.atlaschat-conversation-thread {
    flex-grow: 1; padding: 1rem; overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.75rem; 
}
.atlaschat-conversation-thread::-webkit-scrollbar { width: 6px; }
.atlaschat-conversation-thread::-webkit-scrollbar-track { background: var(--ls-chat-bg-header); border-radius: 3px;}
.atlaschat-conversation-thread::-webkit-scrollbar-thumb { background: var(--ls-chat-text-accent); border-radius: 3px;}
.atlaschat-conversation-thread::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--ls-chat-accent-rgb), 0.8); }

.atlaschat-message {
    max-width: 85%; padding: 0.75rem 1rem; 
    border-radius: 0.75rem; font-size: 0.875rem; 
    line-height: 1.6; word-wrap: break-word;
    opacity: 0; transform: translateY(10px);
    animation: atlasMessageFadeIn 0.3s ease-out forwards;
}
@keyframes atlasMessageFadeIn { to { opacity: 1; transform: translateY(0); } }

.atlaschat-message-user {
    background-color: var(--ls-chat-user-message-bg); color: var(--ls-chat-user-message-text);
    align-self: flex-end; border-bottom-right-radius: 0.25rem; 
}
.atlaschat-message-atlas {
    background-color: var(--ls-chat-atlas-message-bg); color: var(--ls-chat-atlas-message-text);
    align-self: flex-start; border-bottom-left-radius: 0.25rem; 
}
.atlaschat-message p { margin: 0; }
.atlaschat-message p + p { margin-top: 0.5em; }
.atlaschat-message strong { font-weight: 600; color: inherit; }
.atlaschat-message em { font-style: italic; }
.atlaschat-message a.atlaschat-message-link { /* Ensure links inside messages are styled */
    color: var(--ls-chat-text-accent); 
    text-decoration: underline;
}
.atlaschat-message a.atlaschat-message-link:hover { color: var(--ls-chat-text-primary); }


.atlaschat-input-area {
    padding: 0.75rem 1rem; border-top: 1px solid var(--ls-chat-border);
    background-color: var(--ls-chat-bg-widget); flex-shrink: 0;
}
/* Wrapper for input field and buttons for better styling control */
.atlaschat-input-form-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* space-x-2 */
    background-color: var(--ls-chat-input-bg);
    border: 1px solid var(--ls-chat-input-border);
    border-radius: 0.5rem; /* rounded-lg, larger for modern feel */
    padding: 0.375rem; /* py-1.5 px-1.5 for inner padding */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.atlaschat-input-form-wrapper:focus-within {
    border-color: var(--ls-chat-input-focus-border);
    box-shadow: 0 0 0 2px var(--ls-chat-input-focus-shadow);
}
.atlaschat-input { /* Input field itself */
    flex-grow: 1;
    background-color: transparent; /* Transparent inside wrapper */
    border: none; /* Border handled by wrapper */
    color: var(--ls-chat-text-primary);
    padding: 0.625rem 0.75rem; /* py-2.5 px-3, slightly more padding */
    font-size: 0.875rem; 
    min-height: 40px; /* Ensure it's a bit taller */
}
.atlaschat-input:focus { outline: none; box-shadow: none; } /* Focus handled by wrapper */

.atlaschat-mic-btn, .atlaschat-send-btn {
    background-color: transparent;
    color: var(--ls-chat-text-secondary);
    padding: 0.5rem; 
    border-radius: 0.375rem; 
    display: flex; align-items: center; justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease;
    border: none; cursor: pointer; flex-shrink: 0;
}
.atlaschat-mic-btn:hover, .atlaschat-send-btn:hover:not(:disabled) {
    color: var(--ls-chat-text-accent);
    background-color: rgba(var(--ls-chat-accent-rgb), 0.1);
}
.atlaschat-mic-btn.atlaschat-mic-active {
    color: #ef4444; /* red-500 for active recording */
    background-color: rgba(239, 68, 68, 0.1);
}
.atlaschat-send-btn:disabled { color: #6b7280; cursor: not-allowed; background-color: transparent;}
.atlaschat-mic-btn svg, .atlaschat-send-btn svg { width: 20px; height: 20px; }

.atlaschat-typing-indicator {
    display: flex; align-items: center; font-size: 0.75rem; 
    color: var(--ls-chat-text-secondary); padding-bottom: 0.5rem; 
}
.atlaschat-typing-indicator span.dot { 
    height: 6px; width: 6px; margin-right: 3px;
    background-color: var(--ls-chat-text-secondary);
    border-radius: 50%; display: inline-block;
    animation: atlasTypingDots 1.2s infinite ease-in-out;
}
.atlaschat-typing-indicator span.dot:nth-child(1) { animation-delay: 0s; }
.atlaschat-typing-indicator span.dot:nth-child(2) { animation-delay: 0.2s; }
.atlaschat-typing-indicator span.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes atlasTypingDots {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-3px); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 420px) {
    .atlaschat-window {
        right: 0.5rem; 
        bottom: calc(1.5rem + 56px + 0.5rem); 
        width: calc(100vw - 1rem); 
        max-height: calc(100vh - (1.5rem + 56px + 0.5rem + 1rem));
    }
    .atlaschat-bubble {
        bottom: 0.75rem; right: 0.75rem;
        width: 56px; height: 56px;
    }
    .atlaschat-bubble svg { width: 28px; height: 28px; }
}

.atlaschat-contact-link {
    font-size: 0.8em; opacity: 0.8; margin-top: 0.5em; display: block;
}
.atlaschat-contact-link a { color: var(--ls-chat-text-accent); text-decoration: underline; }
.atlaschat-contact-link a:hover { color: var(--ls-chat-text-primary); }