/**
 * Chat widget styles.
 *
 * Standalone rather than Tailwind utilities: css/styles.css is a compiled
 * Tailwind build, so any class not already present in the site's markup would
 * have been purged and would not exist at runtime.
 *
 * Palette matches the site: --brand navy and the #00d2ff accent.
 */

.ip-chat,
.ip-chat * {
    box-sizing: border-box;
}

.ip-chat {
    --ip-navy: #0f172a;
    --ip-accent: #00d2ff;
    --ip-line: #e2e8f0;
    --ip-muted: #64748b;
    font-family: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
}

/* ---------- launcher ---------- */
.ip-chat-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 12px 16px;
    border: none;
    border-radius: 999px;
    background: var(--ip-navy);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .28);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.ip-chat-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, .34);
}

.ip-chat-fab svg {
    color: var(--ip-accent);
    flex-shrink: 0;
}

.ip-chat-fab[hidden] {
    display: none;
}

/* ---------- panel ---------- */
.ip-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 48px);
    border: 1px solid var(--ip-line);
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .26);
    transform-origin: bottom right;
    animation: ip-chat-in .18s ease-out;
}

.ip-chat-panel[hidden] {
    display: none;
}

@keyframes ip-chat-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ip-chat-panel { animation: none; }
    .ip-chat-fab   { transition: none; }
}

/* ---------- header ---------- */
.ip-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--ip-navy);
    color: #fff;
}

.ip-chat-header img {
    height: 30px;
    width: auto;
    flex-shrink: 0;
}

.ip-chat-header-text {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.ip-chat-title {
    font-size: 14px;
    font-weight: 600;
}

.ip-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #94a3b8;
}

.ip-chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
}

.ip-chat-new {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 5px 9px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: #cbd5e1;
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.ip-chat-new:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}
/* On narrow panels the icon carries the meaning on its own. */
@media (max-width: 380px) {
    .ip-chat-new span { display: none; }
    .ip-chat-new { padding: 5px 7px; }
}

.ip-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: #cbd5e1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.ip-chat-close:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

/* ---------- messages ---------- */
.ip-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ip-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ip-chat-msg-bot {
    align-self: flex-start;
    border: 1px solid var(--ip-line);
    border-bottom-left-radius: 4px;
    background: #fff;
    color: #1e293b;
}

.ip-chat-msg-user {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    background: var(--ip-navy);
    color: #fff;
}

.ip-chat-msg-error {
    align-self: flex-start;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.ip-chat-msg a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ip-chat-msg-user a {
    color: var(--ip-accent);
}

/* typing indicator */
.ip-chat-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px;
}

.ip-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
    animation: ip-chat-bounce 1.2s infinite ease-in-out;
}

.ip-chat-typing span:nth-child(2) { animation-delay: .15s; }
.ip-chat-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes ip-chat-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: .5; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---------- suggested prompts ---------- */
.ip-chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px 12px;
    background: #f8fafc;
}

.ip-chat-chips[hidden] {
    display: none;
}

.ip-chat-chip {
    padding: 7px 12px;
    border: 1px solid var(--ip-line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.ip-chat-chip:hover {
    border-color: var(--ip-accent);
    color: var(--ip-navy);
}

/* ---------- composer ---------- */
.ip-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--ip-line);
    background: #fff;
}

.ip-chat-input {
    flex: 1;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--ip-line);
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: #1e293b;
    resize: none;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ip-chat-input:focus {
    border-color: var(--ip-accent);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, .16);
}

.ip-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background: var(--ip-navy);
    color: #fff;
    cursor: pointer;
    transition: opacity .15s ease;
}

.ip-chat-send:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.ip-chat-footnote {
    padding: 0 12px 10px;
    background: #fff;
    color: var(--ip-muted);
    font-size: 10.5px;
    text-align: center;
}

/* ---------- mobile ---------- */
@media (max-width: 480px) {
    .ip-chat-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border: none;
        border-radius: 0;
    }

    .ip-chat-fab {
        right: 16px;
        bottom: 16px;
        padding: 12px 16px;
    }
}
