/* ==========================================================================
   BukuTamu — App CSS (clean, stable version)
   ========================================================================== */

/* ---------- CSS Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: #0f172a;
  background: #f8fafc;
}
img { max-width:100%; display:block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ---------- Theme tokens ---------- */
:root{
  --brand:#114B35;            /* deep green header */
  --brand-700:#0f5132;
  --brand-600:#14532d;
  --brand-50:#ecfdf5;
  --accent:#caa85a;
  --text:#0f172a;
  --muted:#475569;
  --border:#e2e8f0;
  --bg-card:#ffffff;
  --ring:#cbd5e1;
  --error:#b91c1c;
  --warn:#b45309;
  --shadow: 0 10px 30px rgba(2,8,23,.08);
}

/* ---------- Layout shells ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--bg-card);
  border:1px solid #eef2f7;
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

/* === Thank You Page Layout === */
.thankyou-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;             /* centers vertically on the screen */
  padding: 40px 20px;
}

/* Card content */
.thankyou-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Image styling */
.thankyou-card .thankyou-img {
  max-width: 260px;
  height: auto;
  margin: 0 auto 18px;
  display: block;
}

/* Text styling */
.thankyou-card h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.thankyou-card p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 18px;
}

/* Button styling */
.thankyou-card .btn {
  margin-top: 4px;
}

/* Slightly smaller spacing on mobile */
@media (max-width: 640px) {
  .thankyou-wrapper {
    min-height: auto;
    padding: 20px;
  }
  .thankyou-card {
    padding: 20px;
  }
  .thankyou-card h1 {
    font-size: 20px;
  }
}


/* ---------- Topbar ---------- */
.topbar { background: var(--brand); position: sticky; top:0; z-index:50; }
.topbar-inner {
  max-width:1080px;
  margin:0 auto;
  padding:12px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.brand { display:flex; align-items:center; gap:10px; }
.brand img { width:42px; height:52px; border-radius:50%; background:transparent; padding:4px; }
.brand-title { font-weight:900; font-size:32px; color:#fff; }

/* right side buttons (Menu + Logout) */
.topbar-inner > div:last-child {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
}
.login-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 16px;
  background:#fff;
  color:var(--brand-700);
  border-radius:999px;
  font-weight:800;
  border:1px solid #e6f2ed;
  white-space:nowrap;
}
.login-pill:hover{ filter:brightness(.98); }

@media (max-width:480px){
  .login-pill{ padding:8px 12px; font-size:.95rem; }
}

/* ---------- Footer ---------- */
.footer {
  text-align:center;
  color:var(--muted);
  padding: 20px 0 40px;
}

/* ---------- Buttons ---------- */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  height:38px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid transparent;
  font-weight:800;
  cursor:pointer;
  transition: filter .2s ease, opacity .2s ease;
}
.btn:hover { filter: brightness(.98); }
.btn:active { opacity:.9; }

.btn-primary { background: var(--brand-600); color:#fff; }
.btn-outline { background: #fff; border-color: var(--ring); color: var(--text); }
.btn-outline.danger { border-color:#fecaca; color:#991b1b; }
.btn-ghost { background: transparent; color: var(--text); }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- Forms ---------- */
label {
  display:block;
  font-size:20px;
  color: var(--muted);
  margin:6px 0 4px;
  padding: auto;
  
}
input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],

textarea, select {
  height:40px;
  width:100%;
  border-radius:12px;
  border:1px solid var(--border);
  padding:0 12px;
  background:#fff;
  outline:none;
  margin-bottom: 16px;
}
textarea { min-height:96px; padding:10px 12px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-600);
  box-shadow:0 0 0 3px rgba(20,83,45,.12);
}

/* Inline form clusters */
.user-form { display:flex; flex-wrap:wrap; gap:8px; }
.user-form input, .user-form select { width:auto; }

/* ---------- Alerts ---------- */
.alert {
  border:1px solid #d1fae5;
  background:#ecfdf5;
  color:#064e3b;
  padding:10px 12px;
  border-radius:12px;
  margin:10px 0;
}
.alert.error {
  border-color:#fee2e2;
  background:#fef2f2;
  color:#7f1d1d;
}

/* ---------- Home menu big cards ---------- */
.grid-cards {
  display:grid;
  grid-template-columns: repeat(2, minmax(240px,1fr));
  gap:24px;
  margin-top:24px;
}
.big-card {
  display:grid;
  place-content:center;
  text-align:center;
  background:#fff;
  border:1px solid #eef2f7;
  border-radius:24px;
  min-height:220px;
  box-shadow: var(--shadow);
  font-weight:900;
  font-size:42px;
  color: var(--brand-700);
  line-height:1.1;
}
.big-card:hover { filter: brightness(.99); }
@media (max-width:640px){
  .grid-cards { grid-template-columns:1fr; }
  .big-card { min-height:160px; font-size:34px; }
}

/* ---------- Toolbar (desktop row, mobile column) ---------- */
.table-tools{
  display:flex;
  align-items:center;
  gap:8px;
  margin:12px 0;
  flex-wrap:wrap;
}
.table-tools-form{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  flex-wrap:wrap;
}
/* Fix toolbar sizing: don't force full width inside the flex row */
.table-tools input[type="text"],
.table-tools input[type="search"],
.table-tools select {
  width: auto;               /* override the global width:100% */
  flex: 0 1 auto;            /* allow shrinking if space is tight */

}
.table-tools select {
  display: inline-block;
  height: 40px;
  line-height: 40px;        /* vertically centers text */
  min-width: 110px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 36px 0 10px;   /* add room for dropdown arrow */
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath fill='%23333' d='M7 10L0 0h14z'/%3E%3C/svg%3E") no-repeat right 12px center / 10px;
  appearance: none;         /* hide native arrow */
  -webkit-appearance: none;
  -moz-appearance: none;
  color: var(--text);
  flex: 0 0 auto;
  vertical-align: middle;   /* aligns with buttons */
}

.table-tools .select-wrap {
  position: relative;
  flex: 0 0 auto;
}
.table-tools .select-wrap select {
  height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  appearance: none;
}
.table-tools .select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid #334155;
  border-bottom: 2px solid #334155;
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}

.table-tools .btn{
  height:40px;
  padding:0 16px;
  border-radius:10px;
  flex:0 0 auto;
  white-space:nowrap;
}
@media (min-width:640px){
  .table-tools-form{ flex-wrap:nowrap; }
}
@media (max-width:640px){
  .table-tools-form{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .table-tools input[type="text"],
  .table-tools input[type="search"],
  .table-tools select,
  .table-tools .btn{
    width:100%;
    flex:1 1 auto;
  }
}

/* ---------- Tables ---------- */
.table {
  width:100%;
  border-collapse: collapse;
  table-layout: auto;
}

.table { table-layout: fixed; }          /* keeps column widths stable */
.table th, .table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* cleaner separators: one line per header + per row */
.table th, .table td {
  padding: 10px 12px;
  vertical-align: middle;           /* nicer alignment */
  border-bottom: 0;                 /* <-- remove per-cell borders */
}
.table thead th {                   /* underline the header row */
  border-bottom: 1px solid var(--border);
}
.table tbody tr {                   /* one separator per data row */
  border-bottom: 1px solid var(--border);
}

.table th {
  background:#f1f5f9;
  font-weight:800;
  color:#0b162b;
}
.table tbody tr:hover { background:#f9fbfd; }
.table.compact th, .table.compact td { padding:8px 10px; }

/* Responsive hiding */
@media (max-width:1024px){
  .page-instansi th.col-email, .page-instansi td.col-email { display:none; }
}
@media (max-width:768px){
  .page-instansi th.col-alamat, .page-instansi td.col-alamat { display:none; }
  .page-perkara th.col-pekerjaan, .page-perkara td.col-pekerjaan { display:none; }
  .page-perkara th.col-umur, .page-perkara td.col-umur { display:none; }
}

/* Small stacked table layout */
@media (max-width:480px){
  .table.stacked{ border:0; }
  .table.stacked thead{ display:none !important; }
  .table.stacked tbody{ display:block; }
  .table.stacked tr{
    display:block;
    background:#fff;
    border:1px solid var(--border);
    border-radius:14px;
    margin:10px 0;
    padding:8px 10px;
    box-shadow:0 6px 18px rgba(2,8,23,.05);
  }
  .table.stacked td{
    display:grid;
    grid-template-columns:120px 1fr;
    gap:8px;
    border:0;
    padding:6px 0;
  }
  .table.stacked td::before{
    content: attr(data-label);
    font-weight:700;
    color:#334155;
  }
}

/* ---------- Pager ---------- */
.pager {
  margin-top:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  color:var(--muted);
  font-size:14px;
}
.pager-links a, .pager-links span {
  margin:0 4px;
  padding:6px 10px;
  border-radius:10px;
  border:1px solid transparent;
  text-decoration:none;
}
.pager-links a { border-color: var(--border); color:inherit; }
.pager-links a:hover { background:#f1f5f9; }
.pager-links .current { background: var(--brand-700); color:#fff; }
@media (max-width:480px){
  .pager { flex-direction:column; align-items:flex-start; gap:6px; }
}

/* ---------- Users page: credential card ---------- */
.cred-card {
  border:1px dashed var(--brand-700);
  background: var(--brand-50);
  border-radius:14px;
  padding:12px;
  margin-bottom:12px;
}
.cred-title { font-weight:900; margin-bottom:6px; }
.cred-row { display:flex; align-items:center; gap:12px; margin:4px 0; }
.cred-row span { width:90px; color:var(--muted); }
.cred-note { color:var(--muted); font-size:13px; }

/* Users actions cluster */
.row-actions {
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  flex-wrap:wrap;
}
.row-actions form {
  display:flex;
  align-items:center;
  margin:0;
  padding:0;
}
.row-actions .btn {
  line-height:1;
  height:36px;
  padding:0 14px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.row-actions .btn-outline {
  border:1px solid #d0d7de;
  background:#fff;
  color:#0f172a;
}
.row-actions .btn-outline.danger {
  border-color:#fecaca;
  color:#b91c1c;
}

/* ---------- Modal ---------- */
.modal { position:fixed; inset:0; display:none; z-index:50; }
.modal.show { display:block; }
.modal-backdrop { position:absolute; inset:0; background: rgba(2,8,23,.45); }
.modal-dialog {
  position:relative;
  max-width:420px;
  width:calc(100% - 24px);
  margin:10vh auto;
  background:#fff;
  border-radius:16px;
  box-shadow:0 20px 60px rgba(2,8,23,.25);
  overflow:hidden;
}
.modal-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  background: var(--brand-700);
  color:#fff;
  font-weight:900;
}
.modal-close {
  background:transparent;
  border:0;
  color:#fff;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}
.modal-body {
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:14px;
}
.modal-body input {
  height:40px;
  border-radius:10px;
  border:1px solid var(--border);
  padding:0 10px;
}
.modal-actions { display:flex; gap:8px; margin-top:8px; }

/* ---------- Print tweaks ---------- */
@media print {
  .topbar, .table-tools, .pager, .login-pill, .btn, .modal, .cred-card {
    display:none !important;
  }
  body { background:#fff; }
  .container { max-width:100%; padding:0; }
  .card { box-shadow:none; border:0; padding:0; }
  .table th, .table td { border-color:#999; }
}

/* ---------- Small responsive tweaks ---------- */
@media (max-width:640px){
  .topbar-inner { padding:10px 12px; }
  .brand img { width:36px; height:36px; }
  .brand-title { font-size:18px; }
  .card { padding:14px; border-radius:16px; }
}

/* === Reusable fade-in class === */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

/* Optional variants */
.fade-in-up {               /* fade + slide up */
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease-out forwards;
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hide honeypot anti-bot field */
input.hp {
  display: none !important;
  visibility: hidden;
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
