:root {
    /* GemAstro Blue Theme */
    --primary: #092d76;
    /* Deep Blue */
    --primary-light: #2563eb;
    --accent: #3b82f6;
    /* Bright Blue */
    --accent-glow: rgba(37, 99, 235, 0.15);
    --bg: #FDF9F3;
    /* Light Beige */
    --surface: #ffffff;
    --text-main: #1a1a2e;
    --text-sub: #64748b;
    --line: #e5e7eb;
    --success: #10b981;
    --shadow-sm: 0 4px 6px -1px rgba(9, 45, 118, 0.1), 0 2px 4px -1px rgba(9, 45, 118, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(9, 45, 118, 0.15), 0 10px 10px -5px rgba(9, 45, 118, 0.04);
    --font: 'Outfit', sans-serif;
    --font-head: 'Outfit', sans-serif;
}

/* Hide chatbot on cart and checkout pages */
body.woocommerce-cart #gab-widget,
body.woocommerce-checkout #gab-widget {
    display: none !important;
}

/* --- Base Reset --- */
#gab-widget * {
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

#gab-widget {
    font-family: var(--font);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    line-height: normal;
}

#gab-widget h1,
#gab-widget h2,
#gab-widget h3,
#gab-widget .brand-logo,
#gab-widget .chip {
    font-family: var(--font-head);
}

/* --- Launcher Button --- */
#gab-widget .launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    background: rgba(44, 75, 128, 1);
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(45, 27, 105, 0.35);
    border: 1px solid rgba(255, 215, 0, 0.2);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: grid;
    place-items: center;
    padding: 0;
    margin: 0;
    color: var(--accent);
    z-index: 9999999;
}

#gab-widget .launcher:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 12px 40px rgba(45, 27, 105, 0.45);
}

#gab-widget .launcher svg {
    width: 32px;
    height: 32px;
    fill: #ffffff;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#gab-widget .notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #FF4444;
    border: 2px solid white;
    border-radius: 50%;
    animation: bounce 2s infinite;
}

/* --- Chat Main Container --- */
#gab-widget .chat-widget {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 680px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 160px);
    background: var(--bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999999;
    border: 1px solid var(--line);
    overscroll-behavior: contain;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#gab-widget .chat-widget.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    display: flex;
}

/* Hide launcher when chat is open */
#gab-widget .chat-widget.active~.launcher {
    display: none;
}

/* --- Header --- */
#gab-widget .header {
    background: linear-gradient(135deg, var(--primary) 0%, #041e42 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

#gab-widget .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

#gab-widget .brand-logo {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--accent);
    font-size: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

#gab-widget .brand-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

#gab-widget .brand-info p {
    margin: 0;
    font-size: 11px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

#gab-widget .live-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px #22c55e;
}

#gab-widget .actions {
    display: flex;
    gap: 8px;
}

#gab-widget .icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s;
    padding: 0;
}

#gab-widget .icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Message Area --- */
#gab-widget .messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-image: radial-gradient(circle at 50% 50%, rgba(45, 27, 105, 0.03) 0%, transparent 50%);
}

#gab-widget .msg-row {
    display: flex;
    gap: 12px;
    opacity: 0;
    transform: translateY(10px);
    animation: gabSlideIn 0.3s forwards;
    margin: 0;
}

#gab-widget .msg-row.user {
    justify-content: flex-end;
}

#gab-widget .avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#gab-widget .avatar.system {
    background: var(--primary);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

#gab-widget .bubble {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#gab-widget .msg-row.system .bubble {
    background: var(--surface);
    border-top-left-radius: 4px;
    color: var(--text-main);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

#gab-widget .msg-row.user .bubble {
    background: var(--primary);
    color: white;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(45, 27, 105, 0.2);
}

/* --- Rich Elements --- */
#gab-widget .card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin-top: 8px;
    box-shadow: var(--shadow-sm);
}

#gab-widget .chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

#gab-widget .chip {
    background: white;
    border: 1px solid var(--primary-light);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    margin: 0;
    flex-grow: 1;
}

#gab-widget .chip:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* --- Input Area --- */
#gab-widget .input-bar {
    background: white;
    border-top: 1px solid var(--line);
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

#gab-widget .input-box {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 14px 18px;
    font-size: 14px;
    transition: all 0.2s;
    color: var(--text-main);
    margin: 0;
}

#gab-widget .input-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 27, 105, 0.1);
    background: #fff;
}

#gab-widget .send-btn {
    background: var(--primary);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(9, 45, 118, 0.2);
    padding: 0;
    margin: 0;
}

#gab-widget .send-btn:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

/* --- Animations --- */
@keyframes gabSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

#gab-widget .typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    display: inline-block;
    animation: gabTyping 1.4s infinite ease-in-out both;
    margin: 0 1px;
}

#gab-widget .typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

#gab-widget .typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes gabTyping {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 480px) {
    #gab-widget .input-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        background: white;
    }

    #gab-widget .input-box {
        font-size: 16px !important;
    }

    #gab-widget .chat-widget {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 60px !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        border-radius: 20px 20px 0 0 !important;
        max-width: none !important;
    }

    #gab-widget .launcher {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }

    #gab-widget .launcher svg {
        width: 26px;
        height: 26px;
    }
}

/* --- Product Cards --- */
.product-carousel {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 8px 4px 16px 4px;
    width: 100%;
    scrollbar-width: thin;
}

.product-card {
    min-width: 140px;
    max-width: 160px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.p-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f0f0f0;
}

.p-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.p-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.p-price {
    font-size: 12px;
    color: var(--primary);
    font-weight: bold;
}

.p-btn {
    margin-top: 6px;
    background: var(--primary);
    color: var(--accent);
    border: none;
    padding: 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
}

.p-btn:hover {
    background: var(--primary-light);
}

#gab-widget .case-card-footer {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

/* --- Enhanced Big Actions --- */
#gab-widget .big-btn {
    width: 100%;
    padding: 18px 24px;
    border-radius: 16px;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin: 0;
    background-size: 200% auto;
}

#gab-widget .big-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#gab-widget .btn-wa {
    background: #25D366;
    /* WhatsApp Green */
}

#gab-widget .btn-call {
    background: var(--primary);
    /* Brand Color */
}

/* --- Rating Options --- */
#gab-widget .rating-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

#gab-widget .rating-opt {
    background: white;
    border: 1px solid var(--line);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin: 0;
}

#gab-widget .rating-opt:hover {
    background: #fffbef;
    border-color: #fbbf24;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}