:root {
    --background-dark: #050814;
    --panel-dark: #0a1122;
    --panel-light: #101c35;
    --arcane-blue: #1687ff;
    --arcane-cyan: #55c8ff;
    --arcane-purple: #725cff;
    --text-white: #f7f9ff;
    --text-muted: #98a7c2;
    --border: rgba(116, 167, 255, 0.18);
    --success: #35d69b;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Inter, Arial, sans-serif;
}

body {
    min-height: 100vh;
    background: transparent;
    color: var(--text-white);
}

/* CHAT LAUNCHER */

.chat-launcher {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 999999;

    width: 68px;
    height: 68px;

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

    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;

    color: white;
    background: linear-gradient(
        135deg,
        var(--arcane-cyan),
        var(--arcane-blue),
        var(--arcane-purple)
    );

    box-shadow:
        0 18px 45px rgba(22, 135, 255, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);

    cursor: pointer;

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

.chat-launcher:hover {
    transform: translateY(-3px) scale(1.04);

    box-shadow:
        0 22px 55px rgba(22, 135, 255, 0.52),
        inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.launcher-letter {
    font-size: 28px;
    font-weight: 800;
}

.launcher-close {
    position: absolute;

    font-size: 32px;
    font-weight: 300;

    opacity: 0;
    transform: rotate(-90deg) scale(0.7);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.chat-launcher.is-open .launcher-letter {
    opacity: 0;
}

.chat-launcher.is-open .launcher-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* CHAT WINDOW */

.chat-widget {
    position: fixed;
    right: 28px;
    bottom: 112px;
    z-index: 999998;

    width: min(410px, calc(100vw - 32px));
    height: min(690px, calc(100vh - 145px));

    display: flex;
    flex-direction: column;

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

    background:
        radial-gradient(
            circle at top right,
            rgba(22, 135, 255, 0.15),
            transparent 40%
        ),
        linear-gradient(
            180deg,
            rgba(15, 27, 52, 0.99),
            rgba(5, 9, 20, 0.99)
        );

    box-shadow: 0 30px 85px rgba(0, 0, 0, 0.52);

    overflow: hidden;

    opacity: 0;
    visibility: hidden;

    transform: translateY(24px) scale(0.96);
    transform-origin: bottom right;

    transition:
        opacity 0.22s ease,
        visibility 0.22s ease,
        transform 0.22s ease;
}

.chat-widget.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* HEADER */

.chat-header {
    min-height: 82px;
    padding: 17px 19px;

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

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

    background: linear-gradient(
        135deg,
        rgba(22, 135, 255, 0.17),
        rgba(114, 92, 255, 0.06)
    );
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-logo,
.message-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    color: white;
    background: linear-gradient(
        135deg,
        var(--arcane-cyan),
        var(--arcane-blue),
        var(--arcane-purple)
    );

    box-shadow: 0 8px 22px rgba(22, 135, 255, 0.3);
}

.brand-logo {
    width: 46px;
    height: 46px;

    border-radius: 15px;

    font-size: 21px;
    font-weight: 800;
}

.brand-details h1 {
    margin: 0 0 5px;

    font-size: 17px;
    font-weight: 700;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 6px;

    color: var(--text-muted);

    font-size: 12px;
}

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

    border-radius: 50%;
    background: var(--success);

    box-shadow: 0 0 12px rgba(53, 214, 155, 0.8);
}

.close-chat {
    width: 38px;
    height: 38px;

    border: none;
    border-radius: 12px;

    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.055);

    font-size: 26px;

    cursor: pointer;
}

/* INTRODUCTION */

.chat-introduction {
    padding: 18px 20px 13px;
}

.intro-label {
    display: inline-block;

    margin-bottom: 10px;
    padding: 6px 10px;

    border: 1px solid rgba(85, 200, 255, 0.2);
    border-radius: 999px;

    color: var(--arcane-cyan);
    background: rgba(22, 135, 255, 0.08);

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-introduction h2 {
    margin: 0 0 7px;

    font-size: 21px;
    line-height: 1.25;
}

.chat-introduction p {
    margin: 0;

    color: var(--text-muted);

    font-size: 13px;
    line-height: 1.55;
}

/* MESSAGES */

.chat-messages {
    flex: 1;
    min-height: 0;

    padding: 12px 18px;

    overflow-y: auto;
    scroll-behavior: smooth;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(152, 167, 194, 0.3);
}

.message-row {
    width: 100%;
    margin-bottom: 16px;

    display: flex;
    align-items: flex-end;
    gap: 9px;
}

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

.message-avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;

    border-radius: 10px;

    font-size: 13px;
    font-weight: 800;
}

.message {
    max-width: 82%;
    padding: 12px 14px;

    border-radius: 17px;

    font-size: 13px;
    line-height: 1.55;
}

.message p {
    margin: 0 0 7px;
}

.message p:last-of-type {
    margin-bottom: 0;
}

.assistant-message {
    border: 1px solid var(--border);
    border-bottom-left-radius: 5px;

    background: rgba(255, 255, 255, 0.055);
}

.user-message {
    border-bottom-right-radius: 5px;

    background: linear-gradient(
        135deg,
        var(--arcane-blue),
        var(--arcane-purple)
    );

    box-shadow: 0 10px 25px rgba(22, 135, 255, 0.2);
}

.message-time {
    display: block;

    margin-top: 7px;

    color: rgba(255, 255, 255, 0.48);

    font-size: 10px;
}

/* QUICK ACTIONS */

.quick-actions {
    padding: 4px 18px 12px;

    display: flex;
    gap: 8px;

    overflow-x: auto;
}

.quick-action {
    flex-shrink: 0;

    padding: 9px 12px;

    border: 1px solid rgba(85, 200, 255, 0.23);
    border-radius: 999px;

    color: #d4edff;
    background: rgba(22, 135, 255, 0.08);

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;
}

.quick-action:hover {
    border-color: rgba(85, 200, 255, 0.5);
    background: rgba(22, 135, 255, 0.16);
}

/* TYPING INDICATOR */

.typing-indicator {
    display: none;
    width: fit-content;

    margin: 0 18px 10px 57px;
    padding: 10px 13px;

    gap: 5px;

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

    background: rgba(255, 255, 255, 0.055);
}

.typing-indicator.is-visible {
    display: flex;
}

.typing-indicator span {
    width: 6px;
    height: 6px;

    border-radius: 50%;
    background: var(--text-muted);

    animation: typing 1.1s infinite ease-in-out;
}

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

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

/* INPUT AREA */

.chat-footer {
    padding: 12px 16px 13px;

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

    background: rgba(3, 7, 17, 0.88);
}

.chat-form {
    padding: 7px 7px 7px 14px;

    display: flex;
    align-items: flex-end;
    gap: 9px;

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

    background: rgba(255, 255, 255, 0.05);
}

.chat-form:focus-within {
    border-color: rgba(85, 200, 255, 0.5);

    box-shadow: 0 0 0 3px rgba(22, 135, 255, 0.08);
}

#message-input {
    width: 100%;
    max-height: 110px;
    padding: 7px 0;

    border: none;
    outline: none;
    resize: none;

    color: var(--text-white);
    background: transparent;

    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
}

#message-input::placeholder {
    color: #71809a;
}

.send-button {
    width: 39px;
    height: 39px;
    flex-shrink: 0;

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

    border: none;
    border-radius: 13px;

    color: white;
    background: linear-gradient(
        135deg,
        var(--arcane-cyan),
        var(--arcane-blue),
        var(--arcane-purple)
    );

    font-size: 17px;

    cursor: pointer;

    box-shadow: 0 8px 20px rgba(22, 135, 255, 0.28);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.powered-by {
    margin: 9px 0 0;

    color: #697892;

    text-align: center;
    font-size: 10px;
}

.powered-by strong {
    color: #a5bfdf;
}

/* ANIMATIONS */

@keyframes typing {
    0%,
    60%,
    100% {
        opacity: 0.4;
        transform: translateY(0);
    }

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

/* MOBILE */

@media (max-width: 600px) {
    .chat-launcher {
        right: 18px;
        bottom: 18px;

        width: 62px;
        height: 62px;
    }

    .chat-widget {
        right: 10px;
        bottom: 92px;

        width: calc(100vw - 20px);
        height: min(720px, calc(100vh - 110px));

        border-radius: 22px;
    }
}

@media (max-height: 650px) {
    .chat-widget {
        height: calc(100vh - 115px);
    }

    .chat-introduction {
        display: none;
    }
}

/* =====================================================
   QUICK-ACTION AND OVERFLOW CORRECTION
   ===================================================== */

.chat-widget {
    overflow-x: hidden;
}

.chat-messages {
    overflow-x: hidden;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;

    padding: 7px 16px 13px;

    overflow-x: hidden;
    scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar {
    display: none;
}

.quick-action {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 9px 10px;

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

    white-space: normal;
    text-align: center;
    line-height: 1.3;
}

.quick-action:last-child {
    grid-column: 1 / -1;
}

@media (max-width: 430px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .quick-action:last-child {
        grid-column: auto;
    }
}

/* =====================================================
   OFFICIAL ARCANE LOGO STYLING
   ===================================================== */

.chat-launcher {
    background:
        radial-gradient(
            circle at 50% 35%,
            rgba(26, 145, 255, 0.22),
            transparent 65%
        ),
        linear-gradient(
            145deg,
            #10244a,
            #071020
        );

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

    box-shadow:
        0 18px 48px rgba(0, 126, 255, 0.38),
        inset 0 1px 1px rgba(255, 255, 255, 0.16);
}

.launcher-logo {
    position: relative;
    z-index: 2;

    width: 72%;
    height: 72%;

    object-fit: contain;

    filter:
        drop-shadow(0 0 8px rgba(45, 170, 255, 0.6));

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.chat-launcher.is-open .launcher-logo {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

.brand-logo,
.message-avatar {
    padding: 5px;

    overflow: hidden;

    background:
        radial-gradient(
            circle,
            rgba(27, 149, 255, 0.18),
            transparent 70%
        ),
        #0b1a34;

    border: 1px solid rgba(65, 178, 255, 0.4);
}

.brand-logo img,
.message-avatar img,
.message-avatar-logo {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    filter:
        drop-shadow(0 0 6px rgba(42, 166, 255, 0.45));
}
