/* =========================================================
   SMART NURSERY TRACKING
   HEALTH MANAGEMENT
   ========================================================= */


/* =========================================================
   PAGE INTRO
   ========================================================= */

.health-page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.health-breadcrumb {
    margin-bottom: 8px;
    font-size: 13px;
    color: #7b8794;
}

.health-page-intro h2 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: #1f2937;
}

.health-page-intro p {
    margin: 0;
    max-width: 650px;
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
}


/* =========================================================
   PRIMARY BUTTON
   ========================================================= */

.health-primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 42px;
    padding: 0 18px;

    border: none;
    border-radius: 8px;

    background: #1f7a4d;
    color: #ffffff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.health-primary-button:hover {
    background: #17623d;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(31, 122, 77, 0.18);
}

.health-primary-button:active {
    transform: translateY(0);
}


/* =========================================================
   HEALTH STATISTICS
   ========================================================= */

.health-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.health-stat-card {
    display: flex;
    align-items: center;
    gap: 15px;

    min-height: 105px;
    padding: 20px;

    background: #ffffff;
    border: 1px solid #e6e9ed;
    border-radius: 12px;

    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.health-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}


/* STAT ICON */

.health-stat-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #edf7f1;
    color: #1f7a4d;

    font-size: 21px;
}

.health-stat-card:nth-child(2) .health-stat-icon {
    background: #edf7f1;
    color: #25845a;
}

.health-stat-card:nth-child(3) .health-stat-icon {
    background: #fff8e8;
    color: #c58b18;
}

.health-stat-card:nth-child(4) .health-stat-icon {
    background: #fff0f0;
    color: #c84a4a;
}


/* STAT CONTENT */

.health-stat-content {
    min-width: 0;
}

.health-stat-label {
    margin-bottom: 5px;

    font-size: 13px;
    font-weight: 500;

    color: #6b7280;
}

.health-stat-value {
    margin-bottom: 4px;

    font-size: 24px;
    line-height: 1.1;
    font-weight: 700;

    color: #1f2937;
}

.health-stat-description {
    font-size: 11px;
    color: #9ca3af;
}


/* =========================================================
   HEALTH RECORDS CARD
   ========================================================= */

.health-records-card {
    background: #ffffff;

    border: 1px solid #e6e9ed;
    border-radius: 12px;

    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);

    overflow: hidden;
}


/* =========================================================
   RECORDS HEADER
   ========================================================= */

.health-records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 22px 24px;

    border-bottom: 1px solid #edf0f2;
}

.health-section-label {
    margin-bottom: 5px;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;

    color: #1f7a4d;
}

.health-records-header h3 {
    margin: 0 0 5px;

    font-size: 18px;
    font-weight: 700;

    color: #1f2937;
}

.health-records-header p {
    margin: 0;

    font-size: 13px;
    color: #7b8794;
}


/* =========================================================
   EXPORT BUTTON
   ========================================================= */

.health-export-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 38px;
    padding: 0 14px;

    background: #ffffff;

    border: 1px solid #d9dee3;
    border-radius: 7px;

    color: #374151;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.health-export-button:hover {
    background: #f6faf8;
    border-color: #1f7a4d;
    color: #1f7a4d;
}


/* =========================================================
   FILTERS
   ========================================================= */

.health-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;

    gap: 14px;

    padding: 20px 24px;

    background: #fafbfc;

    border-bottom: 1px solid #edf0f2;
}

.health-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.health-filters .filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}


/* INPUTS + SELECTS */

.health-filters input,
.health-filters select {
    width: 100%;
    height: 40px;

    padding: 0 12px;

    background: #ffffff;

    border: 1px solid #dfe3e7;
    border-radius: 7px;

    outline: none;

    font-family: inherit;
    font-size: 13px;

    color: #374151;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.health-filters input::placeholder {
    color: #9ca3af;
}

.health-filters input:focus,
.health-filters select:focus {
    border-color: #1f7a4d;
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.09);
}


/* =========================================================
   TABLE
   ========================================================= */

.health-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.health-table {
    width: 100%;
    min-width: 760px;

    border-collapse: collapse;
}

.health-table th {
    padding: 14px 18px;

    background: #f8faf9;

    border-bottom: 1px solid #e5e9ec;

    text-align: left;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;

    color: #6b7280;

    white-space: nowrap;
}

.health-table td {
    padding: 16px 18px;

    border-bottom: 1px solid #edf0f2;

    font-size: 13px;

    color: #374151;

    vertical-align: middle;
}

.health-table tbody tr {
    transition: background 0.15s ease;
}

.health-table tbody tr:hover {
    background: #fafcfb;
}

.health-table tbody tr:last-child td {
    border-bottom: none;
}


/* SEEDLING ID */

.health-table td:first-child {
    font-weight: 600;
    color: #1f7a4d;
}


/* SPECIES */

.health-table td:nth-child(2) {
    font-weight: 600;
    color: #273444;
}


/* =========================================================
   HEALTH STATUS
   ========================================================= */

/*
   These styles are ready for when the JS uses status
   classes such as:
   .health-status.healthy
   .health-status.attention
   .health-status.critical
*/

.health-status {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;

    border-radius: 20px;

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}

.health-status.healthy {
    background: #eaf7ef;
    color: #217346;
}

.health-status.attention {
    background: #fff6df;
    color: #a66a00;
}

.health-status.critical {
    background: #fdecec;
    color: #b33a3a;
}


/* =========================================================
   VIEW BUTTON
   ========================================================= */

.health-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 58px;
    height: 32px;

    padding: 0 11px;

    background: #edf7f1;

    border: 1px solid #d6ecdf;
    border-radius: 6px;

    color: #1f7a4d;

    font-family: inherit;
    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.health-view-btn:hover {
    background: #1f7a4d;
    border-color: #1f7a4d;
    color: #ffffff;
}


/* =========================================================
   TABLE FOOTER
   ========================================================= */

.health-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 15px 24px;

    border-top: 1px solid #edf0f2;

    background: #ffffff;
}

#healthRecordCount {
    font-size: 12px;
    color: #7b8794;
}

.health-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.health-pagination button {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;

    border: 1px solid #dfe3e7;
    border-radius: 6px;

    color: #59636e;

    font-family: inherit;
    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.health-pagination button:hover {
    border-color: #1f7a4d;
    color: #1f7a4d;
    background: #f5faf7;
}

.health-pagination button.active {
    background: #1f7a4d;
    border-color: #1f7a4d;
    color: #ffffff;
}


/* =========================================================
   HEALTH DETAILS MODAL
   ========================================================= */

.health-modal {
    position: fixed;
    inset: 0;

    z-index: 9999;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(15, 23, 42, 0.55);

    backdrop-filter: blur(2px);
}

.health-modal.show {
    display: flex;
}


/* MODAL CONTENT */

.health-modal-content {
    width: 100%;
    max-width: 680px;
    max-height: 90vh;

    display: flex;
    flex-direction: column;

    background: #ffffff;

    border-radius: 12px;

    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);

    overflow: hidden;

    animation: healthModalAppear 0.2s ease-out;
}

@keyframes healthModalAppear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================================================
   MODAL HEADER
   ========================================================= */

.health-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 19px 22px;

    border-bottom: 1px solid #edf0f2;
}

.health-modal-header h3 {
    margin: 0;

    font-size: 18px;
    font-weight: 700;

    color: #1f2937;
}

.modal-label {
    margin-top: 4px;

    font-size: 12px;
    color: #7b8794;
}


/* CLOSE BUTTON */

.health-modal-close {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 7px;

    background: #f4f6f7;

    color: #6b7280;

    font-size: 20px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.health-modal-close:hover {
    background: #edf1ee;
    color: #1f2937;
}


/* =========================================================
   MODAL BODY
   ========================================================= */

.health-modal-body {
    padding: 24px;

    overflow-y: auto;
}


/* DETAIL GRID */

.health-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 24px;
}

.health-detail-item {
    padding: 14px;

    background: #f8faf9;

    border: 1px solid #edf0f2;
    border-radius: 8px;
}

.health-detail-item label {
    display: block;

    margin-bottom: 6px;

    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;

    color: #8a939d;
}

.health-detail-item span {
    display: block;

    font-size: 14px;
    font-weight: 600;

    color: #273444;
}


/* =========================================================
   OBSERVATION
   ========================================================= */

.health-observation-section {
    padding: 16px;

    background: #f8faf9;

    border: 1px solid #edf0f2;
    border-radius: 8px;
}

.health-observation-section h4 {
    margin: 0 0 8px;

    font-size: 13px;
    font-weight: 700;

    color: #374151;
}

#detailObservation {
    margin: 0;

    font-size: 13px;
    line-height: 1.65;

    color: #6b7280;
}


/* =========================================================
   MODAL FOOTER
   ========================================================= */

.health-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    padding: 15px 22px;

    border-top: 1px solid #edf0f2;

    background: #fafbfc;
}

.health-modal-cancel {
    min-width: 82px;
    height: 36px;

    padding: 0 15px;

    border: 1px solid #dfe3e7;
    border-radius: 7px;

    background: #ffffff;

    color: #4b5563;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.health-modal-cancel:hover {
    background: #f3f5f6;
    border-color: #cfd5da;
}


/* =========================================================
   EMPTY TABLE STATE
   ========================================================= */

.health-table td[colspan] {
    padding: 45px 20px;

    color: #9ca3af;

    font-size: 13px;
}


/* =========================================================
   RESPONSIVE — TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .health-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .health-filters {
        grid-template-columns: 1fr 1fr;
    }

    .health-filters .filter-group:first-child {
        grid-column: 1 / -1;
    }
}


/* =========================================================
   RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width: 768px) {

    .health-page-intro {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .health-page-intro h2 {
        font-size: 22px;
    }

    .health-primary-button {
        width: 100%;
    }

    .health-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .health-stat-card {
        min-height: 90px;
        padding: 16px;
    }

    .health-records-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .health-export-button {
        width: 100%;
    }

    .health-filters {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .health-filters .filter-group:first-child {
        grid-column: auto;
    }

    .health-table th,
    .health-table td {
        padding: 13px 14px;
    }

    .health-table-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .health-pagination {
        width: 100%;
        justify-content: flex-end;
    }

    .health-modal {
        padding: 12px;
    }

    .health-modal-content {
        max-height: 94vh;
    }

    .health-modal-body {
        padding: 18px;
    }

    .health-detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}


/* =========================================================
   RESPONSIVE — SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {

    .health-page-intro {
        margin-bottom: 20px;
    }

    .health-page-intro h2 {
        font-size: 20px;
    }

    .health-page-intro p {
        font-size: 13px;
    }

    .health-stat-value {
        font-size: 21px;
    }

    .health-records-header {
        padding: 18px;
    }

    .health-records-header h3 {
        font-size: 16px;
    }

    .health-modal-header {
        padding: 16px;
    }

    .health-modal-header h3 {
        font-size: 16px;
    }

    .health-modal-footer {
        padding: 13px 16px;
    }
}

/* =========================================================
   ADD HEALTH RECORD FORM
   ========================================================= */

.health-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.health-form-field label,
.health-form-observation label {
    display: block;

    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;

    color: #6b7280;
}

.health-form-field select,
.health-form-field input,
.health-form-observation textarea {
    width: 100%;

    padding: 10px 12px;

    background: #ffffff;

    border: 1px solid #dfe3e7;
    border-radius: 7px;

    outline: none;

    font-family: inherit;
    font-size: 13px;

    color: #374151;

    box-sizing: border-box;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.health-form-field select,
.health-form-field input {
    height: 40px;
}

.health-form-field select:focus,
.health-form-field input:focus,
.health-form-observation textarea:focus {
    border-color: #1f7a4d;

    box-shadow:
        0 0 0 3px rgba(31, 122, 77, 0.09);
}

.health-form-observation {
    margin-top: 4px;
}

.health-form-observation textarea {
    display: block;

    min-height: 105px;

    margin-top: 8px;

    resize: vertical;

    line-height: 1.5;
}

.health-form-observation textarea::placeholder {
    color: #9ca3af;
}


/* FORM FOOTER */

#addHealthForm .health-modal-footer {
    margin-top: 24px;
    margin-left: -24px;
    margin-right: -24px;
    margin-bottom: -24px;
}


/* SAVE BUTTON */

#addHealthForm .health-primary-button {
    min-width: 155px;
    height: 38px;
}


/* MOBILE */

@media (max-width: 600px) {

    #addHealthForm .health-modal-footer {
        margin-left: -18px;
        margin-right: -18px;
        margin-bottom: -18px;

        flex-direction: column-reverse;
        align-items: stretch;
        gap: 8px;
    }

    #addHealthForm .health-primary-button,
    #addHealthForm .health-modal-cancel {
        width: 100%;
    }
}