:root {
    --gps-green: #22c55e;
    --gps-green-hover: #16a34a;
    --gps-green-dim: rgba(34, 197, 94, 0.12);
    --gps-green-glow: rgba(34, 197, 94, 0.25);
    --gps-bg: #13161b;
    --gps-surface: #1a1e25;
    --gps-surface-2: #21262f;
    --gps-text: #c8ccd2;
    --gps-text-muted: #7a818c;
    --gps-border: rgba(255, 255, 255, 0.06);
    --gps-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
    --gps-radius: 20px;
    --gps-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

#gps-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--gps-green);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.35), 0 0 0 0 rgba(34, 197, 94, 0.4);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    animation: gps-launcher-pulse 3s ease-in-out infinite;
}

@keyframes gps-launcher-pulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(34, 197, 94, 0.35), 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(34, 197, 94, 0.35), 0 0 0 8px rgba(34, 197, 94, 0); }
}

#gps-chat-launcher:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(34, 197, 94, 0.5);
    animation: none;
}
#gps-chat-launcher:active { transform: scale(0.95); }
#gps-chat-launcher svg { width: 26px; height: 26px; fill: #0a1a0a; transition: transform 0.3s ease; }
#gps-chat-launcher.open svg.icon-chat { display: none; }
#gps-chat-launcher:not(.open) svg.icon-close { display: none; }
#gps-chat-launcher.open svg.icon-close { display: block; }

#gps-chat-launcher .badge {
    position: absolute; top: -3px; right: -3px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #ef4444; color: white; font-size: 11px;
    font-weight: 700; display: none; align-items: center;
    justify-content: center; border: 2px solid var(--gps-bg);
}
#gps-chat-launcher .badge.visible { display: flex; }

#gps-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 99999;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 620px;
    max-height: calc(100vh - 140px);
    border-radius: var(--gps-radius);
    background: var(--gps-bg);
    box-shadow: var(--gps-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: var(--gps-font);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
#gps-chat-window.open {
    opacity: 1; transform: translateY(0) scale(1); pointer-events: all;
}

.gps-chat-header {
    background: linear-gradient(135deg, #16512b 0%, #0d3018 60%, #0a1f10 100%);
    color: white;
    padding: 20px 22px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.gps-chat-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.15) 0%, transparent 70%);
    pointer-events: none;
}
.gps-chat-header-top {
    display: flex; align-items: center; gap: 14px; position: relative; z-index: 1;
}
.gps-chat-avatar {
    width: 42px; height: 42px; border-radius: 14px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.25);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gps-chat-avatar svg { width: 22px; height: 22px; fill: var(--gps-green); }
.gps-chat-header-info h3 {
    margin: 0; font-size: 16px; font-weight: 700;
    letter-spacing: -0.02em; color: #eaece9;
}
.gps-chat-header-info p { margin: 3px 0 0; font-size: 12px; opacity: 0.7; font-weight: 500; }
.gps-chat-status { display: inline-flex; align-items: center; gap: 6px; }
.gps-chat-status::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: var(--gps-green); display: inline-block;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.gps-chat-messages {
    flex: 1; overflow-y: auto; padding: 18px 16px 8px;
    display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
.gps-chat-messages::-webkit-scrollbar { width: 4px; }
.gps-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.gps-chat-messages::-webkit-scrollbar-track { background: transparent; }

.gps-msg { max-width: 84%; animation: gps-msg-in 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes gps-msg-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.gps-msg.user { align-self: flex-end; }
.gps-msg.assistant { align-self: flex-start; }

.gps-msg-bubble {
    padding: 11px 15px; border-radius: 16px; font-size: 14px;
    line-height: 1.55; word-wrap: break-word; letter-spacing: -0.01em;
}
.gps-msg.user .gps-msg-bubble {
    background: var(--gps-green); color: #0a1a0a;
    font-weight: 500; border-bottom-right-radius: 6px;
}
.gps-msg.assistant .gps-msg-bubble {
    background: var(--gps-surface); color: var(--gps-text);
    border: 1px solid var(--gps-border); border-bottom-left-radius: 6px;
}
.gps-msg-bubble strong, .gps-msg-bubble b { font-weight: 700; color: #dde0e4; }
.gps-msg-bubble a { color: var(--gps-green); text-decoration: none; font-weight: 500; }
.gps-msg-bubble a:hover { text-decoration: underline; }
.gps-msg.user .gps-msg-bubble a { color: #065f46; }

.gps-product-cards {
    display: flex; gap: 8px; overflow-x: auto;
    padding: 6px 0 10px; scroll-snap-type: x mandatory;
}
.gps-product-cards::-webkit-scrollbar { height: 2px; }
.gps-product-cards::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

.gps-product-card {
    flex-shrink: 0; width: 175px; scroll-snap-align: start;
    background: var(--gps-surface); border: 1px solid var(--gps-border);
    border-radius: 14px; overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s; cursor: pointer;
}
.gps-product-card:hover {
    border-color: rgba(34, 197, 94, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.gps-product-card img { width: 100%; height: 115px; object-fit: cover; display: block; }
.gps-product-card-body { padding: 10px 11px 11px; }
.gps-product-card-name {
    font-size: 12.5px; font-weight: 600; color: var(--gps-text);
    margin: 0 0 5px; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35;
}
.gps-product-card-price { font-size: 14px; font-weight: 700; color: var(--gps-green); }
.gps-product-card-price .sale-price { color: #f87171; }
.gps-product-card-price .orig-price {
    text-decoration: line-through; color: var(--gps-text-muted);
    font-weight: 400; font-size: 11.5px; margin-left: 4px;
}
.gps-product-card-stock { font-size: 11px; color: var(--gps-text-muted); margin-top: 3px; }
.gps-product-card-stock.low { color: #fbbf24; font-weight: 600; }

.gps-product-card-btn {
    display: block; width: 100%; margin-top: 8px; padding: 7px;
    background: var(--gps-green-dim); color: var(--gps-green);
    border: 1px solid rgba(34, 197, 94, 0.15); border-radius: 8px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background 0.2s, border-color 0.2s; font-family: var(--gps-font);
}
.gps-product-card-btn:hover {
    background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.3);
}

.gps-typing { display: flex; align-items: center; gap: 5px; padding: 14px 16px; }
.gps-typing-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--gps-text-muted); animation: gps-typing-bounce 1.4s infinite;
}
.gps-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.gps-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes gps-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.gps-chat-input-area {
    padding: 12px 14px 14px; border-top: 1px solid var(--gps-border);
    background: var(--gps-bg); flex-shrink: 0;
}
.gps-chat-input-wrap { display: flex; gap: 8px; align-items: flex-end; }
.gps-chat-input {
    flex: 1; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px;
    padding: 10px 14px; font-size: 14px; font-family: var(--gps-font);
    resize: none; outline: none; min-height: 20px; max-height: 100px;
    line-height: 1.4; background: var(--gps-surface); color: var(--gps-text);
    transition: border-color 0.2s; letter-spacing: -0.01em;
}
.gps-chat-input:focus { border-color: rgba(34, 197, 94, 0.4); }
.gps-chat-input::placeholder { color: var(--gps-text-muted); }

.gps-chat-send {
    width: 40px; height: 40px; border-radius: 12px; background: var(--gps-green);
    border: none; cursor: pointer; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; transition: background 0.2s, transform 0.15s;
}
.gps-chat-send:hover { background: var(--gps-green-hover); }
.gps-chat-send:active { transform: scale(0.92); }
.gps-chat-send:disabled { background: var(--gps-surface-2); cursor: not-allowed; }
.gps-chat-send svg { width: 17px; height: 17px; fill: #0a1a0a; }

.gps-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.gps-quick-action {
    padding: 7px 13px; border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px; background: var(--gps-surface); font-size: 12.5px;
    color: var(--gps-text-muted); cursor: pointer; transition: all 0.2s;
    font-family: var(--gps-font); font-weight: 500;
}
.gps-quick-action:hover {
    background: var(--gps-green-dim); border-color: rgba(34, 197, 94, 0.2);
    color: var(--gps-green);
}

.gps-cart-toast {
    position: absolute; top: 76px; left: 14px; right: 14px;
    background: linear-gradient(135deg, #14532d, #166534); color: white;
    padding: 11px 15px; border-radius: 12px; font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 8px; z-index: 10;
    border: 1px solid rgba(34, 197, 94, 0.2);
    animation: gps-toast-in 0.3s ease, gps-toast-out 0.3s ease 2.5s forwards;
}
@keyframes gps-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gps-toast-out { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

.gps-chat-footer {
    text-align: center; padding: 6px; font-size: 10px;
    color: var(--gps-text-muted); opacity: 0.5; flex-shrink: 0; letter-spacing: 0.02em;
}

@media (max-width: 480px) {
    #gps-chat-window {
        bottom: 0; right: 0; left: 0; width: 100%;
        max-width: 100%; height: 100%; max-height: 100%;
        border-radius: 0; border: none;
    }
    #gps-chat-launcher { bottom: 16px; right: 16px; }
}

/* ─── Suggested Action Buttons ─────────────────────── */
.gps-suggested-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 12px;
    min-height: 0;
}
.gps-action-btn {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    background: #1a1e25;
    font-size: 13px;
    color: #c8ccd2;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 500;
    white-space: nowrap;
}
.gps-action-btn:hover {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
    color: #22c55e;
}
.gps-action-btn:active {
    transform: scale(0.96);
}
