* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f5f6f8;
    margin: 0;
    color: #222;
}
.navbar {
    background: #1e293b;
    color: #fff;
    padding: 14px 20px;
}
.navbar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-brand { font-weight: bold; font-size: 18px; }
.navbar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    padding: 4px 8px;
    margin: 0;
    cursor: pointer;
    line-height: 1;
}
.navbar-links { display: flex; align-items: center; flex-wrap: wrap; }
.navbar-links a {
    color: #cbd5e1;
    text-decoration: none;
    margin-left: 18px;
    font-size: 14px;
    padding: 6px 0;
}
.navbar-links a:hover { color: #fff; }
.navbar-links a.navbar-scan {
    background: #2563eb;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
}
.navbar-links a.navbar-scan:hover { background: #1d4ed8; }

.container { max-width: 900px; margin: 30px auto; padding: 0 16px; }

.card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.card-success { border: 2px solid #16a34a; }
.card-error { border: 2px solid #dc2626; }

label { display: block; margin-top: 14px; margin-bottom: 4px; font-size: 14px; font-weight: 600; color: #444; }
input[type=text], input[type=password], input[type=file], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px; /* minimal 16px biar Safari iOS gak auto-zoom pas fokus ke field */
    background: #fff;
}
button, .btn-link {
    display: inline-block;
    margin-top: 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .btn-link:hover { background: #1d4ed8; }
.btn-link { margin-top: 0; margin-right: 8px; padding: 8px 14px; font-size: 13px; }

/* ===== List undangan (kartu, bukan tabel) — dijamin gak perlu scroll di layar manapun ===== */
.undangan-list { display: flex; flex-direction: column; gap: 12px; }

.undangan-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.undangan-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}
.undangan-id { font-size: 12px; color: #94a3b8; font-weight: 600; }
.undangan-nama { margin: 2px 0 2px; font-size: 17px; font-weight: 700; color: #0f172a; word-break: break-word; }
.undangan-prodi { margin: 0; font-size: 13.5px; color: #64748b; }

.undangan-card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.undangan-waktu { margin: 10px 0 0; font-size: 12.5px; color: #888; }

.undangan-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    align-items: center;
}
.btn-link-small {
    display: inline-block;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
}
.btn-link-small:hover { background: #dbeafe; }

.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-box { background: #fff; border-radius: 10px; padding: 20px 28px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,0.08); flex: 1; min-width: 140px; }
.stat-number { font-size: 32px; font-weight: bold; }
.stat-label { color: #666; font-size: 13px; margin-top: 4px; }
.stat-green .stat-number { color: #16a34a; }
.stat-orange .stat-number { color: #ea580c; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

.alert { padding: 10px 14px; border-radius: 6px; font-size: 14px; margin: 10px 0; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-warning { background: #fef9c3; color: #854d0e; }

.btn-danger-small {
    margin-top: 0;
    margin-right: 6px;
    padding: 5px 12px;
    font-size: 12px;
    background: #dc2626;
}
.btn-danger-small:hover { background: #b91c1c; }

.btn-warning-small {
    margin-top: 4px;
    padding: 5px 12px;
    font-size: 12px;
    background: #ea580c;
}
.btn-warning-small:hover { background: #c2410c; }

.btn-danger-link {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-family: inherit;
}
.btn-danger-link:hover { background: #fecaca; }

.pagination { display: flex; gap: 6px; margin: 20px 0; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span.page-current {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    color: #2563eb;
    background: #fff;
    border: 1px solid #ddd;
}
.pagination span.page-current { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination a:hover { background: #eff6ff; }

/* Modal konfirmasi custom (Hapus / Batal) */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.modal-box h3 { margin-top: 0; color: #991b1b; }
.modal-box p { color: #444; font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-secondary {
    background: #e5e7eb;
    color: #333;
    margin-top: 0;
}
.btn-secondary:hover { background: #d1d5db; }
.btn-danger {
    background: #dc2626;
    margin-top: 0;
}
.btn-danger:hover { background: #b91c1c; }

/* Banner "Silakan Mengambil Konsumsi" di halaman scan */
.banner-konsumsi {
    background: #facc15;
    color: #713f12;
    font-weight: 800;
    font-size: 20px;
    line-height: 1.3;
    text-align: center;
    padding: 16px 18px;
    border-radius: 10px;
    margin-top: 14px;
    border: 3px dashed #a16207;
    animation: kedip-konsumsi 1s ease-in-out infinite alternate;
}
@keyframes kedip-konsumsi {
    from { box-shadow: 0 0 0px rgba(250, 204, 21, 0.6); }
    to   { box-shadow: 0 0 22px rgba(250, 204, 21, 0.95); }
}

/* ============================================
   RESPONSIF — HP & TABLET (max-width 640px)
   ============================================ */
@media (max-width: 640px) {
    .container { margin: 16px auto; padding: 0 12px; }

    /* Navbar jadi hamburger menu */
    .navbar-toggle { display: block; }
    .navbar-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin-top: 12px;
        gap: 4px;
    }
    .navbar-links.open { display: flex; }
    .navbar-links a {
        margin-left: 0;
        padding: 10px 8px;
        border-radius: 6px;
    }
    .navbar-links a:hover, .navbar-links a:active { background: rgba(255,255,255,0.08); }
    .navbar-links a.navbar-scan { text-align: center; margin: 4px 0; }

    .card { padding: 18px; }

    /* Tombol jadi lebih besar & gampang di-tap pakai jempol */
    button, .btn-link { padding: 12px 18px; font-size: 16px; }
    .btn-link { padding: 10px 14px; font-size: 13px; }

    /* Form full-width & tombol submit selebar layar biar gampang ditekan (cover form.card & form di dalam .card) */
    .card button[type=submit], form.card button[type=submit] { width: 100%; }

    .stat-grid { gap: 10px; }
    .stat-box { padding: 14px 10px; min-width: 0; }
    .stat-number { font-size: 24px; }

    .btn-danger-small, .btn-warning-small, .btn-link-small { padding: 9px 12px; font-size: 13px; display: block; width: 100%; margin: 0; text-align: center; }
    .undangan-card-actions { flex-direction: column; align-items: stretch; }
    .undangan-card-actions form { width: 100%; }

    .modal-box { padding: 20px; }
    .modal-actions { flex-direction: column; }
    .modal-actions button, .modal-actions form { width: 100%; }
    .modal-actions .btn-danger, .modal-actions .btn-secondary { width: 100%; }

    .banner-konsumsi { font-size: 22px; padding: 18px 14px; }
}

/* Halaman scan: kamera & hasil selalu selebar layar di HP, gak kepentok max-width */
@media (max-width: 480px) {
    #reader, #hasil-scan { max-width: 100% !important; }
}
