/* ============================================================
   1. CSS Variables
   ============================================================ */
:root {
    --blue: #2563EB;
    --purple: #6C3EE8;
    --red: #DC2626;
    --orange: #EA580C;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --sub: #6b7280;
    --radius: 20px;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ============================================================
   3. Navbar
   ============================================================ */
.navbar-nav li {
    padding: 10px;
    font-size: 18px;
}

/* ============================================================
   4. Hero
   ============================================================ */
.hero {
    padding: 100px 0;
    text-align: center;
}

.hero h1 {
    font-size: 48px;
    font-weight: 700;
    color: #1d273b;
    margin-top: 10px;
}

.hero p {
    color: #6c7a89;
    max-width: 650px;
    margin: 20px auto 0;
}

/* ============================================================
   5. Service Cards
   ============================================================ */
.service-card {
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    height: 100%;
    transition: box-shadow 0.4s ease-in-out;
}

.service-card:hover {
    box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.15);
}

.service-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e9f2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 10px;
}

/* ============================================================
   6. Emergency Section (homepage banner)
   ============================================================ */
.emergency {
    background: #f9e6e6;
    padding: 40px;
    margin-top: 60px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================================
   7. Topic Cards
   ============================================================ */
.topic-card {
    background: #dfe8ef;
    padding: 25px;
    border-radius: 12px;
}

/* ============================================================
   8. Medical Emergency Page
   ============================================================ */

/* Header card */
.header-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 24px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    animation: fadeDown 0.5s ease both;
}

.header-icon {
    width: 52px;
    height: 52px;
    background: #ef4444;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.header-title {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
}

.header-sub {
    font-size: 13px;
    color: var(--sub);
    margin-top: 2px;
}

.alert-banner {
    background: #fff1f1;
    border-left: 4px solid #ef4444;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: #b91c1c;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Emergency buttons */
.btn-emg {
    border: none;
    border-radius: var(--radius);
    padding: 30px 16px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    color: #fff;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
    animation: fadeUp 0.5s ease both;
}

.btn-emg:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    filter: brightness(1.08);
}

.btn-emg:active {
    transform: scale(0.96);
}

.btn-emg .icon-circle {
    width: 58px;
    height: 58px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.btn-emg .icon-circle img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.btn-emg .btn-label {
    font-size: 16px;
    font-weight: 800;
}

.btn-emg .btn-sub {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    margin-top: -8px;
}

.emg-contact {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    animation-delay: 0.05s;
}

.emg-police {
    background: linear-gradient(135deg, #7c3aed, #6C3EE8);
    animation-delay: 0.10s;
}

.emg-ambulance {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation-delay: 0.15s;
}

.emg-fire {
    background: linear-gradient(135deg, #f97316, #ea580c);
    animation-delay: 0.20s;
}

/* Pulse ring */
.pulse {
    position: relative;
}

.pulse::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: pulse 1.6s infinite;
}

/* Medical info card */
.info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    animation: fadeUp 0.5s 0.25s ease both;
}

.info-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.info-title {
    font-size: 18px;
    font-weight: 900;
}

.btn-edit {
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.btn-edit:hover {
    background: #1d4ed8;
    transform: scale(1.04);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ic-blue {
    background: #eff6ff;
    color: #2563eb;
}

.ic-red {
    background: #fff1f1;
    color: #ef4444;
}

.ic-yellow {
    background: #fefce8;
    color: #ca8a04;
}

.ic-purple {
    background: #f5f3ff;
    color: #7c3aed;
}

.info-label {
    font-size: 11.5px;
    color: var(--sub);
    font-weight: 600;
}

.info-value {
    font-size: 14.5px;
    font-weight: 800;
    margin-top: 1px;
}

/* ============================================================
   9. AI Assistant / Chat
   ============================================================ */

.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    overflow: hidden;
    padding-bottom: 50px;
}

.assistant-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
    flex-shrink: 0;
}

.assistant-header h2 {
    margin: 0;
    font-weight: bold;
}

.assistant-header p {
    font-size: 14px;
    color: var(--sub);
    margin: 0;
}

.options {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    flex-wrap: wrap;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.option-btn {
    flex: 1 1 150px;
    max-width: 200px;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    background: #f1f3f5;
    font-size: 14px;
    transition: background 0.2s, border-color 0.2s;
}

.option-btn:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 20px;
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
}

.messages-wrapper {
    display: flex;
    flex-direction: column;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 15px;
    margin-bottom: 12px;
    max-width: 85%;
    line-height: 1.5;
}

.bot-message {
    background: #e9f2ff;
    border-bottom-left-radius: 4px;
}

.user-message {
    background: #0d6efd;
    color: #fff;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.typing {
    color: var(--sub);
    font-style: italic;
    font-size: 14px;
    padding: 8px 16px;
}

.chat-input-area {
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: 15px;
    flex-shrink: 0;
}

.chat-input {
    max-width: 650px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border-radius: 50px;
    border: 1px solid #ced4da;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    border-color: #0d6efd;
}

.chat-input button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #0d6efd;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-input button:hover {
    background: #0b5ed7;
}

/* ============================================================
   10. Modals
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show,
.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 22px;
    padding: 28px 24px;
    width: min(360px, 90vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popUp 0.25s ease;
}

.modal-box h3,
.modal-box h5 {
    font-weight: 900;
    font-size: 18px;
    margin-bottom: 6px;
}

.modal-box>p {
    font-size: 13.5px;
    color: var(--sub);
    margin-bottom: 20px;
}

.modal-box label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--sub);
    margin-bottom: 5px;
}

.modal-box input,
.modal-box select {
    width: 100%;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-box input:focus,
.modal-box select:focus {
    border-color: var(--blue);
}

.modal-btns,
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.modal-btns button,
.modal-actions button {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.btn-save {
    background: var(--blue);
    color: #fff;
    font-weight: 800;
}

.btn-cancel {
    background: #f3f4f6;
    color: var(--text);
}

/* Call modal */
.call-modal-box {
    background: #fff;
    border-radius: 22px;
    padding: 36px 24px 28px;
    width: min(320px, 88vw);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popUp 0.25s ease;
}

.call-icon-big {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
    margin: 0 auto 16px;
}

.call-name {
    font-size: 20px;
    font-weight: 900;
}

.call-number {
    font-size: 15px;
    color: var(--sub);
    margin: 4px 0 24px;
}

.btn-call-confirm {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 14px 0;
    background: #16a34a;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-call-cancel {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 12px 0;
    background: #f3f4f6;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ============================================================
   11. Footer
   ============================================================ */
footer {
    background: #0f172a;
    color: #fff;
    padding: 60px 0;
}

footer a {
    color: #cbd5e1;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
}

/* ============================================================
   12. Animations
   ============================================================ */
@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: scale(0.88);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    70% {
        transform: scale(1.4);
        opacity: 0;
    }

    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(192, 57, 43, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(192, 57, 43, 0);
    }
}