/* ==========================================================================
   SIMONEV Bundles HAIs - Stylesheet
   PHP Native + MySQL (mysqli) - Vanilla CSS, tanpa framework
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --secondary-light: #e2e8f0;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.10);
    --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin: 0 0 0.4em 0;
    color: var(--text);
}

/* ==========================================================================
   Header / Navigasi
   ========================================================================== */

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
    color: var(--primary);
}

.brand-icon {
    font-size: 1.3rem;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.main-nav a {
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
}

.main-nav a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    text-decoration: none;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-logout {
    background: var(--danger-light);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
    text-decoration: none;
}

/* ==========================================================================
   Layout utama
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.page-heading {
    margin-bottom: 22px;
}

.page-heading h1 {
    font-size: 1.5rem;
}

.page-heading p {
    color: var(--text-muted);
    margin: 0;
}

.subtitle {
    color: var(--text-muted);
    margin: 0;
}

.app-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* ==========================================================================
   Kartu (card) generik
   ========================================================================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Dashboard - grid bundle
   ========================================================================== */

.bundle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.bundle-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bundle-card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 16px 18px;
}

.bundle-card-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #fff;
}

.bundle-card-body {
    padding: 6px 0;
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}

.category-list li:first-child {
    border-top: none;
}

.cat-name {
    font-weight: 500;
    font-size: 0.92rem;
}

.cat-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ==========================================================================
   Tombol
   ========================================================================== */

.btn {
    display: inline-block;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 18px;
    text-align: center;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn:hover {
    text-decoration: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.76rem;
    border-radius: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--secondary-light);
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
    color: var(--text);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* ==========================================================================
   Form
   ========================================================================== */

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.form-group {
    margin-bottom: 16px;
    flex: 1;
    min-width: 160px;
}

.form-group-grow {
    flex: 2;
    min-width: 220px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-card {
    max-width: 900px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.form-actions-inline {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 16px;
}

.filter-card .filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-form .form-group {
    margin-bottom: 0;
    min-width: 180px;
    flex: 0 1 220px;
}

/* ==========================================================================
   Checklist table (input & edit)
   ========================================================================== */

.checklist-title {
    margin-top: 22px;
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.checklist-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.checklist-table th,
.checklist-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.9rem;
}

.checklist-table thead th {
    background: var(--bg);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.checklist-table .col-radio {
    width: 80px;
    text-align: center;
}

.checklist-table input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ==========================================================================
   Tabel Laporan Infeksi Nosokomial (input & edit)
   ========================================================================== */

.nosokomial-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.nosokomial-table th,
.nosokomial-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.9rem;
}

.nosokomial-table thead th {
    background: var(--bg);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.nosokomial-table .col-no {
    width: 50px;
    text-align: center;
}

.nosokomial-table .col-data {
    width: 160px;
}

.nosokomial-table input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.9rem;
}

.nosokomial-table tr.lvl-1 td:nth-child(2) {
    padding-left: 28px;
    color: var(--text-muted);
}

.nosokomial-table tr.lvl-2 td:nth-child(2) {
    padding-left: 48px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   Tabel data / rekap
   ========================================================================== */

.table-scroll {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    white-space: nowrap;
}

.data-table thead th {
    background: var(--bg);
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table .empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
    white-space: normal;
}

.text-center {
    text-align: center;
}

.action-cell {
    display: flex;
    gap: 6px;
    justify-content: center;
    white-space: nowrap;
}

/* Badge Ya / Tidak */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--secondary-light);
    color: var(--text-muted);
}

.badge-yes {
    background: var(--success-light);
    color: var(--success);
}

.badge-no {
    background: var(--danger-light);
    color: var(--danger);
}

/* ==========================================================================
   Nilai kepatuhan box (data.php)
   ========================================================================== */

.nilai-box {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.nilai-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
}

.nilai-item span {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nilai-item strong {
    font-size: 1.5rem;
    color: var(--text);
}

.nilai-highlight {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.nilai-highlight span,
.nilai-highlight small {
    color: #dbeafe;
}

.nilai-highlight strong {
    color: #fff;
}

.nilai-item small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Laporan rekap - pill nilai
   ========================================================================== */

.recap-card {
    padding: 20px 20px 6px;
}

.recap-title {
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.recap-table th,
.recap-table td {
    white-space: normal;
}

.nilai-pill {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}

.nilai-pill-good {
    background: var(--success-light);
    color: var(--success);
}

.nilai-pill-warn {
    background: var(--warning-light);
    color: var(--warning);
}

.nilai-pill-bad {
    background: var(--danger-light);
    color: var(--danger);
}

/* ==========================================================================
   Alert
   ========================================================================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.alert ul {
    margin: 4px 0 0 18px;
    padding: 0;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid #a5f3fc;
}

/* ==========================================================================
   Halaman Login
   ========================================================================== */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d4ed8, #0891b2);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
}

.login-brand {
    text-align: center;
    margin-bottom: 26px;
}

.login-brand .brand-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 8px;
}

.login-brand h1 {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
    line-height: 1.4;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 18px 0 0;
}

/* ==========================================================================
   Cetak (laporan.php)
   ========================================================================== */

.only-print {
    display: none;
}

@media print {
    .app-header,
    .app-footer,
    .no-print {
        display: none !important;
    }

    .only-print {
        display: block;
    }

    body {
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .card,
    .table-scroll {
        box-shadow: none;
        border: 1px solid #cbd5e1;
    }

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

    .print-header h1 {
        font-size: 1.3rem;
    }
}

/* ==========================================================================
   Responsif
   ========================================================================== */

@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .main-nav {
        width: 100%;
    }

    .user-box {
        width: 100%;
        justify-content: space-between;
    }

    .container {
        padding: 20px 14px 40px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .action-cell {
        flex-direction: column;
    }
}
