/* Mintlify AI Chat Widget */

/* ----------------------------------------------------------------
   Toggle button
   ---------------------------------------------------------------- */

.mintlify-chat-toggle {
    --mintlify-accent: #0B5361;
    position: fixed;
    bottom: 2.4rem;
    right: 2.4rem;
    width: 4.8rem;
    height: 4.8rem;
    border-radius: 50%;
    background: var(--mintlify-accent);
    color: #fff;
    border: 0.2rem solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.4rem 1.4rem rgba(0, 0, 0, 0.3);
    z-index: 10500;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    animation: mintlify-toggle-attention 3s ease-in-out 2s 2;
}

.mintlify-chat-toggle:hover {
    background: var(--mintlify-accent);
    filter: brightness(1.15);
    transform: scale(1.1);
    box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.35);
}

@keyframes mintlify-toggle-attention {
    0%, 100% {
        box-shadow: 0 0.4rem 1.4rem rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(43, 58, 74, 0.4);
    }
    50% {
        box-shadow: 0 0.4rem 1.4rem rgba(0, 0, 0, 0.3), 0 0 0 0.8rem rgba(43, 58, 74, 0);
    }
}

/* ----------------------------------------------------------------
   Panel (light mode base)
   ---------------------------------------------------------------- */

.mintlify-chat-panel {
    --mintlify-accent: #0B5361;
    display: none;
    position: fixed;
    bottom: 8rem;
    right: 2.4rem;
    width: 38rem;
    height: 50rem;
    background: #fff;
    color: #1a1a1a;
    border-radius: 1.2rem;
    box-shadow: 0 0.8rem 3rem rgba(0, 0, 0, 0.2);
    z-index: 10500;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: width 0.25s ease, height 0.25s ease, bottom 0.25s ease, right 0.25s ease, border-radius 0.25s ease;
}

.mintlify-chat-panel.is-open {
    display: flex;
}

.mintlify-chat-panel.is-expanded {
    width: 70rem;
    height: 80vh;
    bottom: 2.4rem;
    right: 2.4rem;
}

/* ----------------------------------------------------------------
   Header
   ---------------------------------------------------------------- */

.mintlify-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem 1.6rem;
    background: var(--mintlify-accent, #0B5361);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 600;
    flex-shrink: 0;
}

.mintlify-chat-header-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.mintlify-chat-header-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.mintlify-chat-expand,
.mintlify-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.mintlify-chat-expand:hover,
.mintlify-chat-close:hover {
    opacity: 1;
}

.mintlify-chat-expand svg {
    width: 1.4rem;
    height: 1.4rem;
    display: block;
}

.mintlify-chat-close {
    font-size: 1.8rem;
}

/* ----------------------------------------------------------------
   Messages area
   ---------------------------------------------------------------- */

.mintlify-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: #fff;
}

.mintlify-chat-message {
    max-width: 85%;
    padding: 1rem 1.4rem;
    border-radius: 1.2rem;
    font-size: 1.3rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.mintlify-chat-message.user {
    align-self: flex-end;
    background: #e8f0fe;
    color: #1a1a1a;
    border-bottom-right-radius: 0.4rem;
}

.mintlify-chat-message.assistant {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1a1a1a;
    border-bottom-left-radius: 0.4rem;
}

/* Streaming cursor — blinking caret at the end of the last line of text */
.mintlify-chat-message.assistant.is-streaming > *:last-child::after {
    content: '';
    display: inline-block;
    width: 0.2rem;
    height: 1em;
    background: var(--mintlify-accent, #0B5361);
    margin-left: 0.2rem;
    vertical-align: text-bottom;
    animation: mintlify-cursor-blink 0.6s steps(2) infinite;
}

@keyframes mintlify-cursor-blink {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.mintlify-chat-message.assistant p {
    margin: 0 0 0.8rem 0;
}

.mintlify-chat-message.assistant p:last-child {
    margin-bottom: 0;
}

.mintlify-chat-message.assistant strong {
    font-weight: 600;
}

.mintlify-chat-message.assistant code {
    background: #e5e7eb;
    padding: 0.1rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 1.2rem;
}

.mintlify-chat-message.assistant pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem 1.2rem;
    border-radius: 0.6rem;
    overflow-x: auto;
    margin: 0.8rem 0;
    font-size: 1.2rem;
    line-height: 1.4;
}

.mintlify-chat-message.assistant pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.mintlify-chat-message.assistant a {
    color: #2563eb;
    text-decoration: none;
}

.mintlify-chat-message.assistant a:hover {
    text-decoration: underline;
}

.mintlify-chat-message.assistant ul,
.mintlify-chat-message.assistant ol {
    margin: 0.4rem 0;
    padding-left: 2rem;
}

.mintlify-chat-message.assistant li {
    margin-bottom: 0.2rem;
}

/* ----------------------------------------------------------------
   Sources
   ---------------------------------------------------------------- */

.mintlify-chat-sources {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 0.1rem solid #e5e7eb;
    font-size: 1.1rem;
    color: #6b7280;
}

.mintlify-chat-sources a {
    color: #2563eb;
    text-decoration: none;
}

.mintlify-chat-sources a:hover {
    text-decoration: underline;
}

/* ----------------------------------------------------------------
   Typing indicator
   ---------------------------------------------------------------- */

.mintlify-chat-typing {
    align-self: flex-start;
    padding: 1rem 1.4rem;
    background: #f3f4f6;
    border-radius: 1.2rem;
    border-bottom-left-radius: 0.4rem;
    font-size: 1.3rem;
    color: #9ca3af;
}

.mintlify-chat-typing span {
    animation: mintlify-dot-pulse 1.4s infinite ease-in-out both;
}

.mintlify-chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.mintlify-chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes mintlify-dot-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
    }
    40% {
        opacity: 1;
    }
}

/* ----------------------------------------------------------------
   Input area
   ---------------------------------------------------------------- */

.mintlify-chat-input-area {
    display: flex;
    align-items: flex-end;
    padding: 1.2rem;
    border-top: 0.1rem solid #e5e7eb;
    background: #fafafa;
    flex-shrink: 0;
}

.mintlify-chat-input {
    flex: 1;
    border: 0.1rem solid #d1d5db;
    border-radius: 0.8rem;
    padding: 0.8rem 1.2rem;
    font-size: 1.3rem;
    outline: none;
    font-family: inherit;
    resize: none;
    height: 3.6rem;
    max-height: 8rem;
    overflow: hidden;
    background: #fff;
    color: #1a1a1a;
}

.mintlify-chat-input:focus {
    border-color: var(--mintlify-accent, #0B5361);
    box-shadow: 0 0 0 0.2rem rgba(43, 58, 74, 0.15);
}

.mintlify-chat-send {
    margin-left: 0.8rem;
    width: 3.6rem;
    height: 3.6rem;
    padding: 0;
    background: var(--mintlify-accent, #0B5361);
    color: #fff;
    border: none;
    border-radius: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, filter 0.2s;
}

.mintlify-chat-send:hover {
    background: var(--mintlify-accent, #0B5361);
    filter: brightness(1.15);
}

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

.mintlify-chat-send svg {
    width: 1.6rem;
    height: 1.6rem;
    fill: currentColor;
}

/* ----------------------------------------------------------------
   Welcome
   ---------------------------------------------------------------- */

.mintlify-chat-welcome {
    text-align: center;
    color: #6b7280;
    font-size: 1.3rem;
    padding: 2rem;
    line-height: 1.5;
}

/* ----------------------------------------------------------------
   Dark mode
   ---------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
    .mintlify-chat-toggle {
        background: var(--mintlify-accent);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 0.4rem 1.4rem rgba(0, 0, 0, 0.5);
    }

    .mintlify-chat-toggle:hover {
        background: var(--mintlify-accent);
    }

    .mintlify-chat-panel {
        background: #1e1e1e;
        color: #e0e0e0;
        box-shadow: 0 0.8rem 3rem rgba(0, 0, 0, 0.5);
    }

    .mintlify-chat-header {
        background: var(--mintlify-accent, #0B5361);
    }

    .mintlify-chat-messages {
        background: #1e1e1e;
    }

    .mintlify-chat-message.user {
        background: #253a52;
        color: #e0e0e0;
    }

    .mintlify-chat-message.assistant {
        background: #2a2a2a;
        color: #e0e0e0;
    }

    .mintlify-chat-message.assistant.is-streaming > *:last-child::after {
        background: #9ca3af;
    }

    .mintlify-chat-message.assistant code {
        background: #374151;
        color: #e5e7eb;
    }

    .mintlify-chat-message.assistant pre {
        background: #111827;
    }

    .mintlify-chat-message.assistant a {
        color: #60a5fa;
    }

    .mintlify-chat-sources {
        border-top-color: #374151;
        color: #9ca3af;
    }

    .mintlify-chat-sources a {
        color: #60a5fa;
    }

    .mintlify-chat-typing {
        background: #2a2a2a;
        color: #6b7280;
    }

    .mintlify-chat-input-area {
        background: #252525;
        border-top-color: #374151;
    }

    .mintlify-chat-input {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #4b5563;
    }

    .mintlify-chat-input:focus {
        border-color: var(--mintlify-accent, #0B5361);
        box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.2);
    }

    .mintlify-chat-input::placeholder {
        color: #6b7280;
    }

    .mintlify-chat-send {
        background: var(--mintlify-accent, #0B5361);
    }

    .mintlify-chat-send:hover {
        background: var(--mintlify-accent, #0B5361);
    }

    .mintlify-chat-welcome {
        color: #9ca3af;
    }
}
