/* ---- Auto Garant Chatbot widget ---- */
/*
 * All semi-transparent backgrounds, borders and overlays derive from --agc-text
 * via color-mix() so they stay visible regardless of whether the admin picks a
 * dark or light theme. Browsers without color-mix support fall back to the
 * prior hard-coded rgba white values (those ship first; color-mix declarations
 * that parse successfully override them).
 */
#agc-root {
    position: fixed; bottom: 24px; z-index: 2147483000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --agc-accent: #c6a24a;
    --agc-bg: #141414;
    --agc-text: #ffffff;
    /* Borders track the admin-chosen text color so they're visible in both
       dark and light themes. All pane/card backgrounds use --agc-bg — no
       semi-transparent overlays, so the picked background shows through. */
    --agc-border: rgba(255,255,255,.3);
    --agc-border: color-mix(in srgb, var(--agc-text) 28%, transparent);
    --agc-hover: rgba(255,255,255,.1);
    --agc-hover: color-mix(in srgb, var(--agc-text) 10%, transparent);
    --agc-focus-ring: rgba(255,255,255,.15);
    --agc-focus-ring: color-mix(in srgb, var(--agc-text) 20%, transparent);
}
#agc-root.agc-right { right: 24px; }
#agc-root.agc-left { left: 24px; }

.agc-fab {
    display: inline-flex; align-items: center; gap: 12px;
    background: var(--agc-bg); color: var(--agc-text);
    border: 0; padding: 12px 18px 12px 14px; border-radius: 999px;
    box-shadow: 0 14px 40px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.15);
    cursor: pointer; font-family: inherit;
    transition: transform .18s ease, box-shadow .18s ease;
    position: relative;
}
.agc-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.agc-fab-icon { width: 42px; height: 42px; border-radius: 50%; background: var(--agc-accent); color: #111; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.agc-fab-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agc-fab-icon::after {
    content: ''; position: absolute; left: 14px; top: 12px; width: 42px; height: 42px; border-radius: 50%;
    border: 2px solid var(--agc-accent); animation: agcPulse 1.6s ease-out infinite;
}
@keyframes agcPulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.7); opacity: 0; } }
.agc-fab-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.agc-fab-text strong { font-size: 14px; font-weight: 600; }
.agc-fab-text small { font-size: 11px; opacity: .65; }

.agc-window {
    width: 380px; max-width: calc(100vw - 48px); height: 600px; max-height: calc(100vh - 100px);
    background: var(--agc-bg); color: var(--agc-text);
    border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35);
    position: fixed; bottom: 100px; overflow: hidden;
    display: flex; flex-direction: column;
    animation: agcOpen .25s cubic-bezier(.2, .8, .2, 1);
}
.agc-window[hidden], #agc-suggest[hidden] { display: none !important; }
#agc-root.agc-right .agc-window { right: 24px; }
#agc-root.agc-left .agc-window { left: 24px; }
@keyframes agcOpen { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.agc-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--agc-bg); border-bottom: 1px solid var(--agc-border); }
.agc-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--agc-accent); color: #111; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; overflow: hidden; }
.agc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agc-head-info { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.agc-title { font-weight: 600; font-size: 14px; }
.agc-status { font-size: 11px; opacity: .6; display: flex; align-items: center; gap: 6px; }
.agc-dot { width: 7px; height: 7px; border-radius: 50%; background: #4caf50; box-shadow: 0 0 0 0 rgba(76,175,80,.6); animation: agcDotPulse 1.4s infinite; }
@keyframes agcDotPulse { 0% { box-shadow: 0 0 0 0 rgba(76,175,80,.6);} 70% { box-shadow: 0 0 0 6px rgba(76,175,80,0);} 100% { box-shadow: 0 0 0 0 rgba(76,175,80,0);} }
.agc-reset, .agc-close { background: transparent; border: 0; color: var(--agc-text); opacity: .6; cursor: pointer; padding: 4px; border-radius: 4px; }
.agc-reset:hover, .agc-close:hover { opacity: 1; background: var(--agc-hover); }

.agc-messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.agc-messages::-webkit-scrollbar { width: 6px; }
.agc-messages::-webkit-scrollbar-thumb { background: var(--agc-border); border-radius: 3px; }

.agc-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-wrap: break-word; white-space: pre-wrap; }
.agc-msg.agc-m-user { background: var(--agc-accent); color: #111; align-self: flex-end; border-bottom-right-radius: 4px; }
.agc-msg.agc-m-assistant { background: var(--agc-bg); color: var(--agc-text); align-self: flex-start; border: 1px solid var(--agc-border); border-bottom-left-radius: 4px; }
.agc-msg a { color: inherit; text-decoration: underline; }
.agc-msg.agc-m-error { background: rgba(255,80,80,.15); border: 1px solid rgba(255,80,80,.4); }

.agc-typing { display: inline-flex; gap: 3px; align-items: center; padding: 10px 14px; }
.agc-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--agc-text); opacity: .5; animation: agcTyping 1.2s infinite; }
.agc-typing span:nth-child(2) { animation-delay: .15s; }
.agc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes agcTyping { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Car cards — styled like the "new vehicles" slider: info panel on the left
   (fixed dark-blue brand surface + white text) and image on the right. Image
   dominates on narrow widget so the vehicle is recognizable at a glance. */
.agc-cars { display: grid; gap: 10px; margin-top: 10px; }
.agc-car {
    display: grid;
    grid-template-columns: 1fr 120px;
    min-height: 130px;
    background: #184160;
    color: #fff;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    transition: transform .18s ease, box-shadow .18s ease;
}
.agc-car:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.28); }
.agc-car-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}
.agc-car-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .1px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.agc-car-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11px;
    color: rgba(255,255,255,.82);
}
.agc-car-meta span { white-space: nowrap; }
.agc-car-price {
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: .2px;
}
.agc-car-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    background: var(--agc-accent);
    color: #111;
    padding: 5px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.agc-car-thumb {
    width: 120px;
    height: 100%;
    background: rgba(255,255,255,.06) center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: rgba(255,255,255,.4);
    position: relative;
}
.agc-car-thumb::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(270deg, transparent 60%, rgba(24,65,96,.55));
    pointer-events: none;
}

.agc-suggest { padding: 0 14px 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.agc-chip { background: var(--agc-bg); border: 1px solid var(--agc-border); color: var(--agc-text); border-radius: 99px; padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.agc-chip:hover { background: var(--agc-hover); }

.agc-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--agc-border); background: var(--agc-bg); }
.agc-input textarea { flex: 1; background: var(--agc-bg); color: var(--agc-text); border: 1px solid var(--agc-border); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: none; max-height: 120px; line-height: 1.4; overflow-y: hidden; transition: border-color .15s, box-shadow .15s; }
.agc-input textarea.agc-overflow { overflow-y: auto; }
.agc-input textarea:focus { outline: none; border-color: var(--agc-accent); box-shadow: 0 0 0 3px var(--agc-focus-ring); }
.agc-send { background: var(--agc-accent); color: #111; border: 0; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform .12s; }
.agc-send:hover { transform: scale(1.08); }
.agc-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.agc-foot { text-align: center; font-size: 10px; opacity: .4; padding: 6px 0 8px; }
.agc-foot a { color: inherit; text-decoration: none; font-weight: 500; }
.agc-foot a:hover { opacity: 1; color: var(--agc-accent); }

@media (max-width: 480px) {
    #agc-root.agc-right, #agc-root.agc-left { bottom: 12px; left: 12px; right: 12px; }
    .agc-fab-text { display: none; }
    .agc-fab { padding: 10px; border-radius: 50%; }
    #agc-root.agc-right .agc-window, #agc-root.agc-left .agc-window { right: 12px; left: 12px; bottom: 80px; width: auto; max-width: none; height: calc(100vh - 100px); }
}
