@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700;800&display=swap');

* { font-family: 'Noto Sans Thai', sans-serif; }

body {
  background: linear-gradient(135deg, #fff1f2 0%, #ffffff 45%, #f8fafc 100%);
  min-height: 100vh;
}

.bg-blob {
  position: fixed;
  border-radius: 9999px;
  filter: blur(80px);
  opacity: .35;
  z-index: 0;
  pointer-events: none;
}

.glass-card {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 10px 40px -12px rgba(0,0,0,0.12);
}

.navbar-glass {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
}

.btn-primary {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #fff;
  transition: all .15s ease;
}
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 8px 20px -6px rgba(225,29,72,.5); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  transition: all .15s ease;
}
.btn-ghost:hover { background: #f8fafc; transform: scale(1.02); }

.nav-link {
  color: #475569;
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: 9999px;
  transition: all .15s ease;
}
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active { background: #fee2e2; color: #e11d48; font-weight: 700; }
.nav-link.admin-link { color: #7c3aed; }
.nav-link.admin-link.active { background: #ede9fe; color: #7c3aed; }

.badge { display: inline-flex; align-items: center; padding: .2rem .7rem; border-radius: 9999px; font-size: .75rem; font-weight: 700; }
.badge-risk { background: #ffe4e6; color: #e11d48; }
.badge-normal { background: #d1fae5; color: #059669; }
.badge-pending { background: #fef9c3; color: #a16207; }
.badge-active { background: #d1fae5; color: #059669; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-admin { background: #ede9fe; color: #7c3aed; }
.badge-staff { background: #f1f5f9; color: #475569; }

table.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: .78rem;
  text-transform: none;
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
}
table.data-table td {
  padding: .75rem 1rem;
  font-size: .875rem;
  color: #334155;
}
table.data-table tbody tr { border-top: 1px solid #eef2f7; transition: background .1s ease; }
table.data-table tbody tr:hover { background: #fafbfc; }

.qrow-header {
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
}

.radio-pill {
  width: 1.15rem; height: 1.15rem; accent-color: #e11d48; cursor: pointer;
}

.stat-card { border-top: 4px solid; }

.tab-btn {
  padding: .6rem 0;
  margin-right: 2rem;
  font-weight: 600;
  color: #64748b;
  border-bottom: 3px solid transparent;
  transition: all .15s ease;
  cursor: pointer;
}
.tab-btn.active { color: #e11d48; border-color: #e11d48; }

#loadingOverlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px); z-index: 999; display: none;
  align-items: center; justify-content: center;
}
.spinner {
  width: 3rem; height: 3rem; border-radius: 9999px;
  border: 4px solid #fecdd3; border-top-color: #e11d48;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toastContainer { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 1000; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  min-width: 260px; max-width: 360px; padding: .9rem 1.1rem; border-radius: .9rem;
  color: #fff; font-size: .875rem; font-weight: 500;
  box-shadow: 0 10px 25px -8px rgba(0,0,0,.25);
  animation: slideIn .2s ease;
}
.toast.success { background: #059669; }
.toast.error { background: #e11d48; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px);} to {opacity:1; transform:translateX(0);} }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  z-index: 900; display: none; align-items: center; justify-content: center; padding: 1rem;
}

input[type="text"], input[type="password"], input[type="date"], input[type="email"], select {
  transition: all .15s ease;
}
input:focus, select:focus {
  outline: none; border-color: #f43f5e; box-shadow: 0 0 0 3px rgba(244,63,94,0.15);
}

@media print {
  @page { size: A4; margin: 10mm; }

  html, body { background: #fff !important; height: auto !important; }
  .no-print, .bg-blob { display: none !important; }

  #view-app, main, #page-screening, #page-oas { padding: 0 !important; margin: 0 !important; max-width: 100% !important; width: 100% !important; }

  .glass-card { box-shadow: none !important; border: none !important; background: #fff !important; backdrop-filter: none !important; }

  .print-area {
    max-width: 100% !important;
    padding: 0 !important;
    font-size: 11.5px;
  }
  .print-area h1 { font-size: 15px !important; line-height: 1.3; }
  .print-area > div:first-child p { font-size: 10.5px !important; }

  .print-area .grid.grid-cols-1.md\:grid-cols-4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  .print-area label { font-size: 9.5px !important; }
  .print-area input, .print-area select {
    padding: 3px 6px !important;
    font-size: 10.5px !important;
    border-color: #cbd5e1 !important;
    background: #fff !important;
  }

  table.data-table { font-size: 10px !important; width: 100% !important; border-collapse: collapse !important; }
  table.data-table th, table.data-table td { padding: 3px 6px !important; line-height: 1.35; }
  table.data-table th {
    background: #f1f5f9 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .qrow-header td { padding: 3px 6px !important; }
  .radio-pill { width: 0.85rem !important; height: 0.85rem !important; }

  .signature-block { margin-top: 18px !important; font-size: 10px !important; gap: 24px !important; }
  .signature-block p { margin: 2px 0 !important; }

  table.data-table tr { page-break-inside: avoid; }
}
