/* HMS AI Voice Assistant modal */

.hms-voice-trigger {
    display: inline-flex;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #0f766e;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(99, 102, 241, 0.1));
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hms-voice-trigger:hover,
.hms-voice-trigger:focus {
    color: #115e59;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.2), rgba(99, 102, 241, 0.16));
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.hms-voice-trigger.is-open {
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #6366f1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.45);
}

.hms-voice-trigger.is-listening {
    background: linear-gradient(135deg, #dc2626, #f97316);
    animation: hms-ai-pulse 1.2s ease-in-out infinite;
}

.hms-voice-trigger .bi {
    font-size: 1.1rem;
}

/* Dark top bar (mobile) — matches sidebar toggle sizing */
.hms-voice-trigger--topbar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.65rem;
    background: none;
    color: #a7f3d0;
}

.hms-voice-trigger--topbar:hover,
.hms-voice-trigger--topbar:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: none;
}

.hms-voice-trigger--topbar.is-open {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #0f766e, #6366f1);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.45);
}

.hms-voice-trigger--topbar.is-listening {
    border-color: transparent;
}

.admin-brand-toolbar {
    flex-shrink: 0;
}

/* Desktop default: header slot visible, top bar slot hidden */
.dashboard-header-voice-slot {
    display: inline-flex;
}

.admin-brand-voice-slot {
    display: none;
}

@media (max-width: 767.98px) {
    /* Hide header/avatar voice; show brand toolbar slot beside hamburger */
    .admin-shell .admin-main .admin-header .dashboard-header-voice-slot,
    .admin-shell .admin-main .admin-header .dashboard-header-toolbar .hms-voice-trigger {
        display: none !important;
    }

    .admin-shell .admin-sidebar .admin-brand-voice-slot,
    .admin-shell .admin-sidebar .admin-brand-toolbar .hms-voice-trigger--topbar {
        display: inline-flex !important;
    }
}

@media (min-width: 768px) {
    .admin-shell .admin-sidebar .admin-brand-voice-slot {
        display: none !important;
    }

    .admin-shell .admin-main .admin-header .dashboard-header-voice-slot {
        display: inline-flex !important;
    }
}

/* Modal shell */
.hms-ai-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5.5rem 1rem 1rem;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hms-ai-modal.is-visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.hms-ai-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.hms-ai-modal__dialog {
    position: relative;
    width: min(560px, calc(100vw - 1.5rem));
    max-width: 100%;
    max-height: min(92vh, 680px);
    display: flex;
    flex-direction: column;
    border-radius: 1.25rem;
    overflow: hidden;
    background: #fff;
    box-shadow:
        0 25px 50px -12px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(99, 102, 241, 0.12),
        0 0 40px rgba(15, 118, 110, 0.15);
    transform: translateY(-12px) scale(0.96);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hms-ai-modal.is-visible .hms-ai-modal__dialog {
    transform: translateY(0) scale(1);
}

.hms-ai-modal__dialog::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, #0f766e, #6366f1, #a855f7);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.hms-ai-modal__header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.1rem 1.15rem 1rem;
    background: linear-gradient(135deg, #0f172a 0%, #134e4a 55%, #312e81 100%);
    color: #fff;
}

.hms-ai-modal__header-text {
    flex: 1;
    min-width: 0;
}

.hms-ai-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.68rem;
    opacity: 0.9;
}

.hms-ai-status__dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

/* Orb with waveform bars */
.hms-ai-orb {
    position: relative;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.5);
    animation: hms-ai-orb-glow 2.5s ease-in-out infinite;
}

.hms-ai-orb::after {
    content: "";
    position: absolute;
    inset: -50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 255, 255, 0.35) 60deg,
        transparent 120deg
    );
    opacity: 0;
    pointer-events: none;
}

.hms-ai-orb .bi {
    font-size: 1.25rem;
    color: #c4b5fd;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.hms-ai-orb__activity {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.hms-ai-orb__ring {
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    border: 1.5px solid rgba(196, 181, 253, 0.75);
    opacity: 0;
    transform: scale(0.45);
}

.hms-ai-orb__ring--1 {
    animation: hms-ai-ring-pulse 2.4s ease-out infinite;
}

.hms-ai-orb__ring--2 {
    animation: hms-ai-ring-pulse 2.4s ease-out 0.8s infinite;
}

.hms-ai-orb__ring--3 {
    animation: hms-ai-ring-pulse 2.4s ease-out 1.6s infinite;
}

.hms-ai-orb.is-active .hms-ai-orb__activity {
    opacity: 1;
}

.hms-ai-orb.is-active .bi {
    opacity: 0;
    transform: scale(0.6);
}

.hms-ai-orb.is-active .hms-ai-orb__ring {
    animation-duration: 1.8s;
}

.hms-ai-orb.is-listening {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.35), rgba(249, 115, 22, 0.25));
    animation: hms-ai-orb-glow-listen 1.2s ease-in-out infinite;
}

.hms-ai-orb.is-listening .hms-ai-orb__ring {
    border-color: rgba(254, 202, 202, 0.9);
}

.hms-ai-orb.is-thinking {
    animation: hms-ai-orb-shimmer 1.6s ease-in-out infinite;
}

.hms-ai-orb.is-thinking::after {
    opacity: 1;
    animation: hms-ai-orb-shimmer-rotate 1.6s linear infinite;
}

.hms-ai-modal__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    letter-spacing: 0.02em;
}

.hms-ai-modal__subtitle {
    font-size: 0.78rem;
    margin: 0;
    opacity: 0.85;
    line-height: 1.35;
}

.hms-ai-modal__close {
    margin-left: auto;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hms-ai-modal__close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.hms-ai-modal__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.85rem;
    min-height: 0;
    background: #fff;
    overflow: hidden;
}

/* Chat thread */
.hms-ai-chat {
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
}

.hms-ai-chat__messages {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: min(42vh, 18rem);
    min-height: 0;
    padding: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.hms-ai-chat__messages.hms-ai-chat__messages--expanded {
    max-height: min(48vh, 22rem);
}

.hms-ai-chat__messages::-webkit-scrollbar {
    width: 5px;
}

.hms-ai-chat__messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.hms-ai-bubble-row {
    display: flex;
    width: 100%;
}

.hms-ai-bubble-row--user {
    justify-content: flex-end;
}

.hms-ai-bubble-row--assistant {
    justify-content: flex-start;
}

.hms-ai-bubble {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    max-width: 92%;
}

.hms-ai-bubble-row--assistant:has(.hms-ai-bubble--greeting) .hms-ai-bubble {
    max-width: 100%;
    width: 100%;
}

.hms-ai-bubble--assistant.hms-ai-bubble--greeting .hms-ai-bubble__body {
    flex: 1;
    min-width: 0;
}

.hms-ai-bubble--user {
    flex-direction: row-reverse;
}

.hms-ai-bubble--user .hms-ai-bubble__text {
    margin: 0;
    padding: 0.55rem 0.8rem;
    border-radius: 1rem 1rem 0.2rem 1rem;
    background: linear-gradient(135deg, #0f766e, #6366f1);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1.4;
}

.hms-ai-bubble--assistant .hms-ai-bubble__body {
    padding: 0.55rem 0.8rem;
    border-radius: 1rem 1rem 1rem 0.2rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #334155;
}

.hms-ai-bubble--assistant.hms-ai-bubble--greeting .hms-ai-bubble__body {
    background: linear-gradient(135deg, #eef2ff, #f0fdfa);
    border-color: #c7d2fe;
}

.hms-ai-bubble--assistant.hms-ai-bubble--success .hms-ai-bubble__body {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.hms-ai-bubble--assistant.hms-ai-bubble--warning .hms-ai-bubble__body {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.hms-ai-bubble--assistant.hms-ai-bubble--danger .hms-ai-bubble__body {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.hms-ai-bubble--assistant.hms-ai-bubble--info .hms-ai-bubble__body,
.hms-ai-bubble--assistant.hms-ai-bubble--secondary .hms-ai-bubble__body {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.hms-ai-bubble--thinking .hms-ai-bubble__body {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-color: #c7d2fe;
}

.hms-ai-bubble__text {
    margin: 0;
}

.hms-ai-bubble__text--thinking {
    color: #6366f1;
    font-weight: 500;
}

.hms-ai-thinking-dots::after {
    content: "";
    animation: hms-ai-thinking-dots 1.4s steps(4, end) infinite;
}

.hms-ai-bubble__avatar {
    flex-shrink: 0;
}

.hms-ai-bubble__avatar-orb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #134e4a, #312e81);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

.hms-ai-bubble__avatar-orb .bi {
    font-size: 0.75rem;
    color: #c4b5fd;
}

.hms-ai-bubble--thinking .hms-ai-bubble__avatar-orb {
    animation: hms-ai-orb-glow 1.6s ease-in-out infinite;
}

.hms-ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.hms-ai-examples {
    flex-shrink: 0;
    margin: 0;
    padding-top: 0.15rem;
}

.hms-ai-examples__summary {
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    user-select: none;
    list-style: none;
}

.hms-ai-examples__summary::-webkit-details-marker {
    display: none;
}

.hms-ai-examples__summary::before {
    content: "▾";
    display: inline-block;
    margin-right: 0.35rem;
    color: #6366f1;
    transition: transform 0.2s ease;
}

.hms-ai-examples:not([open]) .hms-ai-examples__summary::before {
    transform: rotate(-90deg);
}

.hms-ai-examples--chat-started .hms-ai-examples__summary {
    color: #6366f1;
}

.hms-ai-examples__content {
    margin-top: 0.35rem;
}

.hms-ai-examples__scroll {
    max-height: 10.5rem;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.hms-ai-examples__label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin: 0.55rem 0 0.25rem;
}

.hms-ai-examples__label:first-child {
    margin-top: 0;
}

.hms-ai-examples__more {
    margin-top: 0.65rem;
    font-size: 0.78rem;
}

.hms-ai-examples__more summary {
    cursor: pointer;
    color: #6366f1;
    font-weight: 600;
    user-select: none;
}

.hms-ai-examples__more summary:hover {
    color: #4f46e5;
}

.hms-ai-example-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    max-height: 8.5rem;
    overflow-y: auto;
}

.hms-ai-example-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.15rem;
    border-radius: 0.45rem;
    font-size: 0.78rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.hms-ai-example-item:hover {
    background: #eef2ff;
    color: #4338ca;
}

.hms-ai-chip {
    border: 1px solid #c7d2fe;
    background: linear-gradient(135deg, #eef2ff, #f0fdfa);
    color: #4338ca;
    font-size: 0.72rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.hms-ai-chip:hover {
    background: linear-gradient(135deg, #e0e7ff, #ccfbf1);
    transform: translateY(-1px);
}

.hms-ai-starters {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.hms-ai-starter {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #c7d2fe;
    background: #fff;
    color: #4338ca;
    font-size: 0.78rem;
    padding: 0.45rem 0.65rem;
    border-radius: 0.55rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.hms-ai-starter:hover {
    background: #eef2ff;
    border-color: #a5b4fc;
}

.hms-ai-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.55rem;
}

.hms-ai-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: #0f766e;
    background: #fff;
    border: 1px solid #99f6e4;
    transition: background 0.15s ease, color 0.15s ease;
}

.hms-ai-action-btn:hover {
    background: #ccfbf1;
    color: #115e59;
}

.hms-ai-composer {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 0.6rem;
    border-top: 1px solid #e8edf3;
}

.hms-ai-input-row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    margin-top: 0;
}

.hms-ai-input-row .form-control {
    border-radius: 0.65rem;
    border-color: #cbd5e1;
    font-size: 0.875rem;
    flex: 1 1 auto;
    min-width: 0;
}

.hms-ai-input-row .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.hms-ai-send-btn {
    border: 0;
    border-radius: 0.65rem;
    padding: 0 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #6366f1);
    white-space: nowrap;
}

.hms-ai-send-btn:hover {
    background: linear-gradient(135deg, #115e59, #4f46e5);
    color: #fff;
}

.hms-ai-mic-slot {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.hms-ai-mic-slot.is-recording {
    animation: hms-ai-pulse 1.2s ease-in-out infinite;
}

.hms-ai-recording-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.hms-ai-recording-btn {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 50%;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hms-ai-recording-btn .bi {
    font-size: 1.1rem;
}

.hms-ai-recording-btn--cancel {
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}

.hms-ai-recording-btn--cancel:hover {
    background: #e2e8f0;
    transform: scale(1.04);
}

.hms-ai-recording-btn--confirm {
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #6366f1);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
}

.hms-ai-recording-btn--confirm:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.38);
}

.hms-ai-mic-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #6366f1);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hms-ai-mic-btn--inline {
    width: 2.65rem;
    height: 2.65rem;
    box-shadow: none;
}

.hms-ai-mic-btn--inline .bi {
    font-size: 1.1rem;
}

.hms-ai-mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
}

.hms-ai-mic-btn .bi {
    font-size: 1.35rem;
}

.hms-ai-mic-label {
    display: block;
    text-align: center;
    font-size: 0.68rem;
    color: #94a3b8;
    margin: 0.3rem 0 0;
}

.hms-ai-confirm-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.hms-ai-confirm-row .btn {
    flex: 1 1 0;
}

.hms-ai-note {
    font-size: 0.72rem;
    color: #94a3b8;
    margin: 0.75rem 0 0;
    text-align: center;
}

body.hms-ai-modal-open {
    overflow: hidden;
}

@keyframes hms-ai-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@keyframes hms-ai-orb-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 32px rgba(167, 139, 250, 0.65); }
}

@keyframes hms-ai-orb-glow-listen {
    0%, 100% { box-shadow: 0 0 18px rgba(249, 115, 22, 0.45); }
    50% { box-shadow: 0 0 30px rgba(220, 38, 38, 0.65); }
}

@keyframes hms-ai-orb-shimmer {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.45);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 36px rgba(167, 139, 250, 0.75);
        transform: scale(1.04);
    }
}

@keyframes hms-ai-orb-shimmer-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes hms-ai-ring-pulse {
    0% {
        transform: scale(0.45);
        opacity: 0.85;
    }
    70%, 100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

@keyframes hms-ai-thinking-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75%, 100% { content: "..."; }
}

/* Header trigger — profile row alignment on mobile */
.dashboard-header-toolbar {
    flex-shrink: 0;
}
