* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --grad: linear-gradient(135deg, #213360 0%, #006837 100%);
    --accent: #0a8a4c;
    --accent-dark: #006837;
    --ink: #16264a;
    --soft: #eef5f1;
    --line: #d6e6dd;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #213360 0%, #0e5a4a 55%, #2f9a68 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container { max-width: 720px; width: 100%; }

.header { text-align: center; color: white; margin-bottom: 20px; }

.header h1 {
    font-size: 30px;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
}

.brand-sub-inline { font-size: .52em; font-weight: 600; opacity: .9; letter-spacing: .05em; vertical-align: middle; }

.header p { font-size: 16px; opacity: 0.92; }

.header-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

.pill-btn {
    background: rgba(255,255,255,0.18);
    color: #fff; text-decoration: none;
    border: 1.5px solid rgba(255,255,255,0.55);
    padding: 9px 18px; border-radius: 22px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    backdrop-filter: blur(4px); transition: all 0.2s ease;
}
.pill-btn:hover { background: #fff; color: var(--accent-dark); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.22); }

.chatbot-container {
    background: white; border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden; height: 560px; display: flex; flex-direction: column;
}

.chat-messages { flex: 1; overflow-y: auto; padding: 25px; display: flex; flex-direction: column; gap: 20px; }

.message { display: flex; gap: 12px; animation: fadeIn 0.3s ease-in; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
/* Bot avatar: the symbol from the top of the clinic logo */
.bot-message .avatar { background: #fff url(neelkuthi-logo.png) center 8% / 135% no-repeat; border: 1.5px solid var(--line); }

.message-body { display: flex; flex-direction: column; gap: 8px; max-width: 80%; min-width: 0; }

.user-message { justify-content: flex-end; }
.user-message .message-body { order: 1; align-items: flex-end; }
.user-message .avatar { order: 2; background: #e9a23b; }

.message-content { max-width: 100%; padding: 12px 16px; border-radius: 18px; line-height: 1.5; font-size: 15px; }
.user-message .message-content { background: var(--grad); color: white; border-bottom-right-radius: 6px; }
.bot-message .message-content { background: var(--soft); color: #24362f; border-bottom-left-radius: 6px; }

.message-content a { color: var(--accent-dark); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(0,104,55,0.35); }
.message-content a:hover { border-bottom-color: var(--accent-dark); }
.user-message .message-content a { color: #fff; border-bottom-color: rgba(255,255,255,0.6); }

.message-content p { margin: 0 0 8px; }
.message-content p:last-child { margin-bottom: 0; }
.msg-heading { font-size: 15px; font-weight: 700; margin: 4px 0 6px; color: var(--ink); }
.message-content .msg-list { margin: 4px 0 8px; padding-left: 22px; }
.message-content .msg-list:last-child { margin-bottom: 0; }
.message-content .msg-list li { margin: 4px 0; line-height: 1.5; }
.message-content ol.msg-list { list-style: decimal; }
.message-content ul.msg-list { list-style: none; padding-left: 4px; }
.message-content ul.msg-list li { position: relative; padding-left: 18px; }
.message-content ul.msg-list li::before { content: "•"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }

/* Source chips under bot answers (link to the site page) */
.sources { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-left: 4px; }
.sources-label { font-size: 11px; color: #7f948b; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.source-chip {
    font-size: 11.5px; color: #2f5a4b; background: var(--soft); text-decoration: none;
    border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-chip:hover { background: var(--accent); color: #fff; border-color: transparent; }

.typing-indicator { display: flex; gap: 6px; padding: 14px 18px; }
.typing-indicator span { width: 8px; height: 8px; background: #a9c9bf; border-radius: 50%; animation: typing 1.4s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-10px); opacity: 1; } }

.chat-input-container { padding: 20px; border-top: 2px solid #eef3f0; display: flex; gap: 12px; background: white; }
#user-input {
    flex: 1; padding: 14px 18px; border: 2px solid var(--line); border-radius: 25px;
    font-size: 15px; outline: none; transition: all 0.3s; font-family: inherit;
}
#user-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,138,76,0.15); }

#send-button {
    width: 50px; height: 50px; background: var(--grad); color: white; border: none;
    border-radius: 50%; cursor: pointer; font-size: 20px; transition: all 0.3s;
    display: flex; align-items: center; justify-content: center;
}
#send-button:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 5px 15px rgba(10,138,76,0.4); }
#send-button:disabled { background: #ccc; cursor: not-allowed; opacity: 0.6; }

.status { text-align: center; padding: 8px; font-size: 12px; color: #666; background: #f6faf8; }

.quick-questions { background: white; border-radius: 15px; padding: 20px; margin-top: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.quick-questions h3 { color: var(--ink); font-size: 16px; margin-bottom: 12px; }
.quick-btn {
    background: var(--soft); border: 2px solid var(--line); padding: 10px 16px; border-radius: 20px;
    margin: 5px; cursor: pointer; font-size: 13px; transition: all 0.3s; color: #35524a;
}
.quick-btn:hover { background: var(--grad); color: white; border-color: transparent; transform: translateY(-2px); }

.footer-contact { text-align: center; color: rgba(255,255,255,0.92); font-size: 12.5px; margin-top: 16px; line-height: 1.6; }

/* Scrollbars */
.chat-messages::-webkit-scrollbar, .modal-content::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-track, .modal-content::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.chat-messages::-webkit-scrollbar-thumb, .modal-content::-webkit-scrollbar-thumb { background: var(--grad); border-radius: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
.loading #send-icon { animation: spin 1s linear infinite; }

/* Modal (topics) */
.modal {
    display: block; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); backdrop-filter: blur(5px); animation: fadeIn 0.3s ease-in;
}
.modal-content {
    background-color: white; margin: 5% auto; padding: 30px; border-radius: 20px;
    width: 90%; max-width: 560px; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: slideDown 0.3s ease-out;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-50px); } to { opacity: 1; transform: translateY(0); } }
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 20px; }
.close:hover { color: #000; }
.modal-content h2 { color: var(--ink); margin-bottom: 12px; font-size: 24px; }

.tp-intro { color: #555; font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.tp-status { font-size: 14px; color: #333; }
.tp-error { font-size: 14px; color: #c81e1e; background: #fdecec; padding: 12px 14px; border-radius: 10px; }
.tp-group { margin-bottom: 20px; }
.tp-group-head { font-weight: 700; color: var(--ink); font-size: 15px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tp-link { font-size: 12px; font-weight: 600; color: var(--accent-dark); text-decoration: none; white-space: nowrap; }
.tp-link:hover { text-decoration: underline; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.tp-chip {
    background: var(--soft); border: 1.5px solid var(--line); color: #35524a;
    padding: 7px 12px; border-radius: 16px; font-size: 12.5px; cursor: pointer; transition: all 0.2s;
}
.tp-chip:hover { background: var(--grad); color: #fff; border-color: transparent; transform: translateY(-1px); }

@media (max-width: 600px) {
    .modal-content { margin: 10% auto; width: 95%; padding: 20px; }
    .message-body { max-width: 88%; }
    .header h1 { font-size: 24px; }
}

/* Instant notice shown when a message sounds like an emergency */
.emergency-notice { background: #fdecec !important; border: 1.5px solid #c81e1e; color: #7a1010 !important; line-height: 1.55; }
.emergency-notice a { color: #c81e1e; font-weight: 700; }

/* Clinic logo in the header */
.header-logo { height: 58px; width: auto; background: #fff; border-radius: 12px; padding: 4px 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* Action buttons under an answer */
.appointment-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.appointment-btn {
    padding: 10px 18px; border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-family: inherit; transition: all 0.2s ease;
}
.appointment-btn.primary { background: var(--grad); color: #fff; border: 2px solid transparent; }
.appointment-btn.secondary { background: #fff; color: var(--accent-dark); border: 2px solid var(--accent-dark); }
.appointment-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,104,55,0.3); }

.emergency-action { display: flex; }
.emergency-btn {
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
    background: linear-gradient(135deg, #ff5a5f 0%, #c81e1e 100%); color: #fff; font-weight: 700; font-size: 15px;
    padding: 13px 22px; border-radius: 14px; box-shadow: 0 6px 18px rgba(200,30,30,0.35);
    animation: emergencyPulse 1.8s ease-in-out infinite; transition: transform 0.15s ease;
}
.emergency-btn:hover { transform: translateY(-2px) scale(1.02); }
@keyframes emergencyPulse { 0%, 100% { box-shadow: 0 6px 18px rgba(200,30,30,0.35); } 50% { box-shadow: 0 8px 28px rgba(255,90,95,0.7); } }

/* Appointment form */
.form-group { margin-bottom: 14px; flex: 1; min-width: 0; }
.form-row { display: flex; gap: 12px; }
.form-group label { display: block; margin-bottom: 6px; color: #35524a; font-weight: 600; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 11px 14px; border: 2px solid var(--line); border-radius: 10px;
    font-size: 14px; font-family: inherit; outline: none; background: #fff; transition: all 0.2s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,138,76,0.15); }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-error { color: #c81e1e; font-size: 14px; font-weight: 600; min-height: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; justify-content: flex-end; }
.btn-primary, .btn-secondary { padding: 12px 22px; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s ease; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,104,55,0.3); }
.btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.btn-secondary { background: #eef3f0; color: #35524a; }
.btn-secondary:hover { background: var(--line); }
@media (max-width: 520px) { .form-row { flex-direction: column; gap: 0; } .header-logo { height: 46px; } }
