/* GiveRefer Genie floating chat widget.

   NOTE: upgrade/css/main.css applies a site-wide
     button, input[type=submit], .btn { background:#FB6765 !important;
       color:#fff !important; padding:14px 10px !important; font-size:14px !important; }
   so every button in this widget must re-assert its styles with matching
   !important (same battle as .grx-header in giverefer-chrome.css). */

#gr-genie-widget {
    --grg-gradient: linear-gradient(100deg, #ec2d7a 0%, #c026d3 50%, #6d28d9 100%);
    --grg-violet: #6d28d9;
    --grg-magenta: #c026d3;
    --grg-fg: #1c1530;
    --grg-muted: #6b6580;
    --grg-border: #ece8f2;
    font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, sans-serif;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10050;
}

/* Launcher button */
#gr-genie-widget .grg-launcher {
    width: 60px !important;
    height: 60px !important;
    border: none !important;
    border-radius: 50% !important;
    background: var(--grg-gradient) !important;
    color: #fff !important;
    padding: 0 !important;
    font-size: 26px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px -6px rgba(192, 38, 211, 0.55) !important;
    transition: transform .2s ease;
    position: relative;
}
#gr-genie-widget .grg-launcher:hover { transform: scale(1.07); }
.grg-launcher__icon { display: flex; }
.grg-launcher__close { display: none; font-size: 30px; line-height: 1; font-weight: 300; }
#gr-genie-widget.grg-open .grg-launcher__icon { display: none; }
#gr-genie-widget.grg-open .grg-launcher__close { display: block; }

@keyframes grg-pulse {
    0% { box-shadow: 0 0 0 0 rgba(192, 38, 211, 0.45); }
    70% { box-shadow: 0 0 0 16px rgba(192, 38, 211, 0); }
    100% { box-shadow: 0 0 0 0 rgba(192, 38, 211, 0); }
}
#gr-genie-widget .grg-launcher--pulse { animation: grg-pulse 2.2s ease-out 2; }

/* Panel */
.grg-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: 372px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px -12px rgba(40, 10, 60, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header: white, dark title, green online dot (matches homepage mockup) */
.grg-panel__header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 15px;
    background: #fff;
    border-bottom: 1px solid var(--grg-border);
}
.grg-panel__avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    background: var(--grg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}
.grg-panel__title { display: flex; flex-direction: column; line-height: 1.3; flex: 1; }
.grg-panel__title strong { font-size: 15.5px; color: var(--grg-fg); }
.grg-panel__status { font-size: 12.5px; color: #16a34a; display: flex; align-items: center; gap: 5px; }
.grg-panel__status i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; display: inline-block; }
#gr-genie-widget .grg-panel__minimize {
    background: #f4f2f8 !important;
    border: none !important;
    color: var(--grg-muted) !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    font-size: 18px !important;
    box-shadow: none !important;
    cursor: pointer;
    line-height: 1;
}

/* Messages */
.grg-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #faf9fc;
}
.grg-msg { display: flex; }
.grg-msg--bot { justify-content: flex-start; }
.grg-msg--user { justify-content: flex-end; }
.grg-msg__bubble {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--grg-fg);
    word-wrap: break-word;
    white-space: pre-wrap;
}
.grg-msg--bot .grg-msg__bubble {
    background: var(--grg-gradient);
    color: #fff;
    border-bottom-left-radius: 4px;
}
.grg-msg--user .grg-msg__bubble {
    background: #efedf4;
    border-bottom-right-radius: 4px;
}
/* Bootstrap/site CSS colors `code` pink and `a` blue globally — re-assert
   readable colors inside the bubbles with !important. */
#gr-genie-widget .grg-msg__bubble a {
    color: inherit !important;
    text-decoration: underline;
    font-weight: 600;
}
#gr-genie-widget .grg-msg--bot .grg-msg__bubble code {
    background: rgba(255, 255, 255, 0.22) !important;
    border: 1px dashed rgba(255, 255, 255, 0.65);
    color: #fff !important;
    border-radius: 6px;
    padding: 1px 7px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    word-break: break-all;
}
#gr-genie-widget .grg-msg--user .grg-msg__bubble code {
    background: #fff !important;
    border: 1px dashed var(--grg-magenta);
    color: var(--grg-violet) !important;
    border-radius: 6px;
    padding: 1px 7px;
    font-weight: 700;
    font-family: inherit;
    font-size: 13px;
}

/* Typing indicator */
.grg-typing { display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--grg-gradient); border-radius: 14px; border-bottom-left-radius: 4px; }
.grg-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .6;
    animation: grg-bounce 1.2s infinite;
}
.grg-typing span:nth-child(2) { animation-delay: .15s; }
.grg-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes grg-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

/* Starter chips */
.grg-chips { display: flex; flex-wrap: wrap; gap: 7px; }
#gr-genie-widget .grg-chip {
    background: #fff !important;
    border: 1px solid var(--grg-border) !important;
    color: var(--grg-violet) !important;
    border-radius: 999px !important;
    padding: 6px 12px !important;
    font-size: 12.5px !important;
    box-shadow: none !important;
    width: auto !important;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
#gr-genie-widget .grg-chip:hover {
    border-color: var(--grg-magenta) !important;
    background: #fdf4ff !important;
}

/* Feedback thumbs under a bot reply */
.grg-fb { display: flex; gap: 4px; margin: -4px 0 0 4px; }
#gr-genie-widget .grg-fb__btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px 4px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    cursor: pointer;
    opacity: .45;
    filter: grayscale(1);
    transition: opacity .15s ease, filter .15s ease;
}
#gr-genie-widget .grg-fb__btn:hover { opacity: .9; filter: none; }
#gr-genie-widget .grg-fb--done .grg-fb__btn { cursor: default; opacity: .25; }
#gr-genie-widget .grg-fb--done .grg-fb__btn--active { opacity: 1; filter: none; }

/* Input */
.grg-panel__form {
    display: flex;
    gap: 8px;
    padding: 10px 12px 4px;
    background: #fff;
    border-top: 1px solid var(--grg-border);
}
#gr-genie-widget .grg-panel__form input {
    flex: 1;
    border: 1px solid var(--grg-border) !important;
    border-radius: 999px !important;
    padding: 10px 16px !important;
    font-size: 13.5px !important;
    background: #fff !important;
    outline: none;
    color: var(--grg-fg) !important;
    box-shadow: none !important;
}
#gr-genie-widget .grg-panel__form input:focus { border-color: var(--grg-magenta) !important; }
#gr-genie-widget .grg-panel__form button {
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px;
    border: none !important;
    border-radius: 50% !important;
    background: var(--grg-gradient) !important;
    color: #fff !important;
    padding: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#gr-genie-widget .grg-panel__form button:disabled { opacity: .55; cursor: default; }
.grg-panel__hint {
    margin: 0;
    padding: 4px 14px 9px;
    font-size: 10.5px;
    color: var(--grg-muted);
    background: #fff;
    text-align: center;
}

/* The legacy back-to-top control shares the bottom-right corner; lift it
   above the Genie launcher (this stylesheet only loads when Genie is on). */
#back-top { bottom: 92px !important; right: 27px !important; }

/* Mobile: full-width sheet */
@media (max-width: 480px) {
    #gr-genie-widget { right: 14px; bottom: 14px; }
    .grg-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 84px;
        width: auto;
        height: min(560px, calc(100vh - 110px));
    }
}
