* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #eef3f8;
    color: #1f2937;
}

.page-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.chat-card {
    width: min(760px, 100%);
    height: min(860px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.15);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 18px 22px;
    color: #ffffff;
    background: #0f766e;
}

.chat-header h1 {
    margin: 0;
    font-size: 24px;
}

.chat-header p {
    margin: 4px 0 0;
    opacity: 0.9;
}

.status-dot {
    font-size: 13px;
}

.intro-panel {
    padding: 32px;
    overflow: auto;
}

.intro-panel h2 {
    margin-top: 0;
}

.intro-panel form {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.intro-panel input,
.chat-input textarea {
    width: 100%;
    padding: 13px;
    font: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
}

.intro-panel input:focus,
.chat-input textarea:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.intro-panel button,
.chat-input button {
    padding: 13px 20px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    background: #0f766e;
    border: 0;
    border-radius: 10px;
}

.intro-panel button:disabled,
.chat-input button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.chat-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.hidden {
    display: none;
}

.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
}

.message {
    display: flex;
    margin: 10px 0;
}

.message>div {
    max-width: 82%;
    padding: 12px 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    border-radius: 14px;
}

/*
 * Bubble bot memakai HTML terformat.
 * Jangan gunakan pre-wrap di sini karena akan menampilkan
 * spasi dari template literal JavaScript.
 */
.message.bot>div {
    height: auto;
    min-height: 0;
    color: #111827;
    white-space: normal;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

/*
 * Pesan pengguna tetap mempertahankan baris baru yang diketik.
 */
.message.user {
    justify-content: flex-end;
}

.message.user>div {
    color: #ffffff;
    white-space: pre-wrap;
    background: #0f766e;
    border-bottom-right-radius: 4px;
}

.bot-paragraph {
    margin: 0 0 8px;
    padding: 0;
    line-height: 1.55;
    white-space: normal;
}

.bot-paragraph:last-child {
    margin-bottom: 0;
}

.bot-bridge {
    margin-bottom: 12px;
}

.faq-answer {
    margin-top: 4px;
    white-space: normal;
}

.faq-title {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.faq-list {
    margin: 0;
    padding-left: 24px;
}

.faq-list li {
    margin-bottom: 5px;
    padding-left: 2px;
}

.faq-list li:last-child {
    margin-bottom: 0;
}

.message.bot strong {
    font-weight: 700;
}

.message.bot a,
.bot-paragraph a {
    display: inline;
    margin: 0;
    color: #0f766e;
    overflow-wrap: anywhere;
    text-decoration: underline;
}

.message.idle-message>div {
    font-size: 14px;
    color: #334155;
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
}

.message.goodbye-message>div {
    color: #475569;
    background: #f8fafc;
}

.typing {
    font-style: italic;
    opacity: 0.65;
}

.chat-input {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    padding: 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.chat-input textarea {
    min-height: 48px;
    max-height: 120px;
    resize: none;
}

.chat-input button {
    flex-shrink: 0;
}

.wa-link {
    flex-shrink: 0;
    padding: 0 14px 14px;
    font-size: 14px;
    color: #0f766e;
    text-align: center;
    text-decoration: none;
    background: #ffffff;
}

.wa-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .page-shell {
        padding: 0;
    }

    .chat-card {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .chat-header {
        padding: 16px 20px;
    }

    .chat-header h1 {
        font-size: 20px;
    }

    .messages {
        padding: 14px;
    }

    .message>div {
        max-width: 90%;
    }

    .chat-input {
        padding: 10px;
    }
}