/* ==========================================================================
   ELRICS AI RECEPTIONIST (ELRICA) - CLEAN WHITE THEME & FLOATING WIDGET
   ========================================================================== */

:root {
    --el-bot-gold: #dfa938;
    --el-bot-gold-hover: #c99326;
    --el-bot-gold-light: #fef8ee;
    --el-bot-gold-border: rgba(223, 169, 56, 0.35);

    --el-bot-bg-body: #f8fafc;
    --el-bot-bg-white: #ffffff;
    --el-bot-bg-header: #ffffff;
    --el-bot-border-color: #e2e8f0;
    --el-bot-border-subtle: #edf2f7;

    --el-bot-text-main: #0f172a;
    --el-bot-text-muted: #64748b;
    --el-bot-text-subtle: #94a3b8;

    --el-bot-user-bg: linear-gradient(135deg, #dfa938 0%, #f59e0b 100%);
    --el-bot-user-text: #ffffff;
    --el-bot-assistant-bg: #ffffff;

    --el-bot-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --el-bot-font-heading: 'Plus Jakarta Sans', 'Space Grotesk', -apple-system, sans-serif;
}

/* 1. Floating Launcher Button */
.elrica-launcher-btn {
    position: fixed;
    bottom: 26px;
    right: 26px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1.5px solid var(--el-bot-gold);
    border-radius: 50px;
    padding: 6px 18px 6px 6px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(223, 169, 56, 0.25);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

.elrica-launcher-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16), 0 6px 16px rgba(223, 169, 56, 0.35);
    border-color: #f59e0b;
}

.elrica-launcher-btn:active {
    transform: scale(0.97);
}

.elrica-launcher-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.elrica-launcher-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50% !important;
    border: 3px solid #dfa938 !important;
    box-shadow: 0 0 10px rgba(223, 169, 56, 0.45);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden !important;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.elrica-avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

.elrica-launcher-pulse {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50% !important;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
    z-index: 2;
}

.elrica-launcher-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.elrica-launcher-title {
    font-family: var(--el-bot-font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.elrica-launcher-subtitle {
    font-size: 0.72rem;
    color: var(--el-bot-gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 2. Floating Chatbot Window / Widget */
.elrica-widget-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 590px;
    max-height: calc(100vh - 40px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--el-bot-font);
    box-sizing: border-box;
}

.elrica-widget-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.elrica-widget-window.fullscreen {
    width: 800px;
    max-width: calc(100vw - 40px);
    height: 82vh;
    max-height: calc(100vh - 40px);
    bottom: 50%;
    right: 50%;
    transform: translate(50%, 50%);
}

/* Header */
.elrica-widget-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--el-bot-border-color);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
    width: 100%;
}

.elrica-widget-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.elrica-header-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2.5px solid #dfa938;
    box-shadow: 0 0 8px rgba(223, 169, 56, 0.4);
    background: #ffffff;
    color: var(--el-bot-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.elrica-header-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.elrica-header-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    font-family: var(--el-bot-font-heading);
    display: flex;
    align-items: center;
    gap: 6px;
}

.elrica-role-tag {
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--el-bot-gold-light);
    color: #b48811;
    border: 1px solid var(--el-bot-gold-border);
    padding: 2px 6px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.elrica-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 1px;
}

.elrica-status-badge i {
    font-size: 0.5rem;
    color: #10b981;
}

.elrica-widget-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

/* Multilanguage Selector */
.elrica-lang-dropdown {
    position: relative;
}

.elrica-lang-btn {
    height: 32px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    font-family: var(--el-bot-font);
}

.elrica-lang-btn i.fa-globe {
    color: var(--el-bot-gold);
    font-size: 0.85rem;
}

.elrica-lang-arrow {
    font-size: 0.6rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.elrica-lang-dropdown.open .elrica-lang-arrow {
    transform: rotate(180deg);
}

.elrica-lang-btn:hover,
.elrica-lang-dropdown.open .elrica-lang-btn {
    background: #ffffff;
    border-color: var(--el-bot-gold);
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(223, 169, 56, 0.15);
}

.elrica-lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(0, 0, 0, 0.04);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.elrica-lang-dropdown.open .elrica-lang-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.elrica-lang-menu-header {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    padding: 6px 10px 4px 10px;
}

.elrica-lang-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: var(--el-bot-font);
    font-size: 0.8rem;
    color: #334155;
    outline: none;
}

.elrica-lang-opt:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.elrica-lang-flag {
    font-size: 1rem;
    line-height: 1;
}

.elrica-lang-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.elrica-lang-check {
    font-size: 0.75rem;
    color: var(--el-bot-gold);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.elrica-lang-opt.active {
    background: var(--el-bot-gold-light);
    color: #b48811;
    font-weight: 700;
}

.elrica-lang-opt.active .elrica-lang-check {
    opacity: 1;
}

.elrica-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.elrica-icon-btn:hover {
    background: var(--el-bot-gold-light);
    border-color: var(--el-bot-gold);
    color: #b48811;
}

/* Chat Messages Container */
.elrica-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.elrica-messages-container::-webkit-scrollbar {
    width: 5px;
}

.elrica-messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.elrica-msg-row {
    display: flex;
    gap: 12px;
    max-width: 92%;
    animation: elricaFadeIn 0.25s ease-out forwards;
}

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

.elrica-msg-row.assistant {
    align-self: flex-start;
}

.elrica-msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.elrica-msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #dfa938;
    box-shadow: 0 0 6px rgba(223, 169, 56, 0.35);
    background: #ffffff;
    color: var(--el-bot-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    flex-shrink: 0;
    margin-top: 2px;
    overflow: hidden;
}

.elrica-msg-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.91rem;
    line-height: 1.65;
    position: relative;
    word-break: break-word;
    letter-spacing: 0.15px;
}

.elrica-msg-row.assistant .elrica-msg-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-top-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Clean, Spacious ChatGPT-Style Typography */
.elrica-msg-heading {
    font-size: 0.96rem;
    font-weight: 700;
    color: #0f172a;
    margin: 14px 0 8px 0;
    line-height: 1.45;
    letter-spacing: 0.2px;
}
.elrica-msg-heading:first-child {
    margin-top: 0;
}

.elrica-msg-p {
    margin: 0 0 12px 0;
    line-height: 1.68;
    color: #334155;
    font-size: 0.91rem;
}
.elrica-msg-p:last-child {
    margin-bottom: 0;
}

.elrica-msg-list {
    margin: 8px 0 14px 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
ul.elrica-msg-list {
    list-style-type: disc;
}
ol.elrica-msg-list {
    list-style-type: decimal;
}
.elrica-msg-list li {
    color: #334155;
    font-size: 0.91rem;
    line-height: 1.65;
}
.elrica-msg-list li strong {
    color: #0f172a;
    font-weight: 700;
}

.elrica-msg-link {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.08);
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(2, 132, 199, 0.25);
    transition: all 0.2s ease;
    margin: 2px 2px 2px 0;
    font-size: 0.88rem;
    vertical-align: middle;
}
.elrica-msg-link:hover {
    background: #0284c7;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

/* Fallback for any legacy card elements */
.elrica-line-card {
    margin: 6px 0;
    color: #334155;
    line-height: 1.65;
}

.elrica-msg-row.user .elrica-msg-bubble {
    background: var(--el-bot-user-bg);
    color: #ffffff;
    font-weight: 500;
    border-top-right-radius: 4px;
    box-shadow: 0 3px 12px rgba(223, 169, 56, 0.3);
}

.elrica-msg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 5px;
    border-top: 1px solid rgba(226, 232, 240, 0.7);
    gap: 8px;
}

.elrica-msg-row.user .elrica-msg-footer {
    justify-content: flex-end;
    border-top-color: rgba(255, 255, 255, 0.2);
}

.elrica-msg-voice-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #0284c7;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
}

.elrica-msg-voice-btn:hover {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.elrica-msg-voice-btn.speaking {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    animation: elricaVoicePulse 1.2s infinite alternate ease-in-out;
}

@keyframes elricaVoicePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4); }
    100% { transform: scale(1.05); box-shadow: 0 0 0 5px rgba(2, 132, 199, 0); }
}

.elrica-msg-time {
    display: inline-block;
    font-size: 0.65rem;
    color: #94a3b8;
    text-align: right;
}

.elrica-msg-row.user .elrica-msg-time {
    color: rgba(255, 255, 255, 0.85);
}

/* Quick Inquiry Chips */
.elrica-quick-chips-wrapper {
    margin-top: 4px;
    padding: 6px 0;
}

.elrica-chips-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.elrica-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.elrica-chip-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    outline: none;
    font-family: var(--el-bot-font);
}

.elrica-chip-btn i {
    color: var(--el-bot-gold);
    font-size: 0.8rem;
}

.elrica-chip-btn:hover {
    background: var(--el-bot-gold-light);
    border-color: var(--el-bot-gold);
    color: #b48811;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(223, 169, 56, 0.15);
}

/* Typing Indicator */
.elrica-typing-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    font-size: 0.76rem;
    color: #64748b;
}

.elrica-typing-bar.active {
    display: flex;
}

.elrica-typing-dots {
    display: flex;
    align-items: center;
    gap: 3px;
}

.elrica-typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--el-bot-gold);
    border-radius: 50%;
    animation: elricaDotPulse 1.2s infinite ease-in-out;
}

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

@keyframes elricaDotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* Bottom Console */
.elrica-console-box {
    padding: 12px 16px 14px 16px;
    background: #ffffff;
    border-top: 1px solid var(--el-bot-border-color);
    flex-shrink: 0;
}

.elrica-voice-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--el-bot-gold-light);
    border: 1px solid var(--el-bot-gold-border);
    border-radius: 8px;
    color: #b48811;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.elrica-voice-banner.active {
    display: flex;
}

.elrica-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 6px 8px 6px 12px;
    transition: all 0.2s ease;
}

.elrica-input-form:focus-within {
    background: #ffffff;
    border-color: var(--el-bot-gold);
    box-shadow: 0 0 0 3px rgba(223, 169, 56, 0.12);
}

.elrica-mic-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
    outline: none;
}

.elrica-mic-btn:hover, .elrica-mic-btn.active {
    color: var(--el-bot-gold);
}

.elrica-mic-btn.active {
    color: #ef4444;
}

.elrica-textarea {
    flex: 1;
    background: none;
    border: none;
    color: #0f172a;
    font-family: var(--el-bot-font);
    font-size: 0.88rem;
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.35;
    padding: 4px 0;
}

.elrica-textarea::placeholder {
    color: #94a3b8;
}

.elrica-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--el-bot-gold);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
}

.elrica-send-btn:hover {
    background: var(--el-bot-gold-hover);
    transform: scale(1.05);
}

.elrica-console-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.7rem;
    color: #94a3b8;
}

.elrica-footer-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.elrica-footer-btn:hover {
    color: #ef4444;
}

.elrica-rag-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
    font-weight: 500;
}

.elrica-rag-tag i {
    color: var(--el-bot-gold);
}

/* Comprehensive Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
    .elrica-launcher-btn {
        bottom: 16px;
        right: 16px;
        padding: 6px 12px 6px 6px;
        gap: 8px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    }
    .elrica-launcher-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }
    .elrica-launcher-title {
        font-size: 0.85rem;
    }
    .elrica-launcher-subtitle {
        font-size: 0.65rem;
    }

    /* Full-Screen Edge-to-Edge on Mobile & Tablet */
    .elrica-widget-window,
    .elrica-widget-window.fullscreen {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        transform: none !important;
        margin: 0 !important;
        z-index: 999999 !important;
    }

    #elricaExpandBtn {
        display: none !important;
    }

    .elrica-widget-header {
        height: 58px;
        padding: 0 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .elrica-header-brand {
        gap: 8px;
    }

    .elrica-header-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .elrica-header-info h4 {
        font-size: 0.88rem;
    }

    .elrica-role-tag {
        display: none;
    }

    .elrica-messages-container {
        padding: 12px 10px;
        -webkit-overflow-scrolling: touch;
    }

    .elrica-msg-row {
        max-width: 96%;
    }

    .elrica-msg-bubble {
        padding: 11px 13px;
        font-size: 0.88rem;
    }

    .elrica-console-box {
        padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px;
    }

    .elrica-input-form {
        padding: 4px 6px 4px 10px;
        border-radius: 12px;
    }
}

@media (max-width: 400px) {
    .elrica-launcher-text {
        display: none;
    }
    .elrica-launcher-btn {
        padding: 6px;
        border-radius: 50%;
        width: 48px;
        height: 48px;
        justify-content: center;
    }
}
