/* ================================================================
   AI Site Navigator Pro — Inline Embedded Widget CSS  v3.0
   Renders as a normal block element in page flow.
   No fixed/absolute positioning. No launcher button.
   ================================================================ */

:root {
    --aisnav-accent:      #6366f1;
    --aisnav-accent-dark: #4f46e5;
    --aisnav-bg:          #ffffff;
    --aisnav-surface:     #f8f9fb;
    --aisnav-border:      #e5e7eb;
    --aisnav-text:        #111827;
    --aisnav-muted:       #6b7280;
    --aisnav-bot-bg:      #f3f4f6;
    --aisnav-radius:      14px;
    --aisnav-shadow:      0 2px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
}

/* ── Root container ──────────────────────────────────────────── */
#aisnav-root {
    width: 100%;
    min-width: 280px;
    max-width: 680px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--aisnav-text);
    box-sizing: border-box;
}

/* ── Panel — plain block, no fixed/absolute ──────────────────── */
#aisnav-panel {
    display: flex;
    flex-direction: column;
    background: var(--aisnav-bg);
    border: 1px solid var(--aisnav-border);
    border-radius: var(--aisnav-radius);
    box-shadow: var(--aisnav-shadow);
    overflow: hidden;
    height: 520px;
    max-height: 80vh;
}

/* ── Header ──────────────────────────────────────────────────── */
#aisnav-header {
    background: linear-gradient(135deg, var(--aisnav-accent) 0%, var(--aisnav-accent-dark) 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
#aisnav-header::after {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='15' fill='none' stroke='rgba(255,255,255,.06)' stroke-width='1'/%3E%3C/svg%3E") repeat;
    pointer-events: none;
}
.aisnav-header-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.3);
}
#aisnav-header-info { flex: 1; min-width: 0; }
#aisnav-header-title {
    font-weight: 700; font-size: 15px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#aisnav-header-status {
    font-size: 11px; opacity: .75; display: flex; align-items: center; gap: 4px;
}
.aisnav-status-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
    animation: aisnav-pulse 2s infinite;
}
@keyframes aisnav-pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.6; transform:scale(1.3); }
}
.aisnav-header-actions { display: flex; gap: 4px; }
.aisnav-header-btn {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
    font-size: 13px; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    touch-action: manipulation;
}
.aisnav-header-btn:hover { background: rgba(255,255,255,.28); }

/* ── Messages ────────────────────────────────────────────────── */
#aisnav-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
#aisnav-messages::-webkit-scrollbar { width: 4px; }
#aisnav-messages::-webkit-scrollbar-track { background: transparent; }
#aisnav-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

.aisnav-msg {
    display: flex; gap: 8px; max-width: 88%;
    animation: aisnav-in .2s ease;
}
@keyframes aisnav-in {
    from { opacity:0; transform:translateY(6px); }
    to   { opacity:1; transform:translateY(0); }
}
.aisnav-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.aisnav-msg-bot  { align-self: flex-start; }

.aisnav-bubble {
    padding: 10px 14px; border-radius: 15px;
    line-height: 1.55; word-break: break-word; font-size: 13.5px;
}
.aisnav-msg-user .aisnav-bubble {
    background: var(--aisnav-accent); color: #fff;
    border-bottom-right-radius: 4px;
}
.aisnav-msg-bot .aisnav-bubble {
    background: var(--aisnav-bot-bg); color: var(--aisnav-text);
    border-bottom-left-radius: 4px;
}
.aisnav-bubble a {
    color: var(--aisnav-accent); text-decoration: underline; font-weight: 500;
}
.aisnav-msg-user .aisnav-bubble a { color: rgba(255,255,255,.88); }

/* Typing indicator */
.aisnav-typing .aisnav-bubble {
    display: flex; align-items: center; gap: 5px; padding: 13px 15px;
}
.aisnav-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--aisnav-muted);
    animation: aisnav-bounce 1.2s infinite ease-in-out;
}
.aisnav-dot:nth-child(2) { animation-delay:.2s; }
.aisnav-dot:nth-child(3) { animation-delay:.4s; }
@keyframes aisnav-bounce {
    0%,80%,100% { transform:translateY(0);    opacity:.5; }
    40%          { transform:translateY(-7px); opacity:1; }
}

/* ── Suggestions ─────────────────────────────────────────────── */
#aisnav-suggestions {
    padding: 2px 14px 10px; display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0;
}
.aisnav-chip {
    background: var(--aisnav-surface); border: 1px solid var(--aisnav-border);
    border-radius: 20px; padding: 5px 13px; font-size: 12.5px;
    color: var(--aisnav-text); cursor: pointer; white-space: nowrap;
    transition: all .15s ease; font-family: inherit;
}
.aisnav-chip:hover {
    background: #ede9fe; border-color: var(--aisnav-accent); color: var(--aisnav-accent);
    transform: translateY(-1px);
}

/* ── Input row ───────────────────────────────────────────────── */
#aisnav-input-row {
    padding: 10px 12px;
    border-top: 1px solid var(--aisnav-border);
    display: flex; gap: 8px; align-items: flex-end;
    background: var(--aisnav-bg); flex-shrink: 0;
}
#aisnav-input {
    flex: 1; border: 1.5px solid var(--aisnav-border);
    border-radius: 12px; padding: 9px 12px;
    font-size: max(16px, 13.5px); /* 16px min prevents iOS auto-zoom */
    font-family: inherit; color: var(--aisnav-text);
    background: var(--aisnav-surface); resize: none; outline: none;
    max-height: 100px; line-height: 1.45;
    transition: border-color .15s, background .15s;
    -webkit-appearance: none;
    box-sizing: border-box;
}
#aisnav-input:focus { border-color: var(--aisnav-accent); background: #fff; }
#aisnav-input::placeholder { color: #9ca3af; }

#aisnav-send-btn {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--aisnav-accent); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .15s, transform .1s;
    touch-action: manipulation;
}
#aisnav-send-btn:hover  { background: var(--aisnav-accent-dark); }
#aisnav-send-btn:active { transform: scale(.92); }
#aisnav-send-btn svg    { width: 18px; height: 18px; fill: #fff; }
#aisnav-send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Footer ──────────────────────────────────────────────────── */
#aisnav-footer {
    text-align: center; padding: 6px 0; font-size: 10.5px;
    color: var(--aisnav-muted); border-top: 1px solid var(--aisnav-border);
    flex-shrink: 0;
}
#aisnav-footer a { color: var(--aisnav-muted); text-decoration: none; }
#aisnav-footer a:hover { text-decoration: underline; }
#aisnav-footer.aisnav-hidden { display: none; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 520px) {
    #aisnav-root  { max-width: 100%; }
    #aisnav-panel {
        height: 480px;
        max-height: calc(100svh - 120px - env(safe-area-inset-bottom, 0px));
        border-radius: 10px;
    }
    #aisnav-input-row {
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }
}

