:root {
    --bg: #eef5fb;
    --bg-2: #f7fbfe;
    --card: rgba(255, 255, 255, 0.94);
    --card-solid: #ffffff;
    --border: #d8e5ef;
    --border-soft: #e8f0f6;
    --text: #18324a;
    --muted: #6f879c;
    --primary: #2493ff;
    --primary-dark: #1476d2;
    --primary-soft: #e9f5ff;
    --danger: #e34b4b;
    --danger-dark: #bf2f2f;
    --success: #24b05a;
    --success-dark: #178243;
    --shadow: 0 12px 34px rgba(66, 106, 138, 0.12);
    --shadow-soft: 0 8px 22px rgba(66, 106, 138, 0.08);
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(125, 203, 255, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(168, 221, 255, 0.18), transparent 30%),
        linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
    color: var(--text);
}

body {
    overflow-x: hidden;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.chat-app {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 12px;
}

.app-header {
    padding: 4px 2px 12px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #57b8ff 0%, #2493ff 100%);
    box-shadow: 0 8px 20px rgba(36, 147, 255, 0.22);
}

.app-brand-text h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 800;
}

.app-brand-text p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.chat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chat-body,
#chatBody {
    min-height: 220px;
    padding: 14px 12px 10px 42px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    position: relative;
    max-width: 92%;
    padding: 12px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: var(--shadow-soft);
    animation: fadeUp 0.22s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: var(--card-solid);
    border: 1px solid #dbe8f1;
    border-bottom-left-radius: 8px;
}

.message.bot::before {
    content: "NL";
    position: absolute;
    left: -28px;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 7px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #57b8ff 0%, #2493ff 100%);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #d7efff 0%, #bfe4ff 100%);
    border: 1px solid #cde5f8;
    border-bottom-right-radius: 8px;
}

.chat-footer,
#chatFooter {
    padding: 12px;
    border-top: 1px solid var(--border);
    background: #fbfdff;
    display: grid;
    gap: 8px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder {
    color: #8ba0b2;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #a8d8ff;
    box-shadow: 0 0 0 4px rgba(36, 147, 255, 0.10);
}

button,
.chat-footer button,
.chat-overlay-footer button {
    min-height: 46px;
    padding: 11px 14px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 8px 18px rgba(36, 147, 255, 0.18);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover,
.chat-footer button:hover,
.chat-overlay-footer button:hover {
    transform: translateY(-1px);
}

button:active,
.chat-footer button:active,
.chat-overlay-footer button:active {
    transform: translateY(0);
}

button.secondary,
.chat-footer button.secondary,
.chat-overlay-footer button.secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

/* ✅ Agree buttons + I read / Close */
button.btn-agree,
.chat-footer button.btn-agree,
.chat-overlay-footer button.btn-agree {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    border: none;
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.22);
}

button.btn-agree:hover,
.chat-footer button.btn-agree:hover,
.chat-overlay-footer button.btn-agree:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: #fff;
}

/* ⚠️ Doubt button */
button.btn-doubt,
.chat-footer button.btn-doubt,
.chat-overlay-footer button.btn-doubt {
    background: linear-gradient(135deg, #facc15 0%, #eab308 100%);
    color: #111827;
    border: none;
    box-shadow: 0 8px 18px rgba(250, 204, 21, 0.28);
}

button.btn-doubt:hover,
.chat-footer button.btn-doubt:hover,
.chat-overlay-footer button.btn-doubt:hover {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: #111827;
}

/* ❌ Not proceed button */
button.btn-danger,
.chat-footer button.btn-danger,
.chat-overlay-footer button.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    border: none;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
}

button.btn-danger:hover,
.chat-footer button.btn-danger:hover,
.chat-overlay-footer button.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    color: #fff;
}

.button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}



.detail-wait-box {
    padding: 12px;
    border-radius: 14px;
    background: #f2f9ff;
    border: 1px solid #dbeaf5;
}

.countdown-text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.5;
}

.countdown-text #countdownValue {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #57b8ff 0%, #2493ff 100%);
}

.reset-wrap {
    padding: 10px 4px 18px;
    display: flex;
    justify-content: center;
}

/* 🔁 Restart again (Orange text, not button) */
.reset-text {
    min-height: auto;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #f97316; /* orange */
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: pointer;
    line-height: 1.4;
}

.reset-text:hover {
    text-decoration: underline;
    transform: none;
    box-shadow: none;
}


.chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(216, 230, 241, 0.72);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.chat-overlay.hidden {
    display: none;
}

.chat-overlay-box {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.chat-overlay-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: #f8fbfe;
}

.chat-overlay-title {
    font-size: 16px;
    font-weight: 800;
}

.chat-overlay-close {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.chat-overlay-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-overlay-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.chat-overlay-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(248,251,254,0.9), #f8fbfe);
    backdrop-filter: blur(6px);
}

.chat-overlay-footer button {
    width: 100%;
    min-height: 50px;
    font-size: 14px;
    font-weight: 800;
    border-radius: 14px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 60%, #15803d 100%);
    box-shadow: 0 10px 24px rgba(34, 197, 94, 0.25);
}

.chat-overlay-footer button:active {
    transform: scale(0.98);
}

body.overlay-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    .chat-app {
        padding: 18px;
    }

    .app-header {
        padding-bottom: 14px;
    }

    .app-logo {
        width: 48px;
        height: 48px;
    }

    .app-brand-text h1 {
        font-size: 20px;
    }

    .app-brand-text p {
        font-size: 13px;
    }

    .chat-body,
    #chatBody {
        min-height: 280px;
        padding: 18px 16px 10px 48px;
    }

    .message {
        max-width: 80%;
        font-size: 14px;
    }

    .button-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .button-row button:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .chat-overlay {
        padding: 20px;
        align-items: center;
        justify-content: center;
    }

    .chat-overlay-box {
        width: min(1000px, 96vw);
        height: min(88vh, 900px);
        border-radius: 20px;
        overflow: hidden;
        border: 1px solid var(--border);
        box-shadow: 0 18px 50px rgba(50, 100, 140, 0.16);
    }
}

@media (max-width: 768px) {
    .chat-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .chat-overlay-box {
        height: 100vh;
        height: 100dvh;
    }

    .chat-overlay-header {
        flex-shrink: 0;
        padding: 12px 10px;
    }

    .chat-overlay-body {
        flex: 1;
        min-height: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chat-overlay-footer {
        position: sticky;
        bottom: 0;
        z-index: 5;
        background: #f8fbfe;
    }
}


.final-contact-box {
    display: grid;
    gap: 10px;
}

.final-contact-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-top: 4px;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    color: #fff;
}

.email-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.whatsapp-btn {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
}

button,
.contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}





