/* =========================================================
   PUBLIC HEALTH PLUS — PHP DENGUE
   COMPLETE STYLE SHEET
   Version: PHP DENGUE V2.3 — FINAL VISUAL
   ========================================================= */

:root {
    --navy: #073b66;
    --navy-dark: #052d4d;
    --blue: #0879bd;
    --sky: #eaf6ff;
    --white: #ffffff;
    --text: #17212b;
    --muted: #607080;
    --border: #d8e2ea;

    --green: #008f3d;
    --green-dark: #006f2e;

    --red: #d71920;
    --red-light: #fff0f0;
    --red-selected: #a90000;

    --shadow: 0 6px 22px rgba(7, 59, 102, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    background: #f4f8fb;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background: #f4f8fb;
    color: var(--text);
    font-family:
        Arial,
        "Segoe UI",
        Tahoma,
        sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =========================================================
   MAIN APPLICATION
   ========================================================= */

#app,
.app,
.page,
.container,
main {
    width: 100%;
}

.container,
.page-container,
.app-container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

/* =========================================================
   HEADER
   ========================================================= */

header,
.app-header,
.site-header {
    background: linear-gradient(
        135deg,
        var(--navy-dark),
        var(--navy),
        #075f91
    );
    color: #ffffff;
    padding: 22px 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

header .container,
.app-header .container,
.site-header .container {
    max-width: 1180px;
    margin: 0 auto;
}

header h1,
.app-header h1,
.site-header h1 {
    margin: 0;
    color: #ffffff;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.15;
}

header h2,
.app-header h2,
.site-header h2 {
    margin: 5px 0 0;
    color: #dff4ff;
    font-size: 17px;
    font-weight: 800;
}

header p,
.app-header p,
.site-header p {
    margin: 6px 0 0;
    color: #e9f8ff;
}

/* =========================================================
   TOP NAVIGATION
   ========================================================= */

header nav,
.app-header nav,
.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

header nav a,
.app-header nav a,
.site-header nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

header nav a:hover,
.app-header nav a:hover,
.site-header nav a:hover {
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

/* =========================================================
   CONNECTION STATUS
   ========================================================= */

#connectionPanel,
.connection-panel,
.status-panel {
    width: min(1180px, calc(100% - 32px));
    margin: 18px auto;
    padding: 15px 18px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

#connectionStatus,
#syncStatus,
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
}

.status.online,
#connectionStatus.online {
    background: #e8f8ef;
    color: #087331;
    border: 1px solid #a9dfbd;
}

.status.offline,
#connectionStatus.offline {
    background: #fff0f0;
    color: #b20f16;
    border: 1px solid #efb1b4;
}

.status.sync-normal,
#syncStatus.sync-normal {
    background: #eef6fb;
    color: var(--navy);
    border: 1px solid #c9dfea;
}

.status.sync-error,
#syncStatus.sync-error {
    background: #fff0f0;
    color: var(--red);
    border: 1px solid #efb1b4;
}

/* =========================================================
   INSTALL BUTTON
   ========================================================= */

.install-btn,
#installAppBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 12px;
    padding: 9px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--blue);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(8, 121, 189, 0.2);
}

.install-btn:hover,
#installAppBtn:hover {
    background: var(--navy);
}

.install-btn[hidden],
#installAppBtn[hidden] {
    display: none !important;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */

main,
#mainContent,
.main-content {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 10px 0 40px;
}

/* =========================================================
   FORM TITLE
   ========================================================= */

#dengueForm > h1,
.form-title {
    margin: 25px 0 20px;
    color: var(--navy);
    font-size: 32px;
    font-weight: 900;
    line-height: 1.2;
}

/* =========================================================
   FORM SECTIONS
   ========================================================= */

.form-section,
.section-card,
.form-card,
.dengue-section {
    margin: 0 0 22px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-section h2,
.section-card h2,
.form-card h2,
.dengue-section h2 {
    margin: 0 0 5px;
    color: var(--navy);
    font-size: 22px;
    font-weight: 900;
}

.form-section h3,
.section-card h3,
.form-card h3 {
    margin: 0 0 16px;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
}

.form-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
}

.form-section-heading > div:last-child {
    min-width: 0;
}

.form-section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
}

/* =========================================================
   SECTION NUMBER
   ========================================================= */

.section-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--navy);
    color: #ffffff;
    font-weight: 900;
}

/* =========================================================
   FORM GRID
   ========================================================= */

.form-grid,
.fields-grid,
.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    min-width: 0;
}

.form-group.full {
    grid-column: 1 / -1;
}

/* =========================================================
   LABELS
   ========================================================= */

.form-group > label,
.clinical-label {
    display: block;
    margin: 0 0 7px;
    color: var(--text);
    font-size: 16px;
    font-weight: 900;
}

.required {
    color: var(--red);
    font-weight: 900;
}

.english-label {
    display: block;
}

.urdu-label {
    display: block;
    margin-top: 3px;
    color: #263746;
    font-family:
        "Noto Nastaliq Urdu",
        "Noto Naskh Arabic",
        "Jameel Noori Nastaleeq",
        Tahoma,
        Arial,
        sans-serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.7;
    direction: rtl;
    text-align: right;
}

[dir="rtl"] {
    font-weight: 700;
}

/* =========================================================
   INPUTS
   ========================================================= */

input[type="text"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="email"],
input[type="search"],
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1.5px solid #cbd8e1;
    border-radius: 11px;
    background: #ffffff;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(8, 121, 189, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: #8a98a5;
    opacity: 1;
}

/* =========================================================
   YES / NO — CURRENT APP.JS STRUCTURE
   IMPORTANT:
   Each question has its OWN hidden input.
   Therefore Fever and Headache can both remain selected.
   CSS only controls appearance.
   ========================================================= */

.yesno-group {
    width: 100%;
    margin: 4px 0 22px;
}

.yesno-group .clinical-label {
    margin-bottom: 10px;
}

/* Two equal buttons */
.yesno-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    margin-top: 8px;
}

/* Base button */
.yesno-buttons .yesno-option {
    appearance: none;
    -webkit-appearance: none;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    width: 100%;
    min-height: 76px;

    padding: 10px 14px;

    background: #ffffff;

    border: 3px solid transparent;
    border-radius: 14px;

    font-size: 21px;
    font-weight: 900;
    line-height: 1.25;

    text-align: center;
    user-select: none;

    box-shadow: none;

    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.08s ease;
}

/* =========================================================
   YES — UNSELECTED
   ========================================================= */

.yesno-buttons .yesno-yes {
    background: #ffffff;
    color: var(--green);
    border-color: var(--green);
}

.yesno-buttons .yesno-yes:hover {
    background: #eefaf3;
    border-color: var(--green-dark);
}

/* =========================================================
   YES — SELECTED
   ========================================================= */

.yesno-buttons .yesno-yes.selected {
    background: var(--green-dark);
    color: #ffffff;
    border-color: #005d27;

    box-shadow:
        0 0 0 4px rgba(0, 143, 61, 0.16),
        0 5px 14px rgba(0, 111, 46, 0.18);
}

.yesno-buttons .yesno-yes.selected:hover {
    background: var(--green-dark);
}

/* =========================================================
   NO — UNSELECTED
   ========================================================= */

.yesno-buttons .yesno-no {
    background: #ffffff;
    color: var(--red);
    border-color: var(--red);
}

.yesno-buttons .yesno-no:hover {
    background: #fff0f0;
    border-color: #b80f15;
}

/* =========================================================
   NO — SELECTED
   ========================================================= */

.yesno-buttons .yesno-no.selected {
    background: var(--red-selected);
    color: #ffffff;
    border-color: #8f0000;

    box-shadow:
        0 0 0 4px rgba(215, 25, 32, 0.13),
        0 5px 14px rgba(169, 0, 0, 0.18);
}

.yesno-buttons .yesno-no.selected:hover {
    background: var(--red-selected);
}

/* =========================================================
   YES / NO ACTIVE
   ========================================================= */

.yesno-buttons .yesno-option:active {
    transform: scale(0.985);
}

/* =========================================================
   YES / NO KEYBOARD FOCUS
   ========================================================= */

.yesno-buttons .yesno-option:focus-visible {
    outline: 3px solid rgba(8, 121, 189, 0.3);
    outline-offset: 3px;
}

/* =========================================================
   WARNING ADVICE
   ========================================================= */

.warning-advice,
#warningAdvice {
    margin: 18px 0;
    padding: 16px 18px;
    border-left: 5px solid var(--red);
    border-radius: 10px;
    background: #fff4f4;
    color: #a90d13;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.7;
}

.warning-advice [dir="rtl"],
#warningAdvice [dir="rtl"] {
    display: block;
    margin-top: 5px;
    direction: rtl;
    text-align: right;
    font-size: 17px;
    font-weight: 900;
}

/* =========================================================
   ACTION BUTTONS
   ========================================================= */

.form-actions,
.action-buttons,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.form-actions button,
.action-buttons button,
.actions button,
#saveCaseBtn,
#clearFormBtn {
    min-height: 48px;
    padding: 10px 20px;
    border: 0;
    border-radius: 11px;
    font-size: 16px;
    font-weight: 900;
    transition:
        background 0.15s ease,
        transform 0.08s ease;
}

#saveCaseBtn,
.save-btn,
button[type="submit"] {
    background: var(--navy);
    color: #ffffff;
}

#saveCaseBtn:hover,
.save-btn:hover,
button[type="submit"]:hover {
    background: var(--blue);
}

#clearFormBtn,
.clear-btn {
    background: #eef2f5;
    color: #344552;
    border: 1px solid #ccd7df !important;
}

#clearFormBtn:hover,
.clear-btn:hover {
    background: #e2e8ed;
}

.form-actions button:active,
.action-buttons button:active,
.actions button:active {
    transform: scale(0.98);
}

/* =========================================================
   QUEUE / MOBILE RECORDS
   ========================================================= */

#queueSection,
.queue-section,
.records-section,
.mobile-records {
    margin-top: 24px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#queueSection h2,
.queue-section h2,
.records-section h2,
.mobile-records h2 {
    margin: 0 0 6px;
    color: var(--navy);
    font-size: 22px;
    font-weight: 900;
}

#queueSection p,
.queue-section p,
.records-section p {
    margin: 5px 0;
    color: var(--muted);
}

/* =========================================================
   QUEUE CONTROLS
   ========================================================= */

.queue-controls,
#queueControls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.queue-controls button,
#syncNowBtn,
#refreshBtn {
    min-height: 42px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid #c9d6df;
    background: #ffffff;
    color: var(--navy);
    font-weight: 900;
}

#syncNowBtn {
    background: var(--navy);
    color: #ffffff;
    border-color: var(--navy);
}

#syncNowBtn:hover {
    background: var(--blue);
}

#refreshBtn:hover {
    background: #eef5f9;
}

/* =========================================================
   DAILY QUEUE
   ========================================================= */

#queueList {
    width: 100%;
}

.daily-summary,
.forms-sent-today,
.sent-count {
    margin: 12px 0;
    padding: 14px 16px;
    border-radius: 11px;
    background: #eef7fc;
    border: 1px solid #cfe3ef;
    color: var(--navy);
    font-size: 18px;
    font-weight: 900;
}

.daily-pending-count {
    margin: 10px 0;
    padding: 12px 15px;
    border-radius: 10px;
    background: #fff8f8;
    border: 1px solid #f0d2d2;
    color: #9b151b;
    font-weight: 900;
}

.daily-list-heading {
    margin: 18px 0 8px;
    color: var(--navy);
    font-size: 17px;
    font-weight: 900;
}

.daily-sent-item {
    margin: 10px 0;
    padding: 14px 16px;
    border: 1px solid #d9e3e9;
    border-radius: 12px;
    background: #fbfdfe;
}

.daily-case-number {
    margin-bottom: 5px;
    color: var(--navy);
    font-weight: 900;
}

.daily-record-line {
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

.queue-empty {
    padding: 18px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
}

/* =========================================================
   PENDING
   ========================================================= */

.pending-record,
.pending-item {
    margin: 10px 0;
    padding: 14px 16px;
    border: 1px solid #f0d2d2;
    border-radius: 12px;
    background: #fff8f8;
    color: #7f1a1f;
    font-weight: 700;
}

/* =========================================================
   INFO CARD
   ========================================================= */

.info-card,
.info-box {
    margin-top: 22px;
    padding: 18px;
    border-radius: 13px;
    background: #edf7fc;
    border: 1px solid #cfe4f0;
    color: #24485f;
}

.info-card strong,
.info-box strong {
    color: var(--navy);
    font-weight: 900;
}

/* =========================================================
   FOOTER
   ========================================================= */

footer,
.app-footer,
.site-footer {
    margin-top: 35px;
    padding: 22px 16px;
    background: var(--navy-dark);
    color: #dcecf6;
    text-align: center;
    font-size: 14px;
}

footer strong,
.app-footer strong,
.site-footer strong {
    color: #ffffff;
    font-weight: 900;
}

/* =========================================================
   HORIZONTAL RULE
   ========================================================= */

hr {
    border: 0;
    border-top: 1px solid #dce5eb;
    margin: 22px 0;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .container,
    .page-container,
    .app-container,
    main,
    #mainContent,
    .main-content {
        width: min(100% - 24px, 760px);
    }

    .form-grid,
    .fields-grid,
    .field-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    #dengueForm > h1,
    .form-title {
        font-size: 28px;
    }

    .form-section,
    .section-card,
    .form-card,
    .dengue-section {
        padding: 20px;
    }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    body {
        font-size: 15px;
    }

    header,
    .app-header,
    .site-header {
        padding: 17px 14px;
    }

    header h1,
    .app-header h1,
    .site-header h1 {
        font-size: 23px;
    }

    header h2,
    .app-header h2,
    .site-header h2 {
        font-size: 15px;
    }

    header nav,
    .app-header nav,
    .site-header nav {
        gap: 7px;
    }

    header nav a,
    .app-header nav a,
    .site-header nav a {
        min-height: 38px;
        padding: 7px 12px;
        font-size: 14px;
    }

    .container,
    .page-container,
    .app-container,
    main,
    #mainContent,
    .main-content,
    #connectionPanel,
    .connection-panel,
    .status-panel {
        width: calc(100% - 20px);
    }

    main,
    #mainContent,
    .main-content {
        padding-bottom: 25px;
    }

    #dengueForm > h1,
    .form-title {
        margin: 20px 0 15px;
        font-size: 24px;
        line-height: 1.25;
    }

    .form-section,
    .section-card,
    .form-card,
    .dengue-section {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 14px;
    }

    .form-section h2,
    .section-card h2,
    .form-card h2,
    .dengue-section h2 {
        font-size: 20px;
    }

    .form-grid,
    .fields-grid,
    .field-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-group.full {
        grid-column: auto;
    }

    .form-group > label,
    .clinical-label {
        font-size: 15px;
    }

    .urdu-label {
        font-size: 16px;
    }

    input[type="text"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="email"],
    input[type="search"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px;
    }

    /* =====================================================
       YES / NO — MOBILE
       Still TWO columns.
       ===================================================== */

    .yesno-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .yesno-buttons .yesno-option {
        min-height: 70px;
        padding: 8px 6px;
        border-radius: 13px;
        font-size: 19px;
    }

    .form-actions,
    .action-buttons,
    .actions {
        flex-direction: column;
    }

    .form-actions button,
    .action-buttons button,
    .actions button,
    #saveCaseBtn,
    #clearFormBtn {
        width: 100%;
        min-height: 50px;
    }

    #connectionPanel,
    .connection-panel,
    .status-panel {
        padding: 13px;
    }

    #connectionStatus,
    #syncStatus,
    .status {
        width: 100%;
        margin: 3px 0;
    }

    .install-btn,
    #installAppBtn {
        width: 100%;
        min-height: 48px;
    }

    #queueSection,
    .queue-section,
    .records-section,
    .mobile-records {
        padding: 16px;
        border-radius: 14px;
    }

    .queue-controls,
    #queueControls {
        flex-direction: column;
    }

    .queue-controls button,
    #syncNowBtn,
    #refreshBtn {
        width: 100%;
        min-height: 46px;
    }

    .warning-advice,
    #warningAdvice {
        padding: 13px 14px;
        font-size: 15px;
    }
}

/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 430px) {

    header h1,
    .app-header h1,
    .site-header h1 {
        font-size: 21px;
    }

    #dengueForm > h1,
    .form-title {
        font-size: 22px;
    }

    .form-section,
    .section-card,
    .form-card,
    .dengue-section {
        padding: 14px;
    }

    .yesno-buttons {
        gap: 8px;
    }

    .yesno-buttons .yesno-option {
        min-height: 64px;
        font-size: 17px;
    }
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label:focus-visible {
    outline: 3px solid rgba(8, 121, 189, 0.3);
    outline-offset: 2px;
}

/* =========================================================
   PRINT
   ========================================================= */

@media print {

    body {
        background: #ffffff;
    }

    header,
    .app-header,
    .site-header,
    footer,
    .app-footer,
    .site-footer,
    .install-btn,
    #installAppBtn,
    .form-actions,
    .action-buttons,
    .actions,
    #queueSection,
    .queue-section {
        box-shadow: none !important;
    }

    .form-section,
    .section-card,
    .form-card,
    .dengue-section {
        break-inside: avoid;
        box-shadow: none;
    }
}