@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("vendor/fonts/plus-jakarta-sans-700.woff2") format("woff2");
}

:root {
    --mg-bg: #eef1f6;
    --mg-bg-accent-1: #dbe4ff;
    --mg-bg-accent-2: #eef1f6;
    --mg-surface: #ffffff;
    --mg-surface-alt: #f4f5f7;
    --mg-border: #e6e8ec;
    --mg-text: #1f2430;
    --mg-text-muted: #6b7280;
    --mg-primary: #4f5fff;
    --mg-primary-dark: #3d4ce0;
    --mg-primary-contrast: #ffffff;
    --mg-shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.05), 0 1px 3px rgba(20, 24, 40, 0.06);
    --mg-shadow-md: 0 8px 24px rgba(30, 41, 82, 0.08);
    --mg-radius-lg: 20px;
    --mg-radius-md: 14px;
    --mg-radius-pill: 999px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --mg-bg: #14161f;
        --mg-bg-accent-1: #1c1f3a;
        --mg-bg-accent-2: #14161f;
        --mg-surface: #1b1e29;
        --mg-surface-alt: #23273580;
        --mg-border: #2b2f3d;
        --mg-text: #e7e9f0;
        --mg-text-muted: #9096a8;
        --mg-primary: #7c8cff;
        --mg-primary-dark: #5f6fe8;
        --mg-primary-contrast: #ffffff;
        --mg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.3);
        --mg-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    }
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--mg-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(1100px 520px at 12% -10%, var(--mg-bg-accent-1) 0%, transparent 60%),
        radial-gradient(900px 460px at 110% 10%, color-mix(in srgb, var(--mg-primary) 12%, transparent) 0%, transparent 55%),
        var(--mg-bg);
    display: flex;
    flex-direction: column;
}

.mg-navbar {
    flex: 0 0 auto;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--mg-surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--mg-border);
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
}

.mg-navbar .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--mg-text);
    letter-spacing: 0.01em;
}

.mg-navbar .brand i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.95rem;
    height: 2.25rem;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    color: var(--mg-primary-contrast);
    background: linear-gradient(135deg, var(--mg-primary), #8b6bff);
    font-size: 1.05rem;
    filter: drop-shadow(0 1px 2px rgba(20, 24, 40, 0.12)) drop-shadow(0 1px 3px rgba(20, 24, 40, 0.1));
}

.mg-navbar #docsChatRestart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border-radius: 50%;
    border-color: var(--mg-border);
    color: var(--mg-text-muted);
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mg-navbar #docsChatRestart:hover {
    color: var(--mg-primary);
    border-color: var(--mg-primary);
    background: var(--mg-surface);
    box-shadow: var(--mg-shadow-sm);
    transform: translateY(-1px);
}

.mg-navbar #docsChatRestart i {
    transition: transform 0.35s ease;
}

.mg-navbar #docsChatRestart:hover i {
    transform: rotate(-70deg);
}

.mg-navbar #docsChatRestart:focus,
.mg-navbar #docsChatRestart:active,
.mg-navbar #docsChatRestart.active,
.mg-navbar #docsChatRestart:not(:disabled):not(.disabled):active {
    color: var(--mg-text-muted);
    background: var(--mg-surface);
    border-color: var(--mg-border);
    box-shadow: none;
    transform: none;
}

.mg-navbar #docsChatRestart:focus-visible {
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--mg-primary) 25%, transparent);
}

.docs-chat-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.docs-chat-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.docs-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding: 2rem 1.25rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    scrollbar-width: thin;
    scrollbar-color: var(--mg-border) transparent;
}

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

.docs-chat-messages::-webkit-scrollbar-thumb {
    background: var(--mg-border);
    border-radius: var(--mg-radius-pill);
}

@keyframes mg-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.docs-chat-msg {
    max-width: 85%;
    padding: 0.8rem 1.05rem;
    border-radius: var(--mg-radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: var(--mg-shadow-sm);
    animation: mg-rise 0.28s ease both;
}

.docs-chat-msg p {
    margin: 0 0 0.4rem;
}

.docs-chat-msg p:last-child {
    margin-bottom: 0;
}

.docs-chat-msg ul {
    margin: 0 0 0.4rem;
    padding-left: 1.15rem;
}

.docs-chat-msg code {
    background: color-mix(in srgb, var(--mg-text) 8%, transparent);
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    font-size: 0.85em;
}

.docs-chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--mg-primary), #8b6bff);
    color: var(--mg-primary-contrast);
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.docs-chat-msg.user code {
    background: rgba(255, 255, 255, 0.18);
}

.docs-chat-msg.assistant {
    align-self: flex-start;
    background: var(--mg-surface);
    border: 1px solid var(--mg-border);
    color: var(--mg-text);
    border-bottom-left-radius: 4px;
}

.docs-chat-msg.assistant.has-form,
.docs-chat-msg.assistant.has-video {
    max-width: 95%;
}

.docs-chat-typing {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.9rem 1.05rem;
}

.docs-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mg-text-muted);
    opacity: 0.5;
    animation: mg-typing-bounce 1s ease-in-out infinite;
}

.docs-chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.docs-chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes mg-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
    .docs-chat-msg,
    .docs-chat-options .docs-chat-option-btn,
    .docs-chat-typing-dot {
        animation: none !important;
    }
    .docs-chat-messages {
        scroll-behavior: auto;
    }
}

.docs-chat-widget-form {
    margin-top: 0.5rem;
}

.docs-chat-widget-form .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--mg-text-muted);
}

.docs-chat-widget-form .form-control {
    font-size: 0.855rem;
    background: var(--mg-surface-alt);
    border-color: var(--mg-border);
    color: var(--mg-text);
    border-radius: 10px;
}

.docs-chat-widget-form .form-control:focus {
    border-color: var(--mg-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--mg-primary) 20%, transparent);
}

.docs-chat-widget-form .btn {
    border-radius: var(--mg-radius-pill);
}

.docs-chat-video {
    position: relative;
    width: 100%;
    max-width: 780px;
    aspect-ratio: 16 / 9;
    margin: 0.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--mg-shadow-sm);
    animation: mg-rise 0.35s ease both;
}

.docs-chat-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.docs-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.2rem;
    align-self: flex-start;
    max-width: 100%;
}

.docs-chat-options .docs-chat-option-btn {
    animation: mg-rise 0.26s ease both;
}

.docs-chat-options .docs-chat-option-btn:nth-child(1) { animation-delay: 0.02s; }
.docs-chat-options .docs-chat-option-btn:nth-child(2) { animation-delay: 0.06s; }
.docs-chat-options .docs-chat-option-btn:nth-child(3) { animation-delay: 0.1s; }
.docs-chat-options .docs-chat-option-btn:nth-child(4) { animation-delay: 0.14s; }
.docs-chat-options .docs-chat-option-btn:nth-child(5) { animation-delay: 0.18s; }
.docs-chat-options .docs-chat-option-btn:nth-child(6) { animation-delay: 0.22s; }
.docs-chat-options .docs-chat-option-btn:nth-child(n+7) { animation-delay: 0.26s; }

.docs-chat-option-btn {
    border: 1.5px solid var(--mg-primary);
    background: var(--mg-surface);
    color: var(--mg-primary);
    border-radius: var(--mg-radius-pill);
    padding: 0.45rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--mg-shadow-sm);
    transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.docs-chat-option-btn:hover {
    background: var(--mg-primary);
    color: var(--mg-primary-contrast);
    transform: translateY(-2px);
    box-shadow: var(--mg-shadow-md);
}

.docs-chat-option-btn:active {
    transform: translateY(0) scale(0.96);
}

.docs-chat-option-back {
    border-color: var(--mg-border);
    color: var(--mg-text-muted);
    background: var(--mg-surface-alt);
}

.docs-chat-option-back:hover {
    background: var(--mg-text-muted);
    border-color: var(--mg-text-muted);
    color: var(--mg-primary-contrast);
}

.docs-chat-empty {
    margin: auto;
    text-align: center;
    color: var(--mg-text-muted);
}

.docs-chat-empty i {
    font-size: 2.25rem;
    display: block;
    margin-bottom: 0.6rem;
    opacity: 0.7;
}
