/* Explain: Styles for the Jewish chatbot widget and panel. */
/* ---------- Jewish robot chat assistant ---------- */

.robi-widget {
    position: fixed;
    inset-inline-end: 1rem;
    bottom: 1rem;
    z-index: 95;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
}

.robi-toggle {
    position: relative;
    display: grid;
    place-items: center;
    width: 3.75rem;
    height: 3.75rem;
    padding: 0.35rem;
    border-radius: 9999px;
    border: 1px solid var(--primary-color);
    background: linear-gradient(180deg, var(--surface-2), var(--surface-color));
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.robi-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 38px rgba(201, 162, 39, 0.35);
}

.robi-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

.robi-toggle::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 9999px;
    border: 1px solid var(--gold-line);
    pointer-events: none;
    animation: robi-halo 2.6s ease-in-out infinite;
}

@keyframes robi-halo {
    0%, 100% { transform: scale(1); opacity: 0.45; }
    50% { transform: scale(1.08); opacity: 0.9; }
}

.robi-avatar,
.robi-head-avatar,
.robi-msg-avatar {
    display: block;
    flex: 0 0 auto;
}

.robi-avatar {
    width: 100%;
    height: 100%;
}

.robi-head-avatar {
    width: 2.6rem;
    height: 2.6rem;
}

.robi-msg-avatar {
    width: 1.9rem;
    height: 1.9rem;
}

/* ---------- Panel ---------- */
.robi-panel {
    display: none;
    flex-direction: column;
    width: min(24rem, calc(100vw - 2rem));
    max-height: min(76vh, 35rem);
    border: 1px solid var(--border-color);
    border-radius: 1.15rem;
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.robi-panel.is-open {
    display: flex;
}

.robi-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--surface-2), var(--surface-color));
}

.robi-head-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.robi-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-color);
}

.robi-sub {
    font-size: 0.76rem;
    color: var(--secondary-color);
}

.robi-close {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    flex: 0 0 auto;
    margin-inline-start: auto;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.robi-close:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.robi-close:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ---------- Messages ---------- */
.robi-messages {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1 1 auto;
    min-height: 12rem;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.robi-msg {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
}

.robi-msg.is-user {
    flex-direction: row-reverse;
}

.robi-bubble {
    max-width: 84%;
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.92rem;
    line-height: 1.62;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.robi-msg.is-bot .robi-bubble {
    border-end-start-radius: 0.3rem;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.robi-msg.is-user .robi-bubble {
    border-end-end-radius: 0.3rem;
    background: var(--primary-color);
    color: #12100a;
    font-weight: 500;
}

.robi-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.robi-typing span {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 9999px;
    background: var(--text-muted);
    animation: robi-dot 1.2s ease-in-out infinite;
}

.robi-typing span:nth-child(2) { animation-delay: 0.15s; }
.robi-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes robi-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-3px); opacity: 1; }
}

/* ---------- Suggested questions ---------- */
.robi-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.9rem 0.6rem;
}

.robi-suggest[hidden] {
    display: none;
}

.robi-chip {
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.robi-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.robi-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ---------- Input ---------- */
.robi-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-2);
}

.robi-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color 0.25s ease;
}

.robi-input::placeholder {
    color: #6f6c64;
}

.robi-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}

.robi-send {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    border: 0;
    border-radius: 9999px;
    background: var(--primary-color);
    color: #12100a;
    cursor: pointer;
    transition: background 0.25s ease;
}

.robi-send:hover {
    background: var(--primary-hover);
}

.robi-send:disabled {
    opacity: 0.5;
    cursor: default;
}

.robi-send:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .robi-panel {
        width: calc(100vw - 2rem);
        max-height: 72vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .robi-toggle,
    .robi-close,
    .robi-chip,
    .robi-send,
    .robi-input {
        transition: none;
        transform: none;
    }

    .robi-toggle::after,
    .robi-typing span {
        animation: none;
    }
}