/* =========================================================
   RITZBOT V2 — PREMIUM AI SHOPPING ASSISTANT
   Compact / Responsive / Mobile First
========================================================= */

:root {
    --ritz-primary: #111111;
    --ritz-secondary: #252525;

    --ritz-gold: #d4af37;
    --ritz-gold-light: #f3d778;

    --ritz-bg: rgba(255,255,255,.96);
    --ritz-card: rgba(255,255,255,.98);

    --ritz-text: #181818;
    --ritz-muted: #777;

    --ritz-border: rgba(0,0,0,.08);

    --ritz-shadow:
        0 18px 55px rgba(0,0,0,.18);

    --ritz-radius: 18px;
}


/* =========================================================
   FLOATING ROBOT BUTTON
========================================================= */

#ritzbot-button {
    position: fixed;

    left: 18px;
    right: auto;
    bottom: 18px;

    width: 54px;
    height: 54px;

    border: 0;
    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            #1b1b1b,
            #050505
        );

    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    z-index: 99998;

    box-shadow:
        0 8px 25px rgba(0,0,0,.28),
        0 0 0 1px rgba(255,255,255,.08);

    transition:
        transform .25s ease,
        box-shadow .25s ease,
        opacity .25s ease;
}


/* Robot icon */

#ritzbot-button::before {
    content: "✦";

    font-size: 24px;

    color: var(--ritz-gold);

    transition:
        transform .35s ease;
}


#ritzbot-button:hover {
    transform: translateY(-3px) scale(1.04);

    box-shadow:
        0 12px 32px rgba(0,0,0,.35),
        0 0 22px rgba(212,175,55,.18);
}


#ritzbot-button:hover::before {
    transform: rotate(180deg);
}


#ritzbot-button:active {
    transform: scale(.94);
}


/* =========================================================
   BOT PULSE
========================================================= */

#ritzbot-button::after {
    content: "";

    position: absolute;

    inset: -5px;

    border-radius: 50%;

    border: 1px solid rgba(212,175,55,.35);

    animation: ritzBotPulse 2.4s infinite;

    pointer-events: none;
}


@keyframes ritzBotPulse {

    0% {
        transform: scale(.9);
        opacity: .7;
    }

    70% {
        transform: scale(1.25);
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}


/* =========================================================
   CHAT WINDOW
========================================================= */

#ritzbot-box {

    position: fixed;

    left: 18px;
    right: auto;
    bottom: 84px;

    width: 330px;
    height: 455px;

    max-width: calc(100vw - 36px);
    max-height: calc(100vh - 105px);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--ritz-bg);

    border: 1px solid rgba(255,255,255,.75);

    border-radius: var(--ritz-radius);

    box-shadow: var(--ritz-shadow);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(18px)
        scale(.97);

    transform-origin: bottom left;

    pointer-events: none;

    transition:
        opacity .25s ease,
        visibility .25s ease,
        transform .25s cubic-bezier(.2,.8,.2,1);

    z-index: 99997;
}


#ritzbot-box.ritzbot-open {

    opacity: 1;

    visibility: visible;

    transform:
        translateY(0)
        scale(1);

    pointer-events: auto;
}


/* =========================================================
   HEADER
========================================================= */

#ritzbot-box::before {

    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 2px;

    background:
        linear-gradient(
            90deg,
            transparent,
            var(--ritz-gold),
            transparent
        );

    z-index: 5;
}


.ritzbot-header {

    min-height: 58px;

    padding: 10px 12px;

    display: flex;
    align-items: center;

    gap: 10px;

    background:
        linear-gradient(
            135deg,
            #111,
            #242424
        );

    color: #fff;

    flex-shrink: 0;
}


.ritzbot-header-icon {

    width: 35px;
    height: 35px;

    border-radius: 11px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            145deg,
            #f3d778,
            #b88b16
        );

    color: #111;

    font-size: 17px;

    box-shadow:
        0 5px 14px rgba(0,0,0,.25);
}


.ritzbot-header-content {
    min-width: 0;
    flex: 1;
}


.ritzbot-title {

    font-size: 14px;

    font-weight: 700;

    line-height: 1.2;

    letter-spacing: .1px;
}


.ritzbot-status {

    display: flex;
    align-items: center;

    gap: 5px;

    margin-top: 3px;

    font-size: 10px;

    color: rgba(255,255,255,.65);
}


.ritzbot-status::before {

    content: "";

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #52c41a;

    box-shadow:
        0 0 7px rgba(82,196,26,.7);
}


/* =========================================================
   CLOSE BUTTON
========================================================= */

.ritzbot-close {

    width: 28px;
    height: 28px;

    border: 0;

    border-radius: 8px;

    background: rgba(255,255,255,.08);

    color: rgba(255,255,255,.85);

    cursor: pointer;

    transition:
        background .2s ease,
        transform .2s ease;
}


.ritzbot-close:hover {

    background: rgba(255,255,255,.16);

    transform: rotate(90deg);
}


/* =========================================================
   MESSAGE AREA
========================================================= */

#ritzbot-messages {

    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 12px;

    background:
        radial-gradient(
            circle at top right,
            rgba(212,175,55,.06),
            transparent 35%
        ),
        #fafafa;

    scroll-behavior: smooth;

    overscroll-behavior: contain;
}


/* Scrollbar */

#ritzbot-messages::-webkit-scrollbar {
    width: 5px;
}


#ritzbot-messages::-webkit-scrollbar-track {
    background: transparent;
}


#ritzbot-messages::-webkit-scrollbar-thumb {

    background: rgba(0,0,0,.16);

    border-radius: 10px;
}


#ritzbot-messages::-webkit-scrollbar-thumb:hover {

    background: rgba(0,0,0,.28);
}


/* =========================================================
   MESSAGES
========================================================= */

.ritzbot-message {

    max-width: 84%;

    margin-bottom: 8px;

    padding: 9px 11px;

    border-radius: 13px;

    font-size: 12px;

    line-height: 1.5;

    word-break: break-word;

    animation:
        ritzMessageIn .22s ease;
}


@keyframes ritzMessageIn {

    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* AI */

.ritzbot-ai-message {

    margin-right: auto;

    color: var(--ritz-text);

    background: #fff;

    border:
        1px solid var(--ritz-border);

    border-bottom-left-radius: 5px;

    box-shadow:
        0 3px 12px rgba(0,0,0,.04);
}


/* User */

.ritzbot-user-message {

    margin-left: auto;

    color: #fff;

    background:
        linear-gradient(
            135deg,
            #202020,
            #090909
        );

    border-bottom-right-radius: 5px;

    box-shadow:
        0 4px 13px rgba(0,0,0,.14);
}


/* =========================================================
   QUICK ACTIONS
========================================================= */

.ritzbot-quick-actions {

    display: flex;

    gap: 6px;

    overflow-x: auto;

    padding:
        2px 0 9px;

    scrollbar-width: none;
}


.ritzbot-quick-actions::-webkit-scrollbar {
    display: none;
}


.ritzbot-chip {

    flex: 0 0 auto;

    padding: 6px 9px;

    border-radius: 999px;

    border: 1px solid rgba(0,0,0,.08);

    background: #fff;

    color: #333;

    font-size: 10px;

    font-weight: 600;

    cursor: pointer;

    white-space: nowrap;

    transition:
        all .2s ease;
}


.ritzbot-chip:hover {

    background: #111;

    color: #fff;

    border-color: #111;

    transform: translateY(-1px);
}


/* =========================================================
   PRODUCT WRAPPER
========================================================= */

.ritzbot-products-wrapper {

    display: flex;

    gap: 8px;

    overflow-x: auto;

    margin:
        2px 0 10px;

    padding:
        2px 1px 7px;

    scroll-snap-type: x proximity;

    scrollbar-width: thin;
}


.ritzbot-products-wrapper::-webkit-scrollbar {
    height: 4px;
}


.ritzbot-products-wrapper::-webkit-scrollbar-thumb {

    background: rgba(0,0,0,.16);

    border-radius: 10px;
}


/* =========================================================
   PRODUCT CARD
========================================================= */

.ritzbot-product-card {

    flex:
        0 0 210px;

    min-width: 210px;

    display: flex;

    gap: 9px;

    padding: 8px;

    border-radius: 13px;

    background: #fff;

    border:
        1px solid rgba(0,0,0,.07);

    box-shadow:
        0 4px 14px rgba(0,0,0,.05);

    scroll-snap-align: start;

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}


.ritzbot-product-card:hover {

    transform: translateY(-2px);

    box-shadow:
        0 8px 20px rgba(0,0,0,.09);
}


/* =========================================================
   PRODUCT IMAGE
========================================================= */

.ritzbot-product-image {

    width: 62px;
    height: 62px;

    flex-shrink: 0;

    object-fit: cover;

    border-radius: 10px;

    background: #f4f4f4;

    border:
        1px solid rgba(0,0,0,.06);
}


/* =========================================================
   PRODUCT INFO
========================================================= */

.ritzbot-product-info {

    min-width: 0;

    flex: 1;

    display: flex;
    flex-direction: column;
}


.ritzbot-product-name {

    font-size: 11px;

    font-weight: 700;

    line-height: 1.35;

    color: #222;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

    overflow: hidden;
}


.ritzbot-product-price {

    margin-top: 4px;

    font-size: 13px;

    font-weight: 800;

    color: #111;
}


.ritzbot-view-product {

    display: inline-flex;

    align-items: center;
    justify-content: center;

    margin-top: auto;

    min-height: 25px;

    padding: 4px 7px;

    border-radius: 7px;

    background: #111;

    color: #fff;

    text-decoration: none;

    font-size: 9px;

    font-weight: 700;

    transition:
        background .2s ease,
        transform .2s ease;
}


.ritzbot-view-product:hover {

    background: #2b2b2b;

    transform: translateY(-1px);
}


/* =========================================================
   TYPING INDICATOR
========================================================= */

.ritzbot-typing {

    display: flex;

    align-items: center;

    gap: 4px;

    width: fit-content;

    padding: 8px 10px;

    margin-bottom: 8px;

    border-radius: 12px;

    background: #fff;

    border: 1px solid rgba(0,0,0,.06);
}


.ritzbot-typing span {

    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: #888;

    animation:
        ritzTyping 1.2s infinite ease-in-out;
}


.ritzbot-typing span:nth-child(2) {
    animation-delay: .15s;
}


.ritzbot-typing span:nth-child(3) {
    animation-delay: .3s;
}


@keyframes ritzTyping {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .35;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


/* =========================================================
   INPUT AREA
========================================================= */

.ritzbot-input-area {

    display: flex;

    align-items: center;

    gap: 7px;

    padding: 9px;

    background: #fff;

    border-top:
        1px solid rgba(0,0,0,.07);

    flex-shrink: 0;
}


#ritzbot-input {

    flex: 1;

    min-width: 0;

    height: 37px;

    padding:
        0 11px;

    border-radius: 11px;

    border:
        1px solid rgba(0,0,0,.1);

    outline: none;

    background: #fafafa;

    color: #222;

    font-family: inherit;

    font-size: 12px;

    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}


#ritzbot-input::placeholder {

    color: #999;
}


#ritzbot-input:focus {

    background: #fff;

    border-color:
        rgba(212,175,55,.7);

    box-shadow:
        0 0 0 3px rgba(212,175,55,.09);
}


/* =========================================================
   SEND BUTTON
========================================================= */

#ritzbot-send {

    width: 37px;
    height: 37px;

    flex-shrink: 0;

    border: 0;

    border-radius: 11px;

    background:
        linear-gradient(
            145deg,
            #202020,
            #050505
        );

    color: #fff;

    cursor: pointer;

    font-size: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}


#ritzbot-send:hover {

    transform: translateY(-1px);

    box-shadow:
        0 5px 14px rgba(0,0,0,.2);
}


#ritzbot-send:active {

    transform: scale(.93);
}


#ritzbot-send:disabled {

    opacity: .45;

    cursor: not-allowed;

    transform: none;
}


/* =========================================================
   HELPER BUBBLE
========================================================= */

.ritzbot-helper {

    position: fixed;

    left: 80px;
    bottom: 24px;

    max-width: 180px;

    padding: 7px 10px;

    border-radius: 10px;

    background: #111;

    color: #fff;

    font-size: 10px;

    box-shadow:
        0 7px 22px rgba(0,0,0,.18);

    animation:
        ritzHelperFloat 3s ease-in-out infinite;

    z-index: 99996;
}


.ritzbot-helper::before {

    content: "";

    position: absolute;

    left: -5px;
    bottom: 10px;

    width: 9px;
    height: 9px;

    background: #111;

    transform: rotate(45deg);
}


@keyframes ritzHelperFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}


/* =========================================================
   BADGE
========================================================= */

.ritzbot-badge {

    position: absolute;

    top: -2px;
    right: -2px;

    min-width: 16px;
    height: 16px;

    padding: 0 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    background: #d4af37;

    color: #111;

    font-size: 8px;

    font-weight: 800;

    border: 2px solid #fff;
}


/* =========================================================
   SUGGESTION BUTTONS
========================================================= */

.ritzbot-suggestions {

    display: flex;

    flex-wrap: wrap;

    gap: 5px;

    margin-top: 6px;
}


.ritzbot-suggestion {

    border:
        1px solid rgba(0,0,0,.08);

    background: #fff;

    color: #333;

    padding: 6px 8px;

    border-radius: 8px;

    font-size: 10px;

    cursor: pointer;

    transition: all .18s ease;
}


.ritzbot-suggestion:hover {

    background: #111;

    color: #fff;

    border-color: #111;
}


/* =========================================================
   LOADING STATE
========================================================= */

.ritzbot-loading #ritzbot-send {

    pointer-events: none;

    position: relative;
}


.ritzbot-loading #ritzbot-send {

    font-size: 0;
}


.ritzbot-loading #ritzbot-send::after {

    content: "";

    width: 14px;
    height: 14px;

    border-radius: 50%;

    border:
        2px solid rgba(255,255,255,.3);

    border-top-color: #fff;

    animation:
        ritzSpin .7s linear infinite;
}


@keyframes ritzSpin {

    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    #ritzbot-button {

        left: 12px;
        bottom: 14px;

        width: 50px;
        height: 50px;
    }


    #ritzbot-box {

        left: 8px;
        right: 8px;

        bottom: 74px;

        width: auto;

        max-width: none;

        height:
            min(470px, calc(100vh - 88px));

        max-height:
            calc(100vh - 88px);

        border-radius: 17px;
    }


    #ritzbot-messages {

        padding: 10px;
    }


    .ritzbot-message {

        max-width: 90%;

        font-size: 12px;
    }


    .ritzbot-product-card {

        flex-basis: 205px;

        min-width: 205px;
    }


    .ritzbot-helper {

        left: 70px;

        bottom: 18px;

        max-width: 155px;
    }
}


/* =========================================================
   VERY SMALL PHONES
========================================================= */

@media (max-width: 380px) {

    #ritzbot-box {

        left: 5px;
        right: 5px;

        bottom: 70px;

        height:
            calc(100vh - 82px);
    }


    .ritzbot-header {

        padding: 9px 10px;
    }


    #ritzbot-messages {

        padding: 8px;
    }


    .ritzbot-product-card {

        flex-basis: 190px;

        min-width: 190px;
    }


    .ritzbot-product-image {

        width: 56px;
        height: 56px;
    }


    #ritzbot-input {

        height: 35px;
    }


    #ritzbot-send {

        width: 35px;
        height: 35px;
    }
}


/* =========================================================
   DESKTOP LARGE SCREENS
========================================================= */

@media (min-width: 1200px) {

    #ritzbot-box {

        width: 345px;
        height: 470px;
    }
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration: .01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: .01ms !important;

        scroll-behavior: auto !important;
    }
}


/* =========================================================
   SAFE AREA — MOBILE
========================================================= */

@supports (padding-bottom: env(safe-area-inset-bottom)) {

    #ritzbot-button {

        bottom:
            calc(14px + env(safe-area-inset-bottom));
    }


    #ritzbot-box {

        bottom:
            calc(74px + env(safe-area-inset-bottom));
    }
}