/* Sinaverse Agent live chat widget */
.clara-chat {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9995;
    font-family: 'Inter', system-ui, sans-serif;
}

.clara-chat__launcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem 0.65rem 0.75rem;
    background: linear-gradient(135deg, #1C39BB 0%, #153A7A 50%, #00A693 100%);
    border: none;
    border-radius: 9999px;
    box-shadow: 0 8px 28px rgba(28, 57, 187, 0.35);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    color: #fff;
    z-index: 1;
}

.clara-chat__launcher::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #1C39BB 0%, #00A693 100%);
    z-index: -1;
    animation: clara-launcher-ring 2.2s ease-out infinite;
    pointer-events: none;
}

@keyframes clara-launcher-ring {
    0% {
        transform: scale(1);
        opacity: 0.55;
    }
    75%, 100% {
        transform: scale(1.18);
        opacity: 0;
    }
}

.clara-chat__launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(28, 57, 187, 0.45);
    filter: brightness(1.05);
}

.clara-chat__launcher-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.clara-chat__launcher-avatar svg {
    width: 1.35rem;
    height: 1.35rem;
}

.clara-chat__launcher-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    text-align: left;
}

.clara-chat__launcher-label {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: #fff;
}

.clara-chat__launcher-hint {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.9);
    animation: clara-launcher-text-pulse 2s ease-in-out infinite;
}

@keyframes clara-launcher-text-pulse {
    0%, 100% {
        opacity: 0.45;
    }
    50% {
        opacity: 1;
    }
}

.clara-chat.is-open .clara-chat__launcher {
    display: none;
}

/* Panel */
.clara-chat__panel {
    display: none;
    flex-direction: column;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(32rem, calc(100vh - 6rem));
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transform-origin: bottom right;
    animation: clara-chat-fly-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.clara-chat.is-open .clara-chat__panel {
    display: flex;
}

@keyframes clara-chat-fly-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.clara-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0.85rem 0.65rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.clara-chat__profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.clara-chat__meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.clara-chat__name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.clara-chat__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(145deg, #1C39BB 0%, #153A7A 55%, #00A693 100%);
    border: 2px solid rgba(28, 57, 187, 0.15);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.clara-chat__speak {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.clara-chat__speak svg {
    width: 0.9rem;
    height: 0.9rem;
    color: #64748b;
}

.clara-chat__speak:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.clara-chat__close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.clara-chat__close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.clara-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 0.75rem;
    min-height: 0;
}

.clara-chat__intro {
    font-size: 0.875rem;
    line-height: 1.55;
    color: #334155;
    margin: 0 0 1rem;
}

.clara-chat__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.clara-chat__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    text-align: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.clara-chat__action-btn:hover {
    background: #e8ecf8;
    border-color: #c7d2fe;
    color: #1C39BB;
}

.clara-chat__action-btn--whatsapp {
    background: #e8f8ef;
    border-color: #bbf7d0;
    color: #128c7e;
}

.clara-chat__action-btn--whatsapp:hover {
    background: #25d366;
    border-color: #25d366;
    color: #fff;
}

.clara-chat__thread {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.clara-chat__msg {
    max-width: 92%;
    padding: 0.6rem 0.85rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    border-radius: 12px;
}

.clara-chat__msg--bot {
    align-self: flex-start;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.clara-chat__msg--user {
    align-self: flex-end;
    background: #1C39BB;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.clara-chat__msg--admin {
    align-self: flex-start;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #bbf7d0;
    border-bottom-left-radius: 4px;
}

.clara-chat__footer {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.75rem 0.85rem;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.clara-chat__input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.clara-chat__input:focus {
    border-color: #1C39BB;
    box-shadow: 0 0 0 3px rgba(28, 57, 187, 0.12);
}

.clara-chat__input::placeholder {
    color: #94a3b8;
}

.clara-chat__mic,
.clara-chat__send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.clara-chat__mic:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.clara-chat__mic svg,
.clara-chat__send svg {
    width: 1.15rem;
    height: 1.15rem;
}

.clara-chat__send {
    color: #1C39BB;
}

.clara-chat__send:hover {
    background: #e8ecf8;
    color: #153A7A;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 480px) {
    .clara-chat {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .clara-chat__panel {
        width: calc(100vw - 1.5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .clara-chat__panel,
    .clara-chat__launcher::before,
    .clara-chat__launcher-hint {
        animation: none;
    }
    .clara-chat__launcher-hint {
        opacity: 0.85;
    }
}
