* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 100%;
    background: #F1F1F1;
}

*, html {
    --primaryGradient: linear-gradient(93.12deg, #581B98 0.52%, #9C1DE7 100%);
    --secondaryGradient: linear-gradient(268.91deg, #581B98 -2.14%, #9C1DE7 99.69%);
    --primaryBoxShadow: 0px 10px 15px rgba(0, 0, 0, 0.1);
    --secondaryBoxShadow: 0px -10px 15px rgba(0, 0, 0, 0.1);
    --primary: #581B98;
}

/* CHATBOX
=============== */
.chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* CONTENT IS CLOSE */
.chatbox__support {
    width: 400px;
    height: 650px;
    display: flex;
    flex-direction: column;
    background: #eee;
    z-index: -123456;
    opacity: 0;
    transition: all .5s ease-in-out;
}

/* CONTENT ISOPEN */
.chatbox--active {
    transform: translateY(-40px);
    z-index: 123456;
    opacity: 1;
}


/* BUTTON */
.chatbox__button {
    text-align: right;
}

.send__button {
    padding: 6px;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
}


/* HEADER */
.chatbox__header {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 22px 24px;
    background: linear-gradient(135deg, rgba(49, 34, 79, 0.96), rgba(103, 59, 157, 0.97));
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.chatbox__header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.15), transparent 32%), radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 30%);
    pointer-events: none;
}

.chatbox__image--header {
    position: relative;
    z-index: 1;
    margin-right: 14px;
    min-width: 56px;
    min-height: 56px;
    padding: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
    display: grid;
    place-items: center;
}

.chatbox__content--header {
    position: relative;
    z-index: 1;
}

.chatbox__heading--header {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.98rem;
    letter-spacing: 0.16em;
    color: #fff;
    text-transform: lowercase;
    margin-bottom: 4px;
}

.chatbox__description--header {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    max-width: 220px;
    text-transform: lowercase;
}

/* MESSAGES */
.chatbox__messages {
    margin-top: auto;
    display: flex;
    overflow-y: scroll;
    flex-direction: column-reverse;
}

.messages__item {
    background: orange;
    max-width: 60.6%;
    width: fit-content;
}

.messages__item--operator {
    margin-left: auto;
}

.messages__item--visitor {
    margin-right: auto;
}

/* FOOTER */
.chatbox__footer {
    position: sticky;
    bottom: 0;
}

.chatbox__support {
    background: #f9f9f9;
    width: 380px;
    height: 580px;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.14);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

/* Messages */
.chatbox__messages {
    flex: 1;
    min-height: 360px;
    margin-top: auto;
    display: flex;
    overflow-y: auto;
    flex-direction: column-reverse;
    padding: 0 20px 20px;
}

.chatbox__notification {
    margin: 10px 20px 0;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(88, 27, 152, 0.12);
    color: #3b185f;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    height: 0;
    overflow: hidden;
}

.chatbox__notification--visible {
    opacity: 1;
    transform: translateY(0);
    height: auto;
}

.chatbox__messages {
    padding: 0 20px 20px;
}

.messages__item {
    margin-top: 16px;
    padding: 16px 20px;
    max-width: 78%;
    display: inline-block;
    position: relative;
    line-height: 1.7;
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.08);
    word-break: break-word;
    font-size: 1.05rem;
}

.messages__item--visitor,
.messages__item--typing {
    margin-right: auto;
    background: rgba(255, 255, 255, 0.98);
    color: #222;
    border-bottom-right-radius: 22px;
    border-bottom-left-radius: 22px;
}

.messages__item--visitor::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 18px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid rgba(255, 255, 255, 0.96);
}

.messages__item--operator {
    margin-left: auto;
    background: linear-gradient(135deg, #581B98 0%, #9C1DE7 100%);
    color: #fff;
    border-bottom-left-radius: 22px;
    border-bottom-right-radius: 22px;
}

.messages__item--operator::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 18px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 10px solid rgba(92, 29, 176, 0.95);
}

.messages__item--typing {
    background: rgba(245, 245, 255, 0.98);
    color: #444;
    padding: 12px 14px;
}

.typing-dots {
    display: inline-flex;
    gap: 6px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #483374;
    border-radius: 50%;
    opacity: 0.55;
    animation: typing 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.18s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.55;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* FOOTER */
.chatbox__footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    gap: 10px;
    background: linear-gradient(180deg, rgba(252, 244, 234, 0.92), rgba(234, 216, 194, 0.9));
    border-top: 1px solid rgba(120, 91, 59, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 30px rgba(0, 0, 0, 0.08);
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    margin-top: 20px;
    font-family: Georgia, 'Times New Roman', serif;
}

.chatbox__voice-toggle {
    min-width: 52px;
    min-height: 52px;
    border: 1px solid rgba(120, 91, 59, 0.3);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    color: #4f3520;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.chatbox__voice-toggle:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 1px rgba(120, 91, 59, 0.12);
}

.chatbox__voice-toggle--active {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(120, 91, 59, 0.18);
}

.chatbox__footer input {
    width: 100%;
    border: 1px solid rgba(120, 91, 59, 0.2);
    padding: 14px 16px;
    border-radius: 30px;
    text-align: left;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    color: #4b3624;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.05);
}

.chatbox__footer input::placeholder {
    color: rgba(75, 54, 36, 0.65);
}

.chatbox__send--footer {
    color: #fff;
    background: linear-gradient(135deg, #6b4f29 0%, #9d7a44 100%);
    border: none;
    border-radius: 999px;
    padding: 14px 20px;
    min-width: 76px;
    box-shadow: 0 10px 20px rgba(109, 80, 45, 0.22);
    cursor: pointer;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chatbox__send--footer:hover {
    transform: translateY(-1px);
}

.chatbox__button button,
.chatbox__button button:focus,
.chatbox__button button:visited {
    padding: 14px;
    background: white;
    border: none;
    outline: none;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
    border-bottom-left-radius: 50px;
    box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}
