/* ==================================================
   RESET
================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


/* ==================================================
   BODY
================================================== */

body {
    font-family: Arial, Helvetica, sans-serif;

    background: #eef3f9;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #172033;
}


/* ==================================================
   CHAT CONTAINER
================================================== */

.chat-container {
    width: 100%;
    max-width: 620px;

    height: 92vh;
    max-height: 900px;

    background: #ffffff;

    border-radius: 22px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow:
        0 15px 45px rgba(15, 23, 42, 0.12);
}


/* ==================================================
   HEADER
================================================== */

.chat-header {
    background: #2864e8;

    color: #ffffff;

    padding: 17px 21px;

    display: flex;
    align-items: center;

    gap: 14px;

    flex-shrink: 0;
}


/* ==================================================
   LOGO
================================================== */

.school-logo {
    width: 64px;
    height: 64px;

    object-fit: contain;

    background: #ffffff;

    border-radius: 50%;

    padding: 4px;

    flex-shrink: 0;
}


/* ==================================================
   HEADER TEXT
================================================== */

.header-info {
    min-width: 0;
}

.header-info h2 {
    font-size: 21px;

    line-height: 1.25;

    font-weight: 700;

    margin-bottom: 5px;
}

.header-info p {
    display: flex;
    align-items: center;

    gap: 7px;

    font-size: 13px;

    color: #e8efff;
}


/* ==================================================
   ONLINE DOT
================================================== */

.online-dot {
    width: 8px;
    height: 8px;

    background: #22c55e;

    border-radius: 50%;

    display: inline-block;

    box-shadow:
        0 0 0 3px rgba(34, 197, 94, 0.18);
}


/* ==================================================
   CHAT AREA
================================================== */

#chat {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 17px 18px;

    background: #f7f9fc;

    scroll-behavior: smooth;
}


/* ==================================================
   SCROLLBAR
================================================== */

#chat::-webkit-scrollbar {
    width: 7px;
}

#chat::-webkit-scrollbar-track {
    background: transparent;
}

#chat::-webkit-scrollbar-thumb {
    background: #cbd5e1;

    border-radius: 10px;
}


/* ==================================================
   MESSAGE
================================================== */

.message {
    width: 100%;

    display: flex;

    margin-bottom: 12px;
}


/* ==================================================
   BOT MESSAGE
================================================== */

.message.bot {
    justify-content: flex-start;

    align-items: flex-start;

    gap: 8px;
}


/* ==================================================
   USER MESSAGE
================================================== */

.message.user {
    justify-content: flex-end;

    align-items: flex-start;
}


/* ==================================================
   BOT AVATAR
================================================== */

.bot-avatar {
    width: 38px;
    height: 38px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;

    border: 1px solid #dce5f0;

    border-radius: 50%;

    padding: 4px;
}

.bot-avatar img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    border-radius: 50%;
}


/* ==================================================
   MESSAGE BUBBLE
================================================== */

.message-content {
    max-width: 78%;

    padding: 15px 17px;

    border-radius: 17px;

    font-size: 14.5px;

    line-height: 1.5;

    /*
       Tetap dipakai untuk pesan dari bot,
       tetapi welcome-text akan override menjadi normal.
    */
    white-space: pre-line;

    word-break: break-word;

    height: auto;

    min-height: 0;
}


/* ==================================================
   BOT BUBBLE
================================================== */

.message.bot .message-content {
    background: #ffffff;

    color: #172033;

    border: 1px solid #dce5f0;

    border-bottom-left-radius: 5px;

    align-self: flex-start;

    height: auto;

    min-height: 0;
}


/* ==================================================
   USER BUBBLE
================================================== */

.message.user .message-content {
    max-width: 72%;

    background: #2864e8;

    color: #ffffff;

    padding: 12px 16px;

    border-radius: 17px;

    border-bottom-right-radius: 5px;
}


/* ==================================================
   BOLD
================================================== */

.message-content strong {
    font-weight: 700;
}


/* ==================================================
   LINKS
================================================== */

.message-content a {
    color: #2563eb;

    font-weight: 600;

    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}


/* ==================================================
   PESAN PEMBUKA
   INI BAGIAN PALING PENTING
================================================== */

.welcome-text {
    white-space: normal !important;

    margin: 0 !important;

    padding: 0 !important;
}


/*
   Hilangkan whitespace kosong dari formatting
   HTML di antara paragraf.
*/

.welcome-text p {
    white-space: normal !important;

    margin: 0 0 14px 0 !important;

    padding: 0 !important;

    line-height: 1.5;

    display: block;
}


.welcome-text p:first-child {
    margin-top: 0 !important;
}


.welcome-text p:last-child {
    margin-bottom: 0 !important;
}


/* ==================================================
   QUICK BUTTONS
================================================== */

.quick-buttons {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 8px;

    margin-top: 15px;

    padding-top: 12px;

    border-top: 1px solid #e5eaf2;
}


.quick-buttons button {
    appearance: none;
    -webkit-appearance: none;

    width: 100%;

    min-height: 45px;

    padding: 9px 8px;

    border: 1px solid #d7e2f0;

    border-radius: 12px;

    background: #f8fbff;

    color: #1d4ed8;

    font-family: inherit;

    font-size: 12.5px;

    font-weight: 500;

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}


.quick-buttons button:hover {
    background: #eff6ff;

    border-color: #93c5fd;

    box-shadow:
        0 4px 10px rgba(37, 99, 235, 0.08);

    transform: translateY(-1px);
}


.quick-buttons button:active {
    transform: scale(0.97);
}


/* ==================================================
   FOLLOW-UP BUTTONS
================================================== */

.follow-buttons {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 8px;

    margin-top: 13px;

    padding-top: 11px;

    border-top: 1px solid #e5eaf2;
}


/* ==================================================
   FOLLOW BUTTON
================================================== */

.follow-buttons button {
    appearance: none;
    -webkit-appearance: none;

    width: 100%;

    min-height: 42px;

    padding: 8px 9px;

    border: 1px solid #d7e1ef !important;

    border-radius: 12px !important;

    background: #f8fbff !important;

    color: #1d4ed8 !important;

    font-family: inherit;

    font-size: 12px;

    font-weight: 500;

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}


.follow-buttons button:hover {
    background: #eff6ff !important;

    border-color: #93c5fd !important;

    box-shadow:
        0 3px 8px rgba(37, 99, 235, 0.08);

    transform: translateY(-1px);
}


.follow-buttons button:active {
    transform: scale(0.97);
}


/* ==================================================
   ACTION BUTTON
================================================== */

.action-button {
    width: 100%;

    min-height: 42px;

    padding: 8px 9px;

    border: 1px solid #d7e1ef;

    border-radius: 12px;

    background: #f8fbff;

    color: #1d4ed8;

    font-family: inherit;

    font-size: 12px;

    font-weight: 500;

    text-decoration: none;

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}


.action-button:hover {
    background: #eff6ff;

    border-color: #93c5fd;

    box-shadow:
        0 3px 8px rgba(37, 99, 235, 0.08);

    transform: translateY(-1px);
}


.action-button:active {
    transform: scale(0.97);
}


/* ==================================================
   WHATSAPP
================================================== */

.whatsapp-button {
    color: #138a4b !important;

    background: #f3fff8 !important;

    border-color: #c9ecd9 !important;
}


.whatsapp-button:hover {
    background: #e8fff1 !important;

    border-color: #a9dfc0 !important;
}


/* ==================================================
   INPUT AREA
================================================== */

.chat-input {
    width: 100%;

    padding: 13px 15px;

    background: #ffffff;

    border-top: 1px solid #e2e8f0;

    display: flex;

    gap: 9px;

    flex-shrink: 0;
}


/* ==================================================
   INPUT
================================================== */

.chat-input input {
    flex: 1;

    min-width: 0;

    height: 48px;

    padding: 0 17px;

    border: 1px solid #cbd8e8;

    border-radius: 24px;

    outline: none;

    background: #ffffff;

    color: #172033;

    font-family: inherit;

    font-size: 14px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.chat-input input::placeholder {
    color: #94a3b8;
}


.chat-input input:focus {
    border-color: #2864e8;

    box-shadow:
        0 0 0 3px rgba(40, 100, 232, 0.10);
}


/* ==================================================
   SEND BUTTON
================================================== */

.chat-input button {
    height: 48px;

    min-width: 82px;

    padding: 0 17px;

    border: none;

    border-radius: 24px;

    background: #2864e8;

    color: #ffffff;

    font-family: inherit;

    font-size: 13px;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}


.chat-input button:hover {
    background: #1d55cf;
}


.chat-input button:active {
    transform: scale(0.96);
}


/* ==================================================
   MOBILE
================================================== */

@media (max-width: 700px) {

    body {
        background: #f7f9fc;

        align-items: stretch;
    }


    .chat-container {
        width: 100%;

        height: 100vh;

        max-height: none;

        border-radius: 0;

        box-shadow: none;
    }


    .chat-header {
        padding: 13px 15px;

        gap: 11px;
    }


    .school-logo {
        width: 54px;
        height: 54px;
    }


    .header-info h2 {
        font-size: 17px;

        line-height: 1.25;
    }


    .header-info p {
        font-size: 12px;
    }


    #chat {
        padding: 17px 11px;
    }


    .message-content {
        max-width: 84%;

        padding: 13px 14px;

        font-size: 13.5px;

        line-height: 1.55;
    }


    .message.user .message-content {
        max-width: 80%;

        padding: 11px 14px;
    }


    .bot-avatar {
        width: 34px;
        height: 34px;

        padding: 3px;
    }


    .quick-buttons {
        gap: 7px;

        margin-top: 13px;
    }


    .quick-buttons button {
        min-height: 43px;

        padding: 8px 5px;

        font-size: 11.5px;
    }


    .follow-buttons {
        gap: 7px;

        margin-top: 12px;

        padding-top: 10px;
    }


    .follow-buttons button,
    .action-button {
        min-height: 40px;

        padding: 7px 5px;

        font-size: 11px;

        border-radius: 10px !important;
    }


    .chat-input {
        padding: 10px;

        gap: 7px;
    }


    .chat-input input {
        height: 45px;

        font-size: 13.5px;

        padding: 0 15px;
    }


    .chat-input button {
        height: 45px;

        min-width: 70px;

        font-size: 12px;

        padding: 0 12px;
    }

}


/* ==================================================
   SMALL PHONE
================================================== */

@media (max-width: 400px) {

    .header-info h2 {
        font-size: 16px;
    }


    .school-logo {
        width: 50px;
        height: 50px;
    }


    .message-content {
        max-width: 86%;

        font-size: 13px;
    }


    .message.user .message-content {
        max-width: 82%;
    }


    .quick-buttons button,
    .follow-buttons button,
    .action-button {
        font-size: 10.5px;
    }
    /* ==================================================
   TOMBOL MULAI CHAT
================================================== */

.start-chat-button {
    width: 100%;

    height: 48px;

    border: none;

    border-radius: 9px;

    background: #2864e8;

    color: #ffffff;

    font-family: inherit;

    font-size: 16px;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
}


.start-chat-button:hover {
    background: #1d55cf;

    box-shadow:
        0 4px 12px rgba(40, 100, 232, 0.25);
}


.start-chat-button:active {
    transform: scale(0.98);
}


.start-chat-button:disabled {
    background: #9db9ea;

    cursor: not-allowed;

    box-shadow: none;
}


}