/* ════════════════════════════════════════════════════════════════════ */
/*  COLE SITE-WIDE WIDGET — VIT-398 + VIT-403                            */
/*  Layered on vithropic.css. Loaded on every page except /start.       */
/* ════════════════════════════════════════════════════════════════════ */
.cole-widget { position: fixed; z-index: 9000; }

/* ── COLLAPSED BUBBLE ────────────────────────────────────────────── */
.cole-widget-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--vith-navy);
    color: var(--vith-gold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 9001;
}
.cole-widget-bubble:hover { transform: scale(1.04); }
.cole-widget-bubble:focus-visible { outline: 2px solid var(--vith-gold); outline-offset: 3px; }
.cole-widget-bubble-mark { display: flex; }
.cole-widget-bubble-mark .cole-mark { width: 30px; height: 30px; }

/* Active dot — top-right of bubble */
.cole-widget-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--vith-gold);
    border: 2px solid var(--vith-navy);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.cole-widget-dot-on { opacity: 1; }
.cole-widget-dot-pulse { animation: cole-dot-pulse 1.6s ease-in-out infinite; }
@keyframes cole-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.35); opacity: 0.55; }
}

/* Hide the bubble while the panel is open */
.cole-widget.cole-open .cole-widget-bubble {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

/* ── EXPANDED PANEL ──────────────────────────────────────────────── */
.cole-widget-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 48px);
    background: var(--vith-white);
    border: 0.5px solid var(--vith-cream-warm);
    border-radius: var(--radius-feature);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 9001;
}
.cole-widget.cole-open .cole-widget-panel {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    visibility: visible;
}

/* ── HEADER ──────────────────────────────────────────────────────── */
.cole-widget-header {
    flex: 0 0 auto;
    height: 56px;
    background: var(--vith-navy);
    border-bottom: 0.5px solid var(--vith-navy-mid);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.cole-widget-header-id { display: flex; align-items: center; gap: 8px; }
.cole-widget-header-mark { display: flex; color: var(--vith-gold); }
.cole-widget-header-mark .cole-mark { width: 20px; height: 20px; }
.cole-widget-header-name {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 13px;
    color: var(--vith-cream);
}
.cole-widget-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--vith-cream);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.15s ease;
}
.cole-widget-close svg { width: 20px; height: 20px; }
.cole-widget-close:hover { color: var(--vith-gold); }

/* ── CONVERSATION ────────────────────────────────────────────────── */
.cole-widget-conversation {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cole-w-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: cole-fade-in 0.15s ease;
}
@keyframes cole-fade-in { from { opacity: 0; } to { opacity: 1; } }
.cole-w-msg-cole { align-self: flex-start; align-items: flex-start; }
.cole-w-msg-user { align-self: flex-end; align-items: flex-end; }

.cole-w-eyebrow { color: var(--vith-gold); margin-bottom: 4px; padding-left: 2px; }

.cole-w-bubble {
    border-radius: var(--radius-card);
    padding: 10px 14px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.cole-w-msg-cole .cole-w-bubble {
    background: var(--vith-cream);
    color: var(--vith-navy);
    border-bottom-left-radius: 2px;
}
.cole-w-msg-user .cole-w-bubble {
    background: var(--vith-navy);
    color: var(--vith-cream);
    border-bottom-right-radius: 2px;
}
.cole-w-time { margin-top: 4px; padding: 0 2px; font-size: 11px; }
.cole-w-typing { padding: 12px 14px; }

.cole-w-error {
    align-self: center;
    max-width: 90%;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
    color: var(--error);
}

/* ── INPUT AREA ──────────────────────────────────────────────────── */
.cole-widget-input-area {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-top: 0.5px solid var(--vith-cream-warm);
}
.cole-widget-input {
    flex: 1 1 auto;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    border: none;
    background: transparent;
    border-radius: 4px;
    padding: 8px 4px;
}
.cole-widget-input:focus { outline: none; box-shadow: none; border-color: transparent; }
.cole-widget-send {
    flex: 0 0 auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--vith-gold);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.cole-widget-send svg { width: 22px; height: 22px; }
.cole-widget-send:disabled { opacity: 0.4; cursor: default; }

/* ── TRUST STRIP ─────────────────────────────────────────────────── */
.cole-widget-trust {
    flex: 0 0 auto;
    padding: 0 16px 14px;
    font-family: var(--sans);
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
    text-align: center;
}

.cole-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── MOBILE TAKEOVER (full-width minus gutter, full-height minus top) ─ */
@media (max-width: 640px) {
    .cole-widget-panel {
        left: 8px;
        right: 8px;
        top: 16px;
        bottom: 8px;
        width: auto;
        height: auto;
        max-height: none;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cole-widget-bubble,
    .cole-widget-panel,
    .cole-w-msg { transition: none; animation: none; }
    .cole-widget-dot-pulse { animation: none; }
}
