/* EVLyne, the chat widget (resources/views/components/evlyne.blade.php). --evlyne-primary and --evlyne-on-primary
   come from the brand on #evlyne-root. Dark mode follows html.dark (the website's toggle, Filament's). */
#evlyne-root, #evlyne-root * { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

.evlyne-bubble {
    position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; border-radius: 9999px; border: 0; cursor: pointer;
    z-index: 2147483600; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); background: var(--evlyne-primary); color: var(--evlyne-on-primary);
    display: flex; align-items: center; justify-content: center; transition: transform .15s ease;
}
.evlyne-bubble:hover { transform: scale(1.06); }
.evlyne-bubble svg { width: 28px; height: 28px; }
/* The panel's table pagination sits bottom right: the bubble moves up there. */
#evlyne-root[data-context="panel"] .evlyne-bubble { bottom: 80px; }
#evlyne-root[data-context="panel"] .evlyne-panel { bottom: 152px; }

.evlyne-panel {
    position: fixed; bottom: 96px; right: 24px; width: 380px; max-width: calc(100vw - 32px); height: 540px; max-height: calc(100vh - 120px);
    background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); z-index: 2147483601;
    display: none; flex-direction: column; overflow: hidden; transition: width .18s ease, height .18s ease;
}
.evlyne-panel.is-open { display: flex; }
.evlyne-panel.is-expanded { width: min(1080px, calc(100vw - 64px)); height: min(820px, calc(100vh - 120px)); }

.evlyne-header { background: var(--evlyne-primary); color: var(--evlyne-on-primary); padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.evlyne-avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.evlyne-title { flex: 1; font-size: 15px; }
.evlyne-header button { background: transparent; border: 0; color: inherit; cursor: pointer; opacity: .85; padding: 4px; font-size: 20px; line-height: 1; display: inline-flex; }
.evlyne-header button:hover { opacity: 1; }
.evlyne-header svg { width: 18px; height: 18px; }

.evlyne-live-bar { display: none; align-items: center; gap: 6px; padding: 7px 10px; background: #f0fdfa; border-bottom: 1px solid #99f6e4; font-size: 12px; }
.evlyne-live-bar.is-active { display: flex; }
.evlyne-live-bar span { flex: 1; color: #0d9488; font-weight: 600; }
.evlyne-live-bar button { background: transparent; color: #0f172a; border: 1px solid #5eead4; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 600; cursor: pointer; }
.evlyne-live-bar button:disabled { opacity: .5; cursor: not-allowed; }

.evlyne-messages { flex: 1; overflow-y: auto; padding: 16px; background: #f8fafc; display: flex; flex-direction: column; gap: 10px; }
.evlyne-msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.evlyne-msg.from-bot { background: #fff; color: #0f172a; border: 1px solid #e2e8f0; align-self: flex-start; }
.evlyne-msg.from-user { background: var(--evlyne-primary); color: var(--evlyne-on-primary); align-self: flex-end; }
.evlyne-msg a { color: inherit; text-decoration: underline; }
.evlyne-sources { margin-top: 6px; font-size: 11px; color: #64748b; white-space: normal; }
.evlyne-status { margin-top: 4px; font-size: 11px; color: #64748b; font-style: italic; }

.evlyne-typing { display: inline-flex; gap: 3px; }
.evlyne-typing i { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: evlyne-bounce 1.2s infinite ease-in-out both; }
.evlyne-typing i:nth-child(2) { animation-delay: .15s; }
.evlyne-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes evlyne-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }

.evlyne-disclaimer { padding: 8px 14px 4px; font-size: 11px; line-height: 1.4; color: #94a3b8; background: #fff; text-align: center; border-top: 1px solid #e2e8f0; }
.evlyne-form { padding: 10px 12px 12px; background: #fff; display: flex; gap: 8px; align-items: flex-end; }
.evlyne-input {
    flex: 1; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; border-radius: 18px; padding: 10px 14px; font-size: 14px; outline: none;
    line-height: 1.4; resize: none; min-height: 40px; max-height: 160px; overflow-y: auto;
}
.evlyne-input:focus { border-color: var(--evlyne-primary); }
.evlyne-send { background: var(--evlyne-primary); color: var(--evlyne-on-primary); border: 0; border-radius: 999px; padding: 0 18px; cursor: pointer; font-size: 14px; font-weight: 600; height: 40px; }
.evlyne-send:disabled { opacity: .5; cursor: not-allowed; }

.evlyne-cta { padding: 10px 12px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 12px; font-size: 13px; color: #0d9488; }
.evlyne-card { padding: 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.evlyne-card strong { font-size: 13px; color: #0f172a; }
.evlyne-closed { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; }
.evlyne-card input, .evlyne-card textarea { padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 10px; font-size: 13px; color: #0f172a; background: #fff; outline: none; resize: vertical; }
.evlyne-card input:focus, .evlyne-card textarea:focus { border-color: var(--evlyne-primary); }
.evlyne-actions { display: flex; gap: 8px; justify-content: flex-end; }
.evlyne-button { padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: 0; background: var(--evlyne-primary); color: var(--evlyne-on-primary); }
.evlyne-button.is-secondary { background: #f3f4f6; color: #4b5563; }
.evlyne-button:disabled { opacity: .5; cursor: not-allowed; }
.evlyne-cta .evlyne-button { margin-top: 8px; border-radius: 999px; }

html.dark .evlyne-panel { background: #0f172a; box-shadow: 0 20px 50px rgba(0, 0, 0, .55); }
html.dark .evlyne-messages, html.dark .evlyne-form, html.dark .evlyne-disclaimer { background: #0f172a; }
html.dark .evlyne-disclaimer { color: #64748b; border-top-color: #1e293b; }
html.dark .evlyne-msg.from-bot, html.dark .evlyne-card { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.dark .evlyne-card strong { color: #e2e8f0; }
html.dark .evlyne-input, html.dark .evlyne-card input, html.dark .evlyne-card textarea { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.dark .evlyne-sources, html.dark .evlyne-status { color: #94a3b8; }
html.dark .evlyne-closed { color: #fcd34d; background: rgba(120, 53, 15, .25); border-color: #78350f; }

@media (max-width: 480px) {
    .evlyne-panel { right: 8px; left: 8px; bottom: 88px; width: auto; max-width: none; }
    .evlyne-bubble { right: 16px; bottom: 16px; }
    .evlyne-expand { display: none !important; }
}
