/* =========================================================================
   INFO-MEAWTION — Ask-Bot (น้องเมี๊ยว AI) chat interface
   ========================================================================= */

:root {
    --ab-red: #e53637;
    --ab-red-dark: #c62828;
    --ab-bg: #0f1115;
    --ab-panel: #171a21;
    --ab-panel-2: #1f232c;
    --ab-border: rgba(255, 255, 255, 0.08);
    --ab-text: #e9edf1;
    --ab-text-dim: #9aa4b2;
    --ab-user: #e53637;
    --ab-bot: #232833;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: "Mulish", "Sarabun", "Prompt", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--ab-bg);
    color: var(--ab-text);
    -webkit-font-smoothing: antialiased;
}

/* ----- Layout ----------------------------------------------------------- */
.askbot {
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
    transform-origin: top center;
    will-change: height, transform;
}

.askbot__inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 820px;
    height: 100%;
    background: var(--ab-panel);
    border-left: 1px solid var(--ab-border);
    border-right: 1px solid var(--ab-border);
}

/* ----- Header ----------------------------------------------------------- */
.askbot__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(229, 54, 55, 0.18), rgba(0, 0, 0, 0.25));
    border-bottom: 1px solid var(--ab-border);
    backdrop-filter: blur(6px);
}

.askbot__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--ab-text);
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.askbot__back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.askbot__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.askbot__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    /* background: linear-gradient(135deg, var(--ab-red), var(--ab-red-dark)); */
    color: #fff;
    font-size: 24px;
    flex-shrink: 0;
    /* box-shadow: 0 4px 14px rgba(229, 54, 55, 0.4); */
    overflow: hidden;
}

.askbot__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.askbot__brand-text {
    min-width: 0;
}

.askbot__title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
}

.askbot__version {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    vertical-align: middle;
    border-radius: 999px;
    background: rgba(229, 54, 55, 0.16);
    color: var(--ab-red);
}

.askbot__subtitle {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--ab-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.askbot__status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #35c759;
    box-shadow: 0 0 0 3px rgba(53, 199, 89, 0.2);
    flex-shrink: 0;
}

/* ----- Messages area ---------------------------------------------------- */
.askbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.askbot__messages::-webkit-scrollbar {
    width: 8px;
}

.askbot__messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

/* ----- Welcome block ---------------------------------------------------- */
.askbot__welcome {
    text-align: center;
    padding: 30px 16px 10px;
    color: var(--ab-text);
}

.askbot__welcome-icon {
    width: 180px;
    height: 180px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(229, 54, 55, 0.4);
    overflow: hidden;
}

.askbot__welcome-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.askbot__welcome h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
}

.askbot__welcome p {
    margin: 0 auto 20px;
    max-width: 460px;
    color: var(--ab-text-dim);
    font-size: 14px;
    line-height: 1.6;
}

.askbot__suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
}

.askbot__chip {
    padding: 9px 16px;
    border-radius: 30px;
    border: 1px solid var(--ab-border);
    background: var(--ab-panel-2);
    color: var(--ab-text);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.askbot__chip:hover {
    border-color: var(--ab-red);
    background: rgba(229, 54, 55, 0.14);
    color: #fff;
    transform: translateY(-1px);
}

/* ----- Message rows ----------------------------------------------------- */
.askbot__msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: ab-fade-in 0.25s ease;
}

.askbot__msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.askbot__msg-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #fff;
    overflow: hidden;
}

.askbot__msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.askbot__msg--user .askbot__msg-avatar {
    background: #3a4150;
}

.askbot__bubble {
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.askbot__msg--bot .askbot__bubble {
    background: var(--ab-bot);
    border: 1px solid var(--ab-border);
    border-top-left-radius: 4px;
    color: var(--ab-text);
}

.askbot__msg--user .askbot__bubble {
    background: linear-gradient(135deg, var(--ab-red), var(--ab-red-dark));
    border-top-right-radius: 4px;
    color: #fff;
}

/* Markdown content inside bubbles */
.askbot__bubble p {
    margin: 0 0 10px;
}

.askbot__bubble p:last-child {
    margin-bottom: 0;
}

.askbot__bubble ul,
.askbot__bubble ol {
    margin: 6px 0;
    padding-left: 20px;
}

.askbot__bubble li {
    margin-bottom: 6px;
}

.askbot__bubble a {
    color: #ff9d9d;
    font-weight: 700;
    text-decoration: underline;
}

.askbot__msg--user .askbot__bubble a {
    color: #fff;
}

.askbot__bubble code {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.9em;
}

.askbot__bubble strong {
    color: #fff;
}

/* ----- Source cards ----------------------------------------------------- */
.askbot__sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.askbot__source {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 10px;
    background: var(--ab-panel-2);
    border: 1px solid var(--ab-border);
    text-decoration: none;
    color: var(--ab-text);
    font-size: 12.5px;
    max-width: 220px;
    transition: border-color 0.2s, transform 0.2s;
}

.askbot__source:hover {
    border-color: var(--ab-red);
    transform: translateY(-1px);
}

.askbot__source img {
    width: 30px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    background: #000;
}

.askbot__source-name {
    font-weight: 700;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.askbot__source-type {
    color: var(--ab-text-dim);
    font-size: 11px;
}

/* ----- Typing indicator ------------------------------------------------- */
.askbot__typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.askbot__typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ab-text-dim);
    animation: ab-bounce 1.2s infinite ease-in-out;
}

.askbot__typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.askbot__typing span:nth-child(3) {
    animation-delay: 0.3s;
}

/* ----- Input form ------------------------------------------------------- */
.askbot__form {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--ab-border);
    background: var(--ab-panel);
}

.askbot__input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--ab-panel-2);
    border: 1px solid var(--ab-border);
    border-radius: 24px;
    padding: 6px 6px 6px 16px;
    transition: border-color 0.2s;
}

.askbot__input-wrap:focus-within {
    border-color: var(--ab-red);
}

.askbot__input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--ab-text);
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    max-height: 140px;
    padding: 6px 0;
}

.askbot__input::placeholder {
    color: var(--ab-text-dim);
}

.askbot__send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ab-red), var(--ab-red-dark));
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.2s;
}

.askbot__send:hover:not(:disabled) {
    transform: scale(1.06);
}

.askbot__send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.askbot__note {
    margin: 8px 0 0;
    text-align: center;
    font-size: 11px;
    color: var(--ab-text-dim);
}

/* ----- Animations ------------------------------------------------------- */
@keyframes ab-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ab-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ----- Responsive ------------------------------------------------------- */
@media (max-width: 600px) {
    .askbot__inner {
        border-left: none;
        border-right: none;
    }

    .askbot__msg {
        max-width: 94%;
    }

    .askbot__title {
        font-size: 16px;
    }
}

/* ----- Notice overlay (bottom-right) ------------------------------------ */
.askbot__notice {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 340px;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--ab-panel-2), var(--ab-panel));
    border: 1px solid var(--ab-border);
    border-left: 3px solid var(--ab-red);
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    color: var(--ab-text);
    animation: askbot-notice-in 0.4s ease both;
}

@keyframes askbot-notice-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.askbot__notice--hidden {
    display: none;
}

.askbot__notice-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(229, 54, 55, 0.16);
    color: var(--ab-red);
    font-size: 16px;
}

.askbot__notice-body {
    flex: 1;
    min-width: 0;
}

.askbot__notice-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
}

.askbot__notice-text {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ab-text-dim);
}

.askbot__notice-text + .askbot__notice-text {
    margin-top: 6px;
}

.askbot__notice-text strong {
    color: var(--ab-text);
}

.askbot__notice-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ab-text-dim);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.askbot__notice-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ab-text);
}

@media (max-width: 600px) {
    .askbot__notice {
        right: 12px;
        left: 12px;
        bottom: 12px;
        max-width: none;
    }
}