/* =========================================================
   MATRIX VISA ASSISTANT
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --matrix-green: #20c878;
    --matrix-green-dark: #16b66a;
    --matrix-green-soft: #eafaf2;

    --black: #111111;
    --dark: #1b1b1b;

    --gray-text: #6f6f6f;
    --gray-light: #f6f6f6;
    --gray-border: #e7e7e7;

    --white: #ffffff;

    --shadow-soft:
        0 18px 55px rgba(0, 0, 0, 0.13);

    --shadow-card:
        0 8px 25px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   PAGE
   ========================================================= */

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(32, 200, 120, 0.035),
            transparent 30%
        ),
        #ffffff;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    color: var(--black);

    overflow: hidden;
}


/* =========================================================
   CHATBOT
   ========================================================= */

.chatbot {
    position: fixed;

    right: 28px;
    bottom: 28px;

    width: 390px;
    height: 610px;

    background: var(--white);

    border: 1px solid rgba(0, 0, 0, 0.08);

    border-radius: 24px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow: var(--shadow-soft);

    z-index: 9998;

    transform-origin: right bottom;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translate3d(24px, 18px, 0)
        scale(0.94);

    transition:
        opacity 260ms ease,
        transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
        visibility 260ms ease;
}


/* OPEN */

.chatbot.open {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform:
        translate3d(0, 0, 0)
        scale(1);
}


/* =========================================================
   HEADER
   ========================================================= */

.chat-header {
    position: relative;

    min-height: 70px;

    padding: 8px 11px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    background:
        linear-gradient(
            135deg,
            #20c878 0%,
            #19bf71 55%,
            #16b66a 100%
        );

    color: var(--black);

    flex-shrink: 0;
}


/* subtle header highlight */

.chat-header::after {
    content: "";

    position: absolute;

    width: 150px;
    height: 150px;

    right: -60px;
    top: -90px;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.12);

    pointer-events: none;
}


/* =========================================================
   BRAND
   ========================================================= */

.brand {
    position: relative;

    z-index: 1;

    display: flex;

    align-items: center;

    gap: 12px;
}


/* =========================================================
   MATRIX LOGO
   ========================================================= */

.logo {
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--white);

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    color: var(--matrix-green);

    font-weight: 800;

    line-height: 1;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08);
}

.logo span {
    font-size: 11px;

    letter-spacing: -0.4px;
}

.logo small {
    font-size: 7px;

    margin-top: 3px;

    letter-spacing: 0.5px;
}


/* =========================================================
   HEADER TITLE
   ========================================================= */

.brand h2 {
    font-size: 15px;

    line-height: 1.2;

    font-weight: 700;

    margin-bottom: 3px;
}


/* =========================================================
   STATUS
   ========================================================= */

.status {
    display: flex;

    align-items: center;

    gap: 4px;

    font-size: 11px;

    color: rgba(0, 0, 0, 0.62);
}

.status-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #087b42;

    box-shadow:
        0 0 0 3px rgba(8, 123, 66, 0.12);
}


/* =========================================================
   HEADER ACTIONS
   ========================================================= */

.header-actions {
    position: relative;

    z-index: 2;

    display: flex;

    align-items: center;
}

.header-actions button {
    width: 32px;
    height: 32px;

    border: none;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.14);

    color: var(--black);

    font-size: 0;

    line-height: 1;

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    transition:
        background 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.header-actions button::before {
    content: "";
    width: 12px;
    height: 2px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.26);
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.header-actions button:active {
    transform: scale(0.94);
}


/* =========================================================
   MESSAGES AREA
   ========================================================= */

.chat-messages {
    flex: 1;

    overflow-y: auto;

    padding: 15px 14px 14px;

    display: flex;

    flex-direction: column;

    gap: 11px;

    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #fcfcfc 100%
        );

    scroll-behavior: smooth;
}


/* scrollbar */

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d7d7d7;

    border-radius: 20px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #c4c4c4;
}


/* =========================================================
   MESSAGE
   ========================================================= */

.message {
    display: flex;

    width: 100%;

    gap: 7px;

    animation:
        messageIn 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes messageIn {
    from {
        opacity: 0;

        transform:
            translateY(7px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}

.message.assistant {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}


/* =========================================================
   AVATAR
   ========================================================= */

.avatar {
    width: 31px;
    height: 31px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--white);

    border: 1px solid #e1e1e1;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    color: var(--matrix-green);

    font-weight: 800;

    line-height: 1;

    box-shadow:
        0 3px 9px rgba(0, 0, 0, 0.06);
}

.avatar span {
    font-size: 7.5px;

    letter-spacing: -0.3px;
}

.avatar small {
    font-size: 5.5px;

    margin-top: 2px;

    letter-spacing: 0.3px;
}


/* =========================================================
   MESSAGE CONTENT
   ========================================================= */

.message-content {
    max-width: 80%;

    min-width: 0;
}

.message.user .message-content {
    max-width: 78%;
}


/* =========================================================
   BUBBLES
   ========================================================= */

.bubble {
    padding: 11px 14px;

    border-radius: 16px;

    font-size: 12.5px;

    line-height: 1.42;

    word-wrap: break-word;

    overflow-wrap: anywhere;
}


/* assistant */

.message.assistant .bubble {
    background: #f4f4f4;

    border: 1px solid #e9e9e9;

    color: #171717;

    border-top-left-radius: 5px;
}


/* user */

.message.user .bubble {
    background:
        linear-gradient(
            135deg,
            var(--matrix-green),
            var(--matrix-green-dark)
        );

    color: #ffffff;

    border-top-right-radius: 5px;

    box-shadow:
        0 3px 9px rgba(32, 200, 120, 0.16);
}


/* =========================================================
   MESSAGE TIME
   ========================================================= */

.message-time {
    margin-top: 3px;

    padding-left: 2px;

    font-size: 9px;

    color: #969696;
}

.message.user .message-time {
    text-align: right;

    padding-right: 2px;
}

.ticks {
    color: var(--matrix-green);

    font-weight: 700;

    margin-left: 3px;
}


/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.typing-bubble {
    width: 58px;

    height: 38px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 4px;

    padding: 0;
}

.typing-bubble span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: #999;

    animation:
        typingDot 1.15s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-bubble span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingDot {
    0%,
    60%,
    100% {
        transform: translateY(0);

        opacity: 0.45;
    }

    30% {
        transform: translateY(-4px);

        opacity: 1;
    }
}


/* =========================================================
   PRODUCT / VISA CARD MESSAGE
   ========================================================= */

.variant-message {
    align-items: flex-start;
}

.variant-card-container {
    width: 100%;
}


/* =========================================================
   PRODUCT CARD
   ========================================================= */

.variant-card {
    width: 300px;

    max-width: 100%;

    background: #ffffff;

    border: 1px solid #e4e4e4;

    border-radius: 16px;

    overflow: hidden;

    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.075);

    display: flex;

    flex-direction: column;

    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}

.variant-card.clickable {
    cursor: pointer;
}

.variant-card.clickable:hover {
    transform: translateY(-3px);

    border-color:
        rgba(32, 200, 120, 0.45);

    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.12);
}

.variant-card.clickable:active {
    transform: scale(0.985);
}


/* =========================================================
   PRODUCT IMAGE
   ========================================================= */

.variant-image {
    display: block;
    width: 100%;
    height: 170px;

    object-fit: contain;
    object-position: center;

    background: #f8faf9;

    margin: 0 auto;
}
.variant-card {
    overflow: hidden;
}


/* fallback */

.variant-image-placeholder {
    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    background:
        linear-gradient(
            135deg,
            var(--matrix-green),
            var(--matrix-green-dark)
        );

    color: white;

    line-height: 1;
}

.variant-image-placeholder span {
    font-size: 22px;

    font-weight: 800;

    letter-spacing: -0.8px;
}

.variant-image-placeholder small {
    margin-top: 5px;

    font-size: 10px;

    letter-spacing: 1px;
}


/* =========================================================
   PRODUCT INFORMATION
   ========================================================= */

.variant-info {
    padding: 12px 13px 13px;
}

.variant-info h3 {
    font-size: 12.5px;

    line-height: 1.25;

    font-weight: 750;

    color: var(--black);

    margin-bottom: 4px;
}

.variant-title {
    font-size: 9px;

    color: var(--gray-text);

    line-height: 1.35;

    margin-bottom: 10px;
}


/* =========================================================
   PRODUCT DETAILS
   ========================================================= */

.variant-details {
    display: flex;

    flex-direction: column;

    gap: 6px;

    margin-top: 7px;
}

.variant-detail {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    font-size: 10.5px;

    line-height: 1.3;
}

.variant-detail span {
    color: #777;

    font-weight: 500;
}

.variant-detail strong {
    color: #171717;

    font-weight: 650;

    text-align: right;
}


/* =========================================================
   PRICE
   ========================================================= */

.variant-price {
    margin-top: 9px;

    padding-top: 8px;

    border-top: 1px solid #eeeeee;

    color: var(--matrix-green);

    font-size: 16px;

    line-height: 1;

    font-weight: 800;
}


/* =========================================================
   INPUT AREA
   ========================================================= */

.chat-input-area {
    display: flex;

    align-items: center;

    gap: 9px;

    padding: 8px 11px 6px;

    background: #ffffff;

    border-top: 1px solid var(--gray-border);

    flex-shrink: 0;
}


/* =========================================================
   INPUT WRAPPER
   ========================================================= */

.input-wrapper {
    flex: 1;

    min-width: 0;

    height: 44px;

    display: flex;

    align-items: center;

    border: 1px solid #dedede;

    border-radius: 13px;

    padding-left: 12px;

    background: #ffffff;

    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.input-wrapper:focus-within {
    border-color: var(--matrix-green);

    box-shadow:
        0 0 0 3px rgba(32, 200, 120, 0.10);
}


/* =========================================================
   INPUT
   ========================================================= */

#messageInput {
    flex: 1;

    min-width: 0;

    height: 100%;

    border: none;

    outline: none;

    background: transparent;

    color: var(--black);

    font-family: inherit;

    font-size: 14px;
}

#messageInput::placeholder {
    color: #999;
}

#messageInput:disabled {
    opacity: 0.6;

    cursor: not-allowed;
}


/* =========================================================
   ATTACHMENT
   ========================================================= */

.attachment-btn {
    width: 36px;
    height: 100%;

    flex-shrink: 0;

    border: none;

    background: transparent;

    color: #777;

    font-size: 17px;

    cursor: pointer;

    transition:
        color 160ms ease,
        transform 160ms ease;
}

.attachment-btn:hover {
    color: var(--matrix-green);

    transform: rotate(-8deg);
}


/* =========================================================
   SEND BUTTON
   ========================================================= */

.send-btn {
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    border: none;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            var(--matrix-green),
            var(--matrix-green-dark)
        );

    color: #ffffff;

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 18px;

    box-shadow:
        0 5px 15px rgba(32, 200, 120, 0.22);

    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        opacity 180ms ease;
}

.send-btn:hover {
    transform: scale(1.06);

    box-shadow:
        0 7px 20px rgba(32, 200, 120, 0.28);
}

.send-btn:active {
    transform: scale(0.94);
}

.send-btn:disabled {
    opacity: 0.55;

    cursor: not-allowed;

    transform: none;

    box-shadow: none;
}


/* =========================================================
   BETA DISCLAIMER
   ========================================================= */

.beta-disclaimer {
    flex-shrink: 0;

    text-align: center;

    padding: 4px 10px;

    font-size: 10.5px;

    color: #999;

    background: #fafafa;

    border-top: 1px solid #eee;
}

.beta-disclaimer a {
    color: var(--matrix-green);

    font-weight: 650;

    text-decoration: underline;

    cursor: pointer;
}


/* =========================================================
   POWERED BY
   ========================================================= */

.powered-by {
    flex-shrink: 0;

    text-align: center;

    padding: 3px 0 7px;

    font-size: 10.5px;

    color: #999;

    background: #ffffff;
}

.powered-by strong {
    color: var(--matrix-green);

    font-weight: 650;
}


/* =========================================================
   FLOATING CHAT LAUNCHER
   RIGHT SIDE
   ========================================================= */

.chat-launcher {
    position: fixed;

    right: 28px;
    bottom: 28px;

    width: 64px;
    height: 64px;

    border: none;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            var(--matrix-green),
            var(--matrix-green-dark)
        );

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    z-index: 9999;

    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.18);

    opacity: 1;

    transform:
        scale(1);

    transition:
        transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 200ms ease,
        box-shadow 200ms ease;
}


/* launcher hover */

.chat-launcher:hover {
    transform:
        scale(1.07)
        translateY(-2px);

    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.22);
}


/* launcher active */

.chat-launcher:active {
    transform: scale(0.94);
}


/* =========================================================
   LAUNCHER HIDDEN
   ========================================================= */

.chat-launcher.hidden {
    opacity: 0;

    pointer-events: none;

    transform:
        scale(0.55);
}


/* =========================================================
   LAUNCHER LOGO
   ========================================================= */

.launcher-logo {
    width: 47px;
    height: 47px;

    border-radius: 50%;

    background: #ffffff;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    color: var(--matrix-green);

    font-weight: 800;

    line-height: 1;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08);
}

.launcher-logo span {
    font-size: 11px;

    letter-spacing: -0.4px;
}

.launcher-logo small {
    font-size: 7px;

    margin-top: 3px;

    letter-spacing: 0.6px;
}


/* =========================================================
   LAUNCHER PULSE
   ========================================================= */

.chat-launcher::before {
    content: "";

    position: absolute;

    inset: -5px;

    border-radius: 50%;

    border: 1px solid
        rgba(32, 200, 120, 0.25);

    animation:
        launcherPulse 2.8s infinite ease-out;

    pointer-events: none;
}

@keyframes launcherPulse {
    0% {
        opacity: 0.8;

        transform: scale(0.92);
    }

    70% {
        opacity: 0;

        transform: scale(1.18);
    }

    100% {
        opacity: 0;

        transform: scale(1.18);
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    body {
        overflow: hidden;
    }


    /* Full-screen chatbot */

    .chatbot {
        left: 0;
        bottom: 0;

        width: 100vw;
        height: 100dvh;

        border-radius: 0;

        border: none;

        box-shadow: none;

        transform-origin: right bottom;

        transform:
            translate3d(18px, 12px, 0)
            scale(0.98);
    }

    .chatbot.open {
        transform:
            translate3d(0, 0, 0)
            scale(1);
    }


    /* Header */

    .chat-header {
        min-height: 68px;

        padding:
            11px 13px;
    }


    .brand h2 {
        font-size: 15px;
    }


    .logo {
        width: 44px;
        height: 44px;
    }


    /* Messages */

    .chat-messages {
        padding:
            14px 11px 13px;

        gap: 11px;
    }


    .message-content {
        max-width: 82%;
    }

    .message.user .message-content {
        max-width: 80%;
    }


    /* Bubbles */

    .bubble {
        font-size: 12.5px;

        padding:
            8px 11px;
    }


    /* Product */

    .variant-card {
        width: 290px;

        max-width:
            calc(100vw - 65px);
    }


    .variant-image {
        height: 130px;
    }


    .variant-info {
        padding:
            10px;
    }


    .variant-info h3 {
        font-size: 13px;
    }


    .variant-detail {
        font-size: 11px;
    }


    /* Input */

    .chat-input-area {
        padding:
            8px 9px 6px;
    }


    .input-wrapper {
        height: 44px;
    }


    .send-btn {
        width: 44px;
        height: 44px;
    }


    /* Launcher */

    .chat-launcher {
        right: 18px;
        bottom: 18px;

        width: 60px;
        height: 60px;
    }


    .launcher-logo {
        width: 44px;
        height: 44px;
    }
}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {

    .brand h2 {
        font-size: 15px;
    }


    .avatar {
        width: 33px;
        height: 33px;
    }


    .message-content {
        max-width: 84%;
    }


    .message.user .message-content {
        max-width: 82%;
    }


    .variant-card {
        width: 290px;

        max-width:
            calc(100vw - 55px);
    }


    .variant-image {
        height: 125px;
    }
}

/* =========================================================
   CUSTOMER UI POLISH
   ========================================================= */

.header-actions button {
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.header-actions button:focus-visible,
.chat-launcher:focus-visible,
.send-btn:focus-visible {
    outline: 2px solid rgba(32, 200, 120, 0.55);
    outline-offset: 3px;
}

/* Keep cards visually balanced when product images have different aspect ratios. */
.variant-card .variant-image {
    object-fit: contain;
    object-position: center;
}

/* Smooth, subtle motion without making the UI feel busy. */
@media (prefers-reduced-motion: reduce) {
    .chatbot,
    .chat-launcher,
    .message,
    .variant-card,
    .send-btn,
    .header-actions button {
        animation: none !important;
        transition: none !important;
    }

    .chat-messages {
        scroll-behavior: auto;
    }
}

.close-btn {
    position: relative;

    width: 34px;
    height: 34px;

    padding: 0;

    border: 2px solid #111;
    border-radius: 0;

    background: transparent;

    overflow: hidden;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        border-color 300ms ease,
        transform 200ms ease;

    z-index: 20;
}
.close-icon {
    position: relative;
    z-index: 10;

    margin: 0;

    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #111;

    font-size: 24px;
    font-weight: 400;

    line-height: 1;

    transition:
        transform 500ms ease,
        color 300ms ease;
}
/* Green animated blocks */

.close-effect {
    position: absolute;

    width: 100%;
    height: 100%;

    background: #00a86b;

    transform: rotate(45deg);

    transition: 500ms ease;

    z-index: 1;
}

/* Initial positions */

.effect-1 {
    top: 48px;
    left: 0;
}

.effect-2 {
    top: 0;
    left: 48px;
}

.effect-3 {
    top: 0;
    right: 48px;
}

.effect-4 {
    bottom: 48px;
    right: 0;
}

/* Hover animation */

.close-btn:hover {
    border-color: #00c875;
}

.close-btn:hover .close-icon {
    transform: scale(0);
}

.close-btn:hover .effect-1 {
    top: 24px;
}

.close-btn:hover .effect-2 {
    left: 24px;
}

.close-btn:hover .effect-3 {
    right: 24px;
}

.close-btn:hover .effect-4 {
    bottom: 24px;
}

.close-btn:active {
    transform: scale(0.94);
}
.assistant-logo {
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #35e77f;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.12);
}

.assistant-icon {
    width: 27px;
    height: 27px;

    fill: none;
    stroke: #126b43;

    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.assistant-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    background: #35e77f;

    border: none;

    box-shadow:
        0 2px 7px rgba(0, 0, 0, 0.10);
}

.assistant-avatar .assistant-icon {
    width: 18px;
    height: 18px;

    fill: none;
    stroke: #126b43;

    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}