:root {
    --cream: #F7F2EC;
    --cream-light: #FFFDFC;
    --ivory: #FFFCF8;

    --sage: #C2986C;
    --sage-dark: #9A704C;
    --sage-light: #EAD8C5;

    --rose: #D2AA82;
    --rose-dark: #AF7F56;
    --rose-light: #F2E3D4;

    --gold: #C2986C;
    --gold-light: #E6D0B8;

    --brown: #4C4037;
    --brown-light: #7B6B5F;

    --border: #E8DBCD;

    --shadow: rgba(76, 64, 55, 0.12);
}


body {
    font-family:
        Arial,
        "Segoe UI",
        Tahoma,
        sans-serif;

    margin: 0;

    height: 100dvh;

    overflow: hidden;

    display: flex;

    justify-content: center;

    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(194, 152, 108, 0.10),
            transparent 30%
        ),

        radial-gradient(
            circle at 85% 80%,
            rgba(154, 112, 76, 0.07),
            transparent 30%
        ),

        var(--cream);
}


#splash-screen {
    position: fixed;

    inset: 0;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    z-index: 1000;

    padding: 30px;

    text-align: center;

    color: var(--cream-light);

    background:
        radial-gradient(
            circle at 20% 15%,
            rgba(255, 255, 255, 0.18),
            transparent 30%
        ),

        radial-gradient(
            circle at 80% 85%,
            rgba(255, 245, 235, 0.15),
            transparent 30%
        ),

        linear-gradient(
            145deg,
            #D8B58F 0%,
            #C2986C 55%,
            #9A704C 100%
        );

    transition:
        opacity 0.5s ease,
        visibility 0.5s ease;
}


#splash-screen::before {
    content: "";

    width: 170px;
    height: 120px;

    margin-bottom: 24px;

    background-image:
        url("/imgsabonim/sabonimlogo.svg");

    background-repeat: no-repeat;

    background-position: center;

    background-size: contain;
}


#splash-screen h1 {
    margin: 0 0 10px;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: clamp(38px, 9vw, 54px);

    font-weight: 400;

    letter-spacing: 5px;

    color: var(--cream-light);

    text-shadow:
        0 3px 18px rgba(76, 64, 55, 0.22);
}


#splash-screen p {
    max-width: 340px;

    margin: 0 0 45px;

    font-size: 17px;

    line-height: 1.7;

    font-weight: 400;

    color: rgba(255, 253, 249, 0.90);
}


.start-btn {
    width: auto;

    min-width: 230px;

    height: auto;

    padding: 15px 34px;

    border:
        1px solid rgba(255, 255, 255, 0.65);

    border-radius: 40px;

    background:
        linear-gradient(
            135deg,
            #FFFDFC,
            #F4E8DC
        );

    color: #8F6544;

    font-size: 17px;

    font-weight: 700;

    font-family: inherit;

    white-space: nowrap;

    cursor: pointer;

    box-shadow:
        0 10px 30px rgba(94, 65, 45, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}


.start-btn:hover {
    transform: translateY(-2px);

    box-shadow:
        0 14px 34px rgba(94, 65, 45, 0.23),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}


.start-btn:active {
    transform: scale(0.97);
}


.chat-container {
    width: 100%;

    max-width: 620px;

    height: 100%;

    position: relative;

    display: none;

    flex-direction: column;

    overflow: hidden;

    background: var(--ivory);

    box-shadow:
        0 0 45px rgba(76, 64, 55, 0.13);
}


.header {
    position: relative;

    z-index: 5;

    display: flex;

    align-items: center;

    min-height: 78px;

    padding:
        max(14px, env(safe-area-inset-top))
        18px
        14px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 253, 249, 0.99),
            rgba(248, 241, 234, 0.99)
        );

    border-bottom:
        1px solid var(--border);

    box-shadow:
        0 4px 16px rgba(76, 64, 55, 0.06);
}


.header::after {
    content: "";

    position: absolute;

    right: 18px;
    left: 18px;

    bottom: 0;

    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            var(--gold-light),
            transparent
        );
}


.avatar {
    width: 52px;
    height: 44px;

    flex-shrink: 0;

    margin-left: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    border:
        1px solid #DFC3A6;

    border-radius: 12px;

    background-color: #C2986C;

    background-image:
        url("/imgsabonim/sabonimlogo.svg");

    background-repeat: no-repeat;

    background-position: center;

    background-size: contain;

    color: transparent;

    font-size: 0;

    box-shadow:
        0 4px 12px rgba(154, 112, 76, 0.18);
}


.header-info h3 {
    margin: 0;

    color: var(--brown);

    font-size: 18px;

    font-weight: 700;

    letter-spacing: 0.2px;
}


.header-info p {
    margin: 4px 0 0;

    color: var(--sage-dark);

    font-size: 13px;

    font-weight: 600;
}


.header-info p::before {
    content: "";

    display: inline-block;

    width: 7px;
    height: 7px;

    margin-left: 6px;

    border-radius: 50%;

    background: #789A73;

    box-shadow:
        0 0 0 3px rgba(120, 154, 115, 0.12);
}


.chat-box {
    position: relative;

    z-index: 1;

    flex: 1;

    display: flex;

    flex-direction: column;

    gap: 14px;

    padding: 22px 16px;

    overflow-y: auto;

    overscroll-behavior: contain;

    -webkit-overflow-scrolling: touch;

    background:
        radial-gradient(
            circle at 12px 12px,
            rgba(194, 152, 108, 0.08) 1px,
            transparent 1.5px
        ),

        linear-gradient(
            rgba(255, 252, 248, 0.94),
            rgba(247, 242, 236, 0.94)
        );

    background-size:
        24px 24px,
        auto;
}


.chat-box::-webkit-scrollbar-thumb {
    border-radius: 10px;

    background: var(--gold-light);
}


.message.bot {
    align-self: flex-start;

    color: var(--brown);

    background:
        linear-gradient(
            145deg,
            #FFFFFF,
            #FCF8F3
        );

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

    border-bottom-right-radius: 5px;

    box-shadow:
        0 4px 14px rgba(76, 64, 55, 0.07);
}


.message.bot::before {
    content: "";

    position: absolute;

    right: -1px;

    bottom: -1px;

    width: 17px;

    height: 17px;

    border-right:
        1px solid var(--border);

    border-bottom:
        1px solid var(--border);

    border-bottom-right-radius: 5px;

    background: #FCF8F3;

    clip-path:
        polygon(0 0, 100% 100%, 0 100%);
}


.message.user {
    align-self: flex-end;

    color: white;

    background:
        linear-gradient(
            145deg,
            #CFA77F,
            #9A704C
        );

    border:
        1px solid rgba(154, 112, 76, 0.25);

    border-bottom-left-radius: 5px;

    box-shadow:
        0 5px 15px rgba(154, 112, 76, 0.20);
}


.message.user::before {
    content: "";

    position: absolute;

    left: -1px;

    bottom: -1px;

    width: 17px;

    height: 17px;

    border-left:
        1px solid rgba(154, 112, 76, 0.25);

    border-bottom:
        1px solid rgba(154, 112, 76, 0.25);

    border-bottom-left-radius: 5px;

    background: #9A704C;

    clip-path:
        polygon(100% 0, 100% 100%, 0 100%);
}


.typing {
    position: relative;

    z-index: 2;

    display: none;

    margin: 0;

    padding: 5px 22px 9px;

    color: var(--sage-dark);

    font-size: 12px;

    font-weight: 600;
}


.input-area {
    position: relative;

    z-index: 5;

    display: flex;

    align-items: center;

    gap: 10px;

    padding:
        12px
        14px
        max(12px, env(safe-area-inset-bottom));

    background:
        rgba(255, 253, 249, 0.98);

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

    box-shadow:
        0 -5px 18px rgba(76, 64, 55, 0.06);
}


.input-area input {
    flex: 1;

    min-width: 0;

    padding: 13px 19px;

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

    border-radius: 25px;

    outline: none;

    background: #FAF5EF;

    color: var(--brown);

    font-family: inherit;

    font-size: 16px;

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}


.input-area input::placeholder {
    color: #A89789;
}


.input-area input:focus {
    border-color: var(--gold);

    background: white;

    box-shadow:
        0 0 0 4px rgba(194, 152, 108, 0.14);
}


.input-area button {
    width: 49px;

    height: 49px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 0 3px 0 0;

    border:
        1px solid rgba(154, 112, 76, 0.25);

    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            #D0AA84,
            #9A704C
        );

    color: white;

    font-size: 21px;

    cursor: pointer;

    box-shadow:
        0 5px 14px rgba(154, 112, 76, 0.24);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}


.input-area button:hover {
    filter: brightness(1.05);

    box-shadow:
        0 7px 17px rgba(154, 112, 76, 0.29);
}


.input-area button:active {
    transform: scale(0.93);
}


.time {
    display: block;

    margin-top: 7px;

    text-align: left;

    font-size: 10px;

    line-height: 1;

    opacity: 0.63;

    direction: ltr;

    unicode-bidi: isolate;
}


/* Shared bubble geometry: both text-only and product messages. */
* { box-sizing: border-box; }
.chat-box { min-height: 0; }
.message {
    position: relative;
    flex-shrink: 0;
    width: fit-content;
    max-width: 85%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.message-text { display: block; white-space: pre-wrap; }
.product-image-link {
    display: block;
    width: 220px;
    max-width: 100%;
    margin: 0 0 8px;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}
.message img.product-image {
    display: block;
    width: 100%;
    height: 220px;
    max-width: 100%;
    object-fit: contain;
}
.image-error { display: block; color: var(--brown-light); margin-bottom: 8px; }
.input-area button:disabled { opacity: 0.55; cursor: wait; }
@media (max-width: 380px) {
    .message { max-width: 92%; }
    .product-image-link { width: 200px; }
    .message img.product-image { height: 200px; }
}
