/* ==========================================================================
   Ask CRREM — Chat Widget Styles
   The CRREM glow: Amber Gold, Arctic Blue, Dark Evergreen
   ========================================================================== */

/* ---------- @property for smooth gradient animations ---------- */
@property --clem-blob1-x { syntax: "<percentage>"; inherits: false; initial-value: 25%; }
@property --clem-blob1-y { syntax: "<percentage>"; inherits: false; initial-value: 20%; }
@property --clem-blob2-x { syntax: "<percentage>"; inherits: false; initial-value: 72%; }
@property --clem-blob2-y { syntax: "<percentage>"; inherits: false; initial-value: 75%; }
@property --clem-blob3-x { syntax: "<percentage>"; inherits: false; initial-value: 60%; }
@property --clem-blob3-y { syntax: "<percentage>"; inherits: false; initial-value: 30%; }
@property --clem-sweep-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* ---------- CSS Variables ---------- */
:root {
    --crrem-evergreen: #174A3B;
    --crrem-arctic: #6699AB;
    --crrem-amber: #D6A24A;
    --crrem-fern: #477262;
    --crrem-slate: #213338;
    --crrem-grey-100: #F5F5F0;
    --crrem-grey-200: #E8E8E3;
    --crrem-white: #FFFFFF;

    /* Glow animation colors */
    --glow-1: #D6A24A;
    --glow-2: #6699AB;
    --glow-3: #174A3B;
    --glow-4: #477262;
    --glow-5: #85ADBC;
    --glow-6: #DEB56E;
}

/* ==========================================================================
   THE CRREM GLOW — Apple Intelligence-style animated gradient
   ========================================================================== */

@keyframes crremGlowRotate {
    0%   { --glow-angle: 0deg; }
    100% { --glow-angle: 360deg; }
}

@keyframes crremGlowPulse {
    0%, 100% { opacity: 0.6; filter: blur(8px); }
    50%      { opacity: 1;   filter: blur(12px); }
}

@keyframes crremGlowShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes crremGlowAppear {
    0%   { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* Message entrance: user slides from right, assistant from left */
@keyframes crremMsgUser {
    0%   { opacity: 0; transform: translateX(16px) scale(0.97); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes crremMsgAssistant {
    0%   { opacity: 0; transform: translateX(-12px) scale(0.97); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes crremThinking {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40%           { opacity: 1;   transform: scale(1); }
}

/* Shared glow layer */
.crrem-ask-input-glow,
.crrem-ask-inline-glow,
.crrem-ask-search-glow,
.crrem-ask-header-glow {
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        var(--glow-1),
        var(--glow-2),
        var(--glow-3),
        var(--glow-4),
        var(--glow-5),
        var(--glow-6),
        var(--glow-1)
    );
    background-size: 300% 300%;
    opacity: 0;
    z-index: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

/* Activate glow on focus / active state */
.crrem-ask-input-area:focus-within .crrem-ask-input-glow,
.crrem-ask-search-bar.active .crrem-ask-search-glow,
.crrem-ask-panel[data-active="true"] .crrem-ask-header-glow,
.crrem-ask-inline.active .crrem-ask-inline-glow {
    opacity: 1;
    animation: crremGlowShift 4s ease-in-out infinite;
}

/* Thinking state — pulse */
.crrem-ask-input-area.thinking .crrem-ask-input-glow,
.crrem-ask-search-bar.thinking .crrem-ask-search-glow {
    opacity: 1;
    animation: crremGlowShift 2s ease-in-out infinite, crremGlowPulse 1.5s ease-in-out infinite;
}

/* ==========================================================================
   FLOATING BUBBLE
   ========================================================================== */

.crrem-ask-widget {
    position: fixed;
    z-index: 99998;
    font-family: 'Lexend Deca', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* Start hidden — JS reveals after hero */
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.6s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
}

.crrem-ask-widget.clem-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Fade out when an inline Clem (search bar / inline chat) is visible on screen */
.crrem-ask-widget.clem-inline-nearby {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    pointer-events: none;
}

/* Fade out fully when near footer */
.crrem-ask-widget.clem-fading {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
    pointer-events: none;
}

/* Dark background — reduce nebula/glow on bubble */
.crrem-ask-widget.clem-on-dark .crrem-ask-bubble::before {
    opacity: 0.15 !important;
    filter: blur(30px) !important;
}
.crrem-ask-widget.clem-on-dark .crrem-ask-bubble::after {
    opacity: 0.1 !important;
    filter: blur(30px) !important;
}
/* When open on dark bg, keep panel glow normal */
.crrem-ask-widget.clem-on-dark[data-state="open"] .crrem-ask-bubble::before,
.crrem-ask-widget.clem-on-dark[data-state="open"] .crrem-ask-bubble::after {
    opacity: 0 !important;
}

.crrem-ask-bottom-left {
    bottom: 24px;
    left: 24px;
}

.crrem-ask-bottom-right {
    bottom: 24px;
    right: 24px;
}

/* ── Greeting tooltip: "Ask me anything!" ── */
.crrem-ask-greet {
    position: absolute;
    bottom: calc(100% + 4px);
    left: calc(100% - 8px);
    transform-origin: bottom left;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(102, 153, 171, 0.18);
    border-radius: 14px;
    padding: 10px 16px;
    font-family: 'Lexend Deca', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--crrem-slate, #213338);
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(23, 74, 59, 0.10), 0 1px 4px rgba(0,0,0,0.06);
    pointer-events: auto;
    z-index: 1;
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    animation: clemGreetIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* Caret tail pointing bottom-left toward the avatar */
.crrem-ask-greet::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 8px;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.92);
    border-right: 1px solid rgba(102, 153, 171, 0.18);
    border-bottom: 1px solid rgba(102, 153, 171, 0.18);
    transform: rotate(45deg);
    border-radius: 0 0 3px 0;
}

.crrem-ask-greet.clem-greet-leaving {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
}

/* Dark background variant */
.crrem-ask-widget.clem-on-dark .crrem-ask-greet {
    background: rgba(33, 51, 56, 0.88);
    border-color: rgba(102, 153, 171, 0.25);
    color: var(--crrem-grey-100, #F5F5F0);
}
.crrem-ask-widget.clem-on-dark .crrem-ask-greet::after {
    background: rgba(33, 51, 56, 0.88);
    border-color: rgba(102, 153, 171, 0.25);
}

/* Bottom-right: centering via left:50% + translateX works for both sides */

@keyframes clemGreetIn {
    0%   { opacity: 0; transform: translateY(8px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .crrem-ask-greet {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .crrem-ask-greet.clem-greet-leaving {
        transition-duration: 0.01s;
    }
}

@media (max-width: 480px) {
    .crrem-ask-greet {
        font-size: 13px;
        padding: 9px 14px;
        left: 0;
        bottom: calc(100% + 10px);
    }
}

/* Bubble button — just the circular avatar, no box */
.crrem-ask-bubble,
.crrem-ask-bubble:hover,
.crrem-ask-bubble:focus,
.crrem-ask-bubble:active {
    all: unset !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    border: none !important;
    background: transparent !important;
    color: var(--crrem-white) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    outline: none !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: visible !important;
    /* Larger invisible hover target */
    padding: 16px !important;
    margin: -16px !important;
}

/*
   CRREM Clem Aurora — living gradient glow.
   Inspired by Apple Intelligence but organic, not ringed.
   ::before = drifting radial blobs (the aurora), each blob position animated
              independently via @property so colors stay distinct, never muddy.
   ::after  = rotating conic sweep (the shimmer), adds flowing light.
   --proximity (0–1, from JS) controls intensity as cursor approaches.
   Colors: CRREM palette as luminous pastels — arctic, fern, soft gold, sky.
*/

/* Blob drift — each blob wanders its own path */
@keyframes clemDrift1 {
    0%, 100% { --clem-blob1-x: 25%; --clem-blob1-y: 20%; }
    25%      { --clem-blob1-x: 45%; --clem-blob1-y: 12%; }
    50%      { --clem-blob1-x: 32%; --clem-blob1-y: 42%; }
    75%      { --clem-blob1-x: 18%; --clem-blob1-y: 35%; }
}

@keyframes clemDrift2 {
    0%, 100% { --clem-blob2-x: 72%; --clem-blob2-y: 75%; }
    33%      { --clem-blob2-x: 55%; --clem-blob2-y: 85%; }
    66%      { --clem-blob2-x: 82%; --clem-blob2-y: 62%; }
}

@keyframes clemDrift3 {
    0%, 100% { --clem-blob3-x: 60%; --clem-blob3-y: 28%; }
    25%      { --clem-blob3-x: 78%; --clem-blob3-y: 45%; }
    50%      { --clem-blob3-x: 52%; --clem-blob3-y: 58%; }
    75%      { --clem-blob3-x: 68%; --clem-blob3-y: 32%; }
}

@keyframes clemBreathe {
    0%, 100% { transform: scale(0.7); opacity: var(--breathe-lo, 0.3); }
    40%      { transform: scale(1.08); opacity: var(--breathe-hi, 0.85); }
    60%      { transform: scale(1.04); opacity: var(--breathe-hi, 0.8); }
}

@keyframes clemSweep {
    to { --clem-sweep-angle: 360deg; }
}

/* ::before — the aurora: 3 drifting radial blobs, each a CRREM color */
.crrem-ask-bubble::before {
    content: '';
    position: absolute;
    top: -55%;
    left: -55%;
    width: 210%;
    height: 210%;
    border-radius: 50%;
    background:
        /* Blob 1: luminous arctic blue */
        radial-gradient(
            circle at var(--clem-blob1-x) var(--clem-blob1-y),
            rgba(120, 195, 215, calc(0.35 + var(--proximity, 0) * 0.55)) 0%,
            transparent 50%
        ),
        /* Blob 2: soft amber gold */
        radial-gradient(
            circle at var(--clem-blob2-x) var(--clem-blob2-y),
            rgba(225, 195, 110, calc(0.3 + var(--proximity, 0) * 0.5)) 0%,
            transparent 48%
        ),
        /* Blob 3: light fern / mint */
        radial-gradient(
            circle at var(--clem-blob3-x) var(--clem-blob3-y),
            rgba(140, 210, 175, calc(0.3 + var(--proximity, 0) * 0.5)) 0%,
            transparent 48%
        ),
        /* Blob 4: subtle sky (fixed, pulses via global opacity) */
        radial-gradient(
            circle at 40% 55%,
            rgba(155, 195, 235, calc(0.2 + var(--proximity, 0) * 0.3)) 0%,
            transparent 42%
        );
    filter: blur(calc(14px + var(--proximity, 0) * 8px));
    --breathe-lo: calc(0.25 + var(--proximity, 0) * 0.25);
    --breathe-hi: calc(0.55 + var(--proximity, 0) * 0.4);
    z-index: -1;
    pointer-events: none;
    animation:
        clemDrift1 8s ease-in-out infinite,
        clemDrift2 11s ease-in-out infinite,
        clemDrift3 9s ease-in-out infinite,
        clemBreathe 7s ease-in-out infinite;
}

/* ::after — the shimmer: rotating conic sweep adds flowing light */
.crrem-ask-bubble::after {
    content: '';
    position: absolute;
    top: -42%;
    left: -42%;
    width: 184%;
    height: 184%;
    border-radius: 50%;
    background: conic-gradient(
        from var(--clem-sweep-angle, 0deg),
        transparent 0%,
        rgba(120, 195, 215, calc(var(--proximity, 0) * 0.25 + 0.08)) 12%,
        transparent 22%,
        rgba(225, 195, 110, calc(var(--proximity, 0) * 0.2 + 0.06)) 38%,
        transparent 48%,
        rgba(140, 210, 175, calc(var(--proximity, 0) * 0.25 + 0.08)) 58%,
        transparent 68%,
        rgba(155, 195, 235, calc(var(--proximity, 0) * 0.15 + 0.04)) 82%,
        transparent 92%
    );
    filter: blur(calc(18px + var(--proximity, 0) * 6px));
    --breathe-lo: calc(0.15 + var(--proximity, 0) * 0.2);
    --breathe-hi: calc(0.4 + var(--proximity, 0) * 0.4);
    z-index: -1;
    pointer-events: none;
    animation: clemSweep 14s linear infinite, clemBreathe 7s ease-in-out infinite 3.5s;
    mix-blend-mode: screen;
}

/* Hover — gentle scale lift */
.crrem-ask-bubble:hover {
    transform: scale(1.04);
}

/* Open state — full radiance */
.crrem-ask-widget[data-state="open"] .crrem-ask-bubble::before {
    filter: blur(22px);
    opacity: 0.95;
}

.crrem-ask-widget[data-state="open"] .crrem-ask-bubble::after {
    filter: blur(24px);
    opacity: 0.8;
}

.crrem-ask-bubble-icon-wrap,
.crrem-ask-bubble-close {
    width: 52px;
    height: 52px;
    transition: transform 0.3s, opacity 0.3s;
    position: absolute;
}

.crrem-ask-bubble-icon-wrap {
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 6px rgba(23, 74, 59, 0.06);
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.crrem-ask-bubble-icon {
    width: 100%;
    height: auto;
    display: block;
    transform: scale(1.3) translateY(8%);
    border-radius: 0;
    object-fit: cover;
}

.crrem-ask-bubble-close {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
    /* Close icon needs a background since we removed the green box */
    width: 36px;
    height: 36px;
    background: var(--crrem-evergreen);
    border-radius: 50%;
    padding: 6px;
}

.crrem-ask-widget[data-state="open"] .crrem-ask-bubble-icon-wrap {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.crrem-ask-widget[data-state="open"] .crrem-ask-bubble-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ==========================================================================
   CHAT PANEL
   ========================================================================== */

.crrem-ask-panel {
    position: absolute;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--crrem-white);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(23, 74, 59, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.crrem-ask-bottom-left .crrem-ask-panel {
    bottom: 72px;
    left: 0;
    transform-origin: bottom left;
}

.crrem-ask-bottom-right .crrem-ask-panel {
    bottom: 72px;
    right: 0;
    transform-origin: bottom right;
}

.crrem-ask-widget[data-state="open"] .crrem-ask-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.crrem-ask-header {
    position: relative;
    background: var(--crrem-evergreen);
    color: var(--crrem-white);
    padding: 16px 20px;
    flex-shrink: 0;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.crrem-ask-header-glow {
    border-radius: 16px 16px 0 0;
}

.crrem-ask-header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crrem-ask-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crrem-ask-header-title strong {
    font-size: 16px;
    font-weight: 600;
    display: block;
}

.crrem-ask-subtitle {
    font-size: 12px;
    opacity: 0.75;
    display: block;
    margin-top: 1px;
}

/* Clem avatar */
.crrem-ask-avatar {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.crrem-ask-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
}

.crrem-ask-minimize,
.crrem-ask-minimize:hover,
.crrem-ask-minimize:focus,
.crrem-ask-minimize:active {
    all: unset !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: var(--crrem-white, #fff) !important;
    cursor: pointer !important;
    opacity: 0.7;
    transition: opacity 0.2s ease !important;
    transform: none !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.crrem-ask-minimize:hover {
    opacity: 1 !important;
}

/* ==========================================================================
   MESSAGES AREA
   ========================================================================== */

.crrem-ask-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.crrem-ask-messages::-webkit-scrollbar {
    width: 4px;
}

.crrem-ask-messages::-webkit-scrollbar-thumb {
    background: var(--crrem-grey-200);
    border-radius: 2px;
}

/* Message row with Clem avatar */
.crrem-ask-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 92%;
    align-self: flex-start;
    animation: crremMsgAssistant 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.crrem-ask-msg-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 65%;
    transform: scale(1.15);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Message bubbles */
.crrem-ask-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
}

.crrem-ask-msg-user {
    align-self: flex-end;
    background: var(--crrem-evergreen);
    color: var(--crrem-white);
    border-bottom-right-radius: 4px;
    animation: crremMsgUser 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.crrem-ask-msg-assistant {
    align-self: flex-start;
    background: var(--crrem-grey-100);
    color: var(--crrem-slate);
    border-bottom-left-radius: 4px;
}

/* Markdown in assistant messages */
.crrem-ask-msg-assistant strong {
    font-weight: 600;
    color: var(--crrem-evergreen);
}

.crrem-ask-msg-assistant a {
    color: var(--crrem-arctic);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.crrem-ask-msg-assistant ul, .crrem-ask-msg-assistant ol {
    margin: 6px 0;
    padding-left: 18px;
}

.crrem-ask-msg-assistant li {
    margin-bottom: 3px;
}

.crrem-ask-msg-assistant p {
    margin: 0 0 8px;
}

.crrem-ask-msg-assistant p:last-child {
    margin-bottom: 0;
}

/* Source citation badges */
.crrem-ask-source-ref {
    display: inline-flex;
    align-items: center;
    background: rgba(23, 74, 59, 0.1);
    color: var(--crrem-evergreen);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    vertical-align: super;
    line-height: 1;
    transition: background 0.2s;
}

.crrem-ask-source-ref:hover {
    background: rgba(23, 74, 59, 0.2);
}

/* Sources list at bottom of message */
.crrem-ask-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--crrem-grey-200);
    font-size: 12px;
    color: #666;
}

.crrem-ask-sources a {
    color: var(--crrem-arctic);
    text-decoration: none;
}

.crrem-ask-sources a:hover {
    text-decoration: underline;
}

/* Starter question chips */
.crrem-ask-starters {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.crrem-ask-starter,
.crrem-ask-starter:hover,
.crrem-ask-starter:focus,
.crrem-ask-starter:active {
    all: unset !important;
    display: block !important;
    background: var(--crrem-white, #fff) !important;
    border: 1px solid var(--crrem-grey-200, #E8E8E3) !important;
    color: var(--crrem-evergreen, #174A3B) !important;
    padding: 8px 14px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-family: 'Lexend Deca', sans-serif !important;
    cursor: pointer !important;
    text-align: left !important;
    line-height: 1.3 !important;
    box-sizing: border-box !important;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease !important;
    box-shadow: none !important;
    min-height: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.crrem-ask-starter:hover {
    background: var(--crrem-grey-100, #F5F5F0) !important;
    border-color: var(--crrem-arctic, #6699AB) !important;
    transform: translateX(4px) !important;
}

/* Welcome message */
.crrem-ask-welcome {
    align-self: flex-start;
    background: transparent;
    padding: 0;
    font-size: 14px;
    color: var(--crrem-slate);
    line-height: 1.55;
}

/* Thinking dots */
.crrem-ask-thinking {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: var(--crrem-grey-100);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.crrem-ask-thinking span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--crrem-fern);
    animation: crremThinking 1.4s ease-in-out infinite;
}

.crrem-ask-thinking span:nth-child(2) { animation-delay: 0.2s; }
.crrem-ask-thinking span:nth-child(3) { animation-delay: 0.4s; }

/* ==========================================================================
   INPUT AREA
   ========================================================================== */

.crrem-ask-input-area {
    position: relative;
    padding: 10px 12px;
    border-top: 1px solid var(--crrem-grey-200);
    flex-shrink: 0;
}

.crrem-ask-input-glow {
    border-radius: 999px;
    inset: 8px 10px;
    filter: blur(1px);
    opacity: 0;
}

.crrem-ask-input-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 245, 245, 0.6);
    border: none;
    border-radius: 999px;
    padding: 3px 3px 3px 14px;
    transition: background 0.3s;
}

.crrem-ask-input-area:focus-within .crrem-ask-input-wrap {
    background: rgba(255, 255, 255, 0.8);
}

.crrem-ask-input {
    flex: 1;
    min-width: 0;
    border: none !important;
    background: transparent;
    font-size: 13.5px;
    font-family: 'Lexend Deca', sans-serif;
    line-height: 1.4;
    resize: none;
    outline: none !important;
    box-shadow: none !important;
    color: var(--crrem-slate);
    padding: 5px 0;
    max-height: 100px;
}

.crrem-ask-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.crrem-ask-input::placeholder {
    color: #aaa;
    font-weight: 300;
}

.crrem-ask-send,
.crrem-ask-send:hover,
.crrem-ask-send:focus,
.crrem-ask-send:active {
    all: unset !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #6699AB, #477262, #D6A24A) !important;
    color: var(--crrem-white, #fff) !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: opacity 0.2s ease, filter 0.2s ease !important;
    transform: none !important;
    box-shadow: none !important;
    line-height: 1 !important;
}

.crrem-ask-send:hover {
    opacity: 0.9 !important;
    filter: brightness(1.1) !important;
}

.crrem-ask-send:active {
    opacity: 0.8 !important;
}

.crrem-ask-send:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

/* Footer */
.crrem-ask-footer {
    padding: 8px 16px;
    font-size: 11px;
    color: #999;
    text-align: center;
    border-top: 1px solid var(--crrem-grey-200);
    flex-shrink: 0;
}

/* ==========================================================================
   INLINE SEARCH BAR (replaces FAQ/directory search)
   ========================================================================== */

.crrem-ask-search-bar {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.crrem-ask-search-glow {
    border-radius: 14px;
}

.crrem-ask-search-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--crrem-white);
    border: 2px solid var(--crrem-grey-200);
    border-radius: 14px;
    padding: 10px 12px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.crrem-ask-search-bar:focus-within .crrem-ask-search-inner,
.crrem-ask-search-bar.active .crrem-ask-search-inner {
    border-color: var(--crrem-arctic);
    box-shadow: 0 4px 16px rgba(23, 74, 59, 0.1);
}

.crrem-ask-search-icon {
    color: #999;
    flex-shrink: 0;
    transition: color 0.2s;
}

.crrem-ask-search-bar:focus-within .crrem-ask-search-icon {
    color: var(--crrem-evergreen);
}

.crrem-ask-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    color: var(--crrem-slate);
}

.crrem-ask-search-input::placeholder {
    color: #aaa;
}

.crrem-ask-search-ai-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    transition: transform 0.2s;
}

.crrem-ask-search-ai-btn:hover {
    transform: scale(1.1);
}

/* Expanded search chat area */
.crrem-ask-search-expand {
    background: var(--crrem-white);
    border: 2px solid var(--crrem-arctic);
    border-top: none;
    border-radius: 0 0 14px 14px;
    overflow: hidden;
    animation: crremGlowAppear 0.25s ease-out;
}

.crrem-ask-search-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crrem-ask-search-footer {
    padding: 8px 16px;
    text-align: right;
    border-top: 1px solid var(--crrem-grey-200);
}

.crrem-ask-search-close {
    background: none;
    border: none;
    color: var(--crrem-arctic);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
}

.crrem-ask-search-close:hover {
    text-decoration: underline;
}

/* ==========================================================================
   INLINE CHAT BLOCK (for assessment section etc.)
   ========================================================================== */

.crrem-ask-inline {
    background: var(--crrem-white);
    border: 2px solid var(--crrem-grey-200);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: border-color 0.3s;
}

.crrem-ask-inline.active {
    border-color: var(--crrem-arctic);
}

.crrem-ask-inline-header {
    position: relative;
    background: var(--crrem-grey-100);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--crrem-grey-200);
}

.crrem-ask-inline-header strong {
    font-size: 15px;
    color: var(--crrem-evergreen);
    display: block;
}

.crrem-ask-inline-messages {
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crrem-ask-inline .crrem-ask-input-area {
    border-top: 1px solid var(--crrem-grey-200);
}

/* ==========================================================================
   ERROR MESSAGES
   ========================================================================== */

.crrem-ask-error {
    background: #FEF2F2;
    color: #a63f3c;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    align-self: flex-start;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 480px) {
    .crrem-ask-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        border-radius: 16px 16px 0 0;
    }

    .crrem-ask-bottom-left .crrem-ask-panel,
    .crrem-ask-bottom-right .crrem-ask-panel {
        left: 8px;
        right: 8px;
        bottom: 68px;
    }

    .crrem-ask-bubble {
        width: 48px;
        height: 48px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.crrem-ask-bubble:focus-visible,
.crrem-ask-send:focus-visible,
.crrem-ask-starter:focus-visible {
    outline: 3px solid var(--crrem-arctic);
    outline-offset: 2px;
}

/* Screen reader only */
.crrem-ask-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
