/* MapleReceptionist — Ezra Widget
 * 3-state premium chat: hero (center), docked (corner pill), open (chat panel)
 * Brand: orange #ff6b35 -> rose #ff4d6d, glass-morphism on docked state.
 */

.mr-ezra-shell {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2147483600;
    font-family: 'Sora', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: #0b1220;
}
.mr-ezra-shell, .mr-ezra-shell * { box-sizing: border-box; }

/* ------------------------------------------------ HERO (center) */
.mr-ezra-backdrop {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center,
        rgba(255,107,53,0.22),
        rgba(255,77,109,0.10) 45%,
        transparent 72%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.mr-ezra-shell.state-hero .mr-ezra-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.mr-ezra-hero {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 380px; max-width: 92vw;
    background: linear-gradient(180deg, #ffffff, #fff7ed);
    border-radius: 28px;
    padding: 30px 26px 22px;
    box-shadow:
        0 32px 80px rgba(255,107,53,0.28),
        0 10px 24px rgba(0,0,0,0.10),
        inset 0 1px 0 rgba(255,255,255,0.9);
    text-align: center;
    pointer-events: auto;
    opacity: 0;
    transition:
        transform 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        top 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        left 0.65s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.5s ease,
        border-radius 0.5s ease,
        box-shadow 0.5s ease,
        opacity 0.45s ease;
}
.mr-ezra-shell.state-hero .mr-ezra-hero { opacity: 1; }

.mr-ezra-pulse {
    position: absolute;
    top: -10px; left: 50%;
    transform: translateX(-50%);
    width: 170px; height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255,107,53,0.42),
        transparent 60%);
    animation: mr-ezra-pulse 2.6s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
@keyframes mr-ezra-pulse {
    0%, 100% { transform: translateX(-50%) scale(1);    opacity: 0.65; }
    50%      { transform: translateX(-50%) scale(1.18); opacity: 0.20; }
}

.mr-ezra-avatar-wrap {
    position: relative;
    width: 140px; height: 140px;
    margin: 0 auto 14px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #ff6b35, #ff4d6d);
    z-index: 1;
    box-shadow:
        0 10px 26px rgba(255,107,53,0.38),
        inset 0 0 0 4px #fff;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 56px;
    letter-spacing: -1px;
    font-family: 'Sora', 'Inter', system-ui, sans-serif;
}
.mr-ezra-avatar {
    width: 100%; height: 100%;
    object-fit: cover;
}

.mr-ezra-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    background: linear-gradient(135deg, #ff6b35, #ff4d6d);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

.mr-ezra-role {
    font-size: 13px;
    color: #475569;
    margin: 0 0 16px;
    font-weight: 500;
}

.mr-ezra-bubble {
    background: #fff;
    border-left: 3px solid #ff6b35;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.45;
    margin-bottom: 16px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.mr-ezra-hero-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.mr-ezra-hero-input {
    flex: 1;
    border: 1px solid #fde4d4;
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mr-ezra-hero-input:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255,107,53,0.15);
}

.mr-ezra-cta-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.mr-ezra-btn {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.mr-ezra-btn-primary {
    background: linear-gradient(135deg, #ff6b35, #ff4d6d);
    color: #fff;
    box-shadow: 0 6px 16px rgba(255,77,109,0.35);
}
.mr-ezra-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(255,77,109,0.45); }
.mr-ezra-btn-ghost {
    background: #fff;
    color: #1f2937;
    border: 1px solid #fde4d4;
}
.mr-ezra-btn-ghost:hover { background: #fff8f1; }
.mr-ezra-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    animation: mr-ezra-recording 1.2s ease-in-out infinite;
}

.mr-ezra-dismiss {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.06);
    border: none;
    color: #475569;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
    transition: background 0.15s ease, color 0.15s ease;
}
.mr-ezra-dismiss:hover { background: rgba(15, 23, 42, 0.12); color: #0b1220; }

.mr-ezra-wave {
    height: 18px;
    margin: -6px 0 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.mr-ezra-shell.is-recording .mr-ezra-wave { opacity: 1; }

/* ------------------------------------------------ DOCKED (corner pill) */
.mr-ezra-shell.state-docked .mr-ezra-backdrop { opacity: 0; pointer-events: none; }
.mr-ezra-shell.state-docked .mr-ezra-hero {
    top: calc(100% - 56px);
    left: calc(100% - 56px);
    transform: translate(-50%, -50%) scale(1);
    width: 78px;
    padding: 0;
    border-radius: 50%;
    box-shadow:
        0 10px 28px rgba(255,77,109,0.45),
        inset 0 0 0 2px rgba(255,255,255,0.55);
    background:
        linear-gradient(135deg, rgba(255,107,53,0.92), rgba(255,77,109,0.92));
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    overflow: hidden;
    cursor: pointer;
}
.mr-ezra-shell.state-docked .mr-ezra-pulse {
    top: 0; left: 0;
    transform: none;
    width: 78px; height: 78px;
    box-shadow: 0 0 0 0 rgba(255,107,53,0.55);
    animation: mr-ezra-ring 2.4s ease-out infinite;
    background: transparent;
}
@keyframes mr-ezra-ring {
    0%   { box-shadow: 0 0 0 0   rgba(255,107,53,0.55); }
    100% { box-shadow: 0 0 0 28px rgba(255,107,53,0); }
}
.mr-ezra-shell.state-docked .mr-ezra-avatar-wrap {
    width: 78px; height: 78px;
    margin: 0;
    border-radius: 50%;
    box-shadow: none;
    background: transparent;
    font-size: 30px;
    color: #fff;
}
.mr-ezra-shell.state-docked .mr-ezra-name,
.mr-ezra-shell.state-docked .mr-ezra-role,
.mr-ezra-shell.state-docked .mr-ezra-bubble,
.mr-ezra-shell.state-docked .mr-ezra-cta-row,
.mr-ezra-shell.state-docked .mr-ezra-hero-input-row,
.mr-ezra-shell.state-docked .mr-ezra-wave,
.mr-ezra-shell.state-docked .mr-ezra-dismiss { display: none; }

/* ------------------------------------------------ OPEN (chat panel) */
.mr-ezra-panel {
    position: absolute;
    bottom: 108px; right: 24px;
    width: 380px; max-width: calc(100vw - 32px);
    height: 580px; max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.26);
    display: none;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition:
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease;
}
.mr-ezra-shell.state-open .mr-ezra-panel { display: flex; transform: none; opacity: 1; }

.mr-ezra-panel-head {
    background: linear-gradient(135deg, #ff6b35, #ff4d6d);
    padding: 14px 16px;
    display: flex; align-items: center; gap: 10px;
    color: #fff;
}
.mr-ezra-panel-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255,255,255,0.22);
    border: 2px solid rgba(255,255,255,0.4);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
    flex-shrink: 0;
}
.mr-ezra-panel-id { flex: 1; min-width: 0; }
.mr-ezra-panel-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.mr-ezra-panel-status { font-size: 11px; opacity: 0.95; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.mr-ezra-panel-status::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52,211,153,0.7);
    animation: mr-ezra-online 1.8s infinite;
}
@keyframes mr-ezra-online {
    0%   { box-shadow: 0 0 0 0   rgba(52,211,153,0.7); }
    100% { box-shadow: 0 0 0 10px rgba(52,211,153,0); }
}
.mr-ezra-panel-close {
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}
.mr-ezra-panel-close:hover { background: rgba(255,255,255,0.3); }

.mr-ezra-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fff8f1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mr-ezra-msg { display: flex; max-width: 85%; }
.mr-ezra-msg-user  { align-self: flex-end; }
.mr-ezra-msg-agent { align-self: flex-start; }
.mr-ezra-bub {
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.mr-ezra-msg-user .mr-ezra-bub {
    background: linear-gradient(135deg, #ff6b35, #ff4d6d);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mr-ezra-msg-agent .mr-ezra-bub {
    background: #fff;
    color: #1f2937;
    border: 1px solid #fde4d4;
    border-bottom-left-radius: 4px;
}
.mr-ezra-msg-agent.is-playing .mr-ezra-bub {
    box-shadow: 0 0 0 3px rgba(255,107,53,0.18);
}
/* MT#564: "From our FAQ" badge on FAQ-sourced answers */
.mr-ezra-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    line-height: 1.4;
}
.mr-ezra-msg-agent .mr-ezra-badge { align-self: flex-start; }
.mr-ezra-typing-row .mr-ezra-bub { padding: 12px 14px; }
.mr-ezra-typing span {
    display: inline-block;
    width: 7px; height: 7px;
    background: #ff6b35;
    border-radius: 50%;
    margin-right: 4px;
    animation: mr-ezra-typing 1.2s infinite ease-in-out;
}
.mr-ezra-typing span:nth-child(2) { animation-delay: 0.18s; }
.mr-ezra-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes mr-ezra-typing {
    0%,80%,100% { transform: scale(0); opacity: 0.5; }
    40%         { transform: scale(1); opacity: 1; }
}

.mr-ezra-input-row {
    border-top: 1px solid #f1e2cf;
    padding: 12px 12px 14px;
    background: #fff;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.mr-ezra-mic {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b35, #ff4d6d);
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
    box-shadow: 0 4px 12px rgba(255,77,109,0.3);
    position: relative;
}
.mr-ezra-mic:hover { transform: scale(1.06); }
.mr-ezra-mic.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: mr-ezra-recording 1.2s ease-in-out infinite;
}
@keyframes mr-ezra-recording {
    0%, 100% { box-shadow: 0 0 0 0   rgba(239,68,68,0.6); }
    50%      { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}
.mr-ezra-mic svg { width: 20px; height: 20px; fill: currentColor; }
.mr-ezra-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mr-ezra-input:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255,107,53,0.15);
}
.mr-ezra-send {
    width: 44px; height: 44px;
    border-radius: 12px;
    border: none;
    background: #0b1220;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.mr-ezra-send:hover { background: #1e293b; }
.mr-ezra-send:disabled { background: #94a3b8; cursor: not-allowed; }
.mr-ezra-send svg { width: 18px; height: 18px; fill: currentColor; }

.mr-ezra-status {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    padding: 4px 12px 8px;
    background: #fff;
    border-top: 1px solid #f1e2cf;
    min-height: 22px;
}

/* ------------------------------------------------ Mobile */
@media (max-width: 480px) {
    .mr-ezra-hero { width: 92vw; padding: 22px 18px 18px; }
    .mr-ezra-avatar-wrap { width: 116px; height: 116px; font-size: 46px; }
    .mr-ezra-panel {
        bottom: 96px; right: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 120px);
        max-height: 600px;
    }
    .mr-ezra-shell.state-docked .mr-ezra-hero {
        top: calc(100% - 60px);
        left: calc(100% - 60px);
        width: 84px;
    }
    .mr-ezra-shell.state-docked .mr-ezra-avatar-wrap,
    .mr-ezra-shell.state-docked .mr-ezra-pulse { width: 84px; height: 84px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mr-ezra-pulse,
    .mr-ezra-mic.recording,
    .mr-ezra-btn.recording,
    .mr-ezra-panel-status::before,
    .mr-ezra-typing span { animation: none !important; }
}

/* ── BUG FIX 2026-05-25: docked pill was invisible because base .mr-ezra-hero
   has opacity:0 and only .state-hero overrode it. Restore visibility in docked. */
.mr-ezra-shell.state-docked .mr-ezra-hero {
    opacity: 1;
    pointer-events: auto;
}
/* Hide the new suggestion chips when docked or open (only show on hero). */
.mr-ezra-shell.state-docked .mr-ezra-suggestions,
.mr-ezra-shell.state-open  .mr-ezra-suggestions {
    display: none;
}

/* Avatar image override — 2026-05-25 */
.mr-ezra-avatar.mr-ezra-avatar-img,
.mr-ezra-panel-avatar.mr-ezra-avatar-img {
    padding: 0;
    overflow: hidden;
}
.mr-ezra-avatar.mr-ezra-avatar-img img,
.mr-ezra-panel-avatar.mr-ezra-avatar-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

/* Subtle ring/pulse when audio is waiting for a tap */
.mr-ezra-shell.mr-ezra-await-tap .mr-ezra-pulse {
    animation: mr-ezra-pulse-fast 1.2s ease-in-out infinite;
}
@keyframes mr-ezra-pulse-fast {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50%      { opacity: 0.75; transform: scale(1.08); }
}

/* Suggestion chips — three quick-start questions under the bubble */
.mr-ezra-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
    justify-content: center;
}
.mr-ezra-chip {
    appearance: none;
    border: 1px solid rgba(255, 107, 53, 0.35);
    background: rgba(255, 245, 240, 0.92);
    color: #c2410c;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    max-width: 100%;
    text-align: left;
    white-space: normal;
}
.mr-ezra-chip:hover {
    background: rgba(255, 107, 53, 0.18);
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.18);
}
.mr-ezra-chip:active {
    transform: translateY(1px);
}
@media (max-width: 480px) {
    .mr-ezra-suggestions { gap: 6px; margin: 10px 0 2px; }
    .mr-ezra-chip { font-size: 11px; padding: 6px 10px; }
}
