/* ══════════════════════════════════════════════════════════
   CGSP Widget — Minimized Trigger Icon (shown after close)
   ══════════════════════════════════════════════════════════ */

.cgsp-widget-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--cgsp-user-bubble, #5C4033);
    color: #FFF;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    display: none;                /* hidden by default */
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cgsp-widget-trigger.cgsp-visible {
    display: flex;
}

.cgsp-widget-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

.cgsp-widget-trigger-icon {
    font-size: 26px;
    line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   CGSP Widget — Collapsed Card (default visible state)
   ══════════════════════════════════════════════════════════ */

.cgsp-widget-collapsed {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 380px;
    background: var(--cgsp-bg, #FFFFFF);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    padding: 12px;
    font-family: var(--cgsp-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cgsp-widget-collapsed.cgsp-hidden {
    display: none;
}

/* ── Intro block (cream) — dismissible on its own ────────── */
.cgsp-widget-intro {
    position: relative;
    background: var(--cgsp-surface, #F5F0E8);
    border-radius: 8px;
    padding: 8px 8px 8px 32px;
    margin-bottom: 14px;
}

/* Dismiss button (top-left × ) — closes only the intro block */
.cgsp-widget-dismiss {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--cgsp-text, #3B2F24);
    cursor: pointer;
    padding: 0;
    transition: opacity 0.15s;
}

.cgsp-widget-dismiss:hover {
    opacity: 0.6;
}

.cgsp-widget-dismiss svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Intro text */
.cgsp-widget-intro-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
    color: var(--cgsp-text, #3B2F24);
}

/* ── Input row: field + close button (button outside field) ─ */
.cgsp-widget-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The bordered field (fake input + sparkle) */
.cgsp-widget-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cgsp-bg, #FFFFFF);
    border: 1px solid var(--cgsp-border, #D6CCBC);
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cgsp-widget-field:hover {
    border-color: var(--cgsp-text-light, #8B7355);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cgsp-widget-fake-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--cgsp-text-light, #8B7355);
    outline: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

/* AI sparkle icon — bigger + vertically centred */
.cgsp-widget-sparkle-icon {
    display: flex;
    align-items: center;
    color: var(--cgsp-text, #3B2F24);
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

/* Main close button — closes the whole popup */
/* Normal: brown fill + border, white icon */
.cgsp-widget-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--cgsp-brown, #6C594F);
    background: var(--cgsp-brown, #6C594F);
    color: #FFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cgsp-widget-close-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Force stroke rendering (inline SVG attrs get overridden by theme/global CSS) */
.cgsp-widget-dismiss svg path,
.cgsp-widget-close-btn svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Rollover: white fill, brown border + icon */
.cgsp-widget-close-btn:hover {
    background: var(--cgsp-bg, #FFFFFF);
    color: var(--cgsp-brown, #6C594F);
    border-color: var(--cgsp-brown, #6C594F);
}

/* Active: cream fill, taupe border + icon */
.cgsp-widget-close-btn:active {
    background: var(--cgsp-cream, #F6F1EC);
    color: var(--cgsp-taupe, #947D74);
    border-color: var(--cgsp-taupe, #947D74);
}

/* ══════════════════════════════════════════════════════════
   CGSP Widget — Fullscreen Overlay
   ══════════════════════════════════════════════════════════ */

.cgsp-widget-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: var(--cgsp-bg, #FFFFFF);
    display: none;
    flex-direction: column;
    font-family: var(--cgsp-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.cgsp-widget-fullscreen.cgsp-open {
    display: flex;
    animation: cgsp-fs-fadein 0.25s ease;
}

@keyframes cgsp-fs-fadein {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Top bar ───────────────────────────────────────────── */

.cgsp-fs-topbar {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--cgsp-border, #D6CCBC);
    flex-shrink: 0;
    gap: 12px;
}

.cgsp-fs-back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cgsp-text, #3B2F24);
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.cgsp-fs-back:hover:not(:disabled) {
    background: var(--cgsp-surface, #F5F0E8);
}

.cgsp-fs-back:disabled {
    cursor: not-allowed;
    opacity: 0.35;
    pointer-events: none;
}

.cgsp-fs-back path {
    fill: none;
    stroke: currentColor;
    stroke-width: inherit;
}

.cgsp-fs-brand {
    flex: 1;
    font-weight: 700;
    font-size: 17px;
    color: var(--cgsp-text, #3B2F24);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cgsp-fs-beta {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--cgsp-accent, #9B3B2B);
    border: 1px solid var(--cgsp-accent, #9B3B2B);
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: middle;
}

.cgsp-fs-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cgsp-text, #3B2F24);
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.cgsp-fs-close:hover {
    background: var(--cgsp-surface, #F5F0E8);
}

.cgsp-fs-close path {
    fill: none;
    stroke: currentColor;
    stroke-width: inherit;
}

/* ── Body ──────────────────────────────────────────────── */

.cgsp-fs-body {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.cgsp-fs-body .cgsp-chat-fullpage {
    flex: 1;
    min-height: 0;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
}

.cgsp-fs-body .cgsp-chat-messages {
    min-height: 100px;
}

.cgsp-fs-body .cgsp-chat-input-bar {
    position: sticky;
    bottom: 0;
    background: var(--cgsp-bg, #FFFFFF);
    padding: 12px 0 8px;
}

/* ══════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════ */

@media (max-width: 991px) {
    .cgsp-fs-body .cgsp-chat-fullpage {
        width: auto;
    }
}

@media (max-width: 480px) {
    .cgsp-widget-collapsed {
        right: 12px;
        left: 12px;
        bottom: 16px;
        width: auto;
    }

    .cgsp-fs-topbar {
        padding: 10px 14px;
    }

    .cgsp-fs-body .cgsp-chat-fullpage {
        padding: 0 14px;
    }
}
