/* ============================================================
   Peminjaman Barang IT · form.ipekabsd.my.id
   Tocly standard (Bootstrap 5.3 + app.min.css). Page-level styles only.
   ============================================================ */

:root {
  --form-primary: #0c768a;   /* Tocly $primary */
  --form-bg:      #f5f8f9;   /* Tocly $header-bg */
  --form-border:  #e8ecef;   /* Tocly card border tone */
  --form-text:    #1d222e;   /* Tocly $gray-700 */
  --form-muted:   #8590a5;   /* Tocly $gray-500 */
  --form-success: #38c786;   /* Tocly $success */
  --form-warning: #f4ba40;   /* Tocly $yellow */
  --form-danger:  #ed5e49;   /* Tocly $red */
  --form-info:    #4e9def;   /* Tocly $cyan */
  --form-purple:  #986de5;   /* Tocly $purple */
  --form-orange:  #f1734f;   /* Tocly $orange */
}

[hidden] { display: none !important; }

body.form-body {
  background: var(--form-bg);
  color: var(--form-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.form-main { flex: 1 0 auto; padding: 24px 0 48px; }

/* ---------- Topbar ---------- */
.form-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--form-border);
}
.form-topbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.form-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.form-brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--form-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.form-brand-name { font-size: 14px; font-weight: 500; line-height: 1.25; letter-spacing: -.2px; }
.form-brand-sub  { font-size: 11px; color: var(--form-muted); line-height: 1.3; }

/* ---------- Hero ---------- */
.form-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 28px 32px;
  color: #fff;
  margin-top: 16px;
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 255, 255, .14), transparent 40%),
    radial-gradient(circle at 10% 100%, rgba(255, 255, 255, .10), transparent 45%),
    linear-gradient(135deg, #0d8198 0%, #0c768a 45%, #085a6a 100%);
  box-shadow: 0 10px 30px rgba(8, 90, 106, .18);
}
.form-hero-title { font-size: 24px; font-weight: 600; letter-spacing: -.3px; margin: 0 0 6px; }
.form-hero-sub { font-size: 14px; color: rgba(255, 255, 255, .85); margin: 0; max-width: 640px; }
.form-hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.form-hero-stat {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 110px;
}
.form-hero-stat .label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: rgba(255, 255, 255, .75); }
.form-hero-stat .value { display: block; font-size: 20px; font-weight: 600; }

/* ---------- Cards ---------- */
.form-card {
  border: 1px solid var(--form-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(29, 34, 46, .04);
}
.form-card-title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; margin: 0; }
.form-card-body { padding: 20px 22px; }

/* ---------- Filters ---------- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--form-border);
  background: #fff;
  color: var(--form-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.filter-chip:hover { border-color: rgba(12, 118, 138, .45); }
.filter-chip.active { background: var(--form-primary); color: #fff; border-color: var(--form-primary); }
.filter-chip .count { font-size: 11px; opacity: .75; }

/* ---------- Borrower table ---------- */
.borrow-table { font-size: 13px; }
.borrow-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--form-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--form-border);
  white-space: nowrap;
}
.borrow-table td { vertical-align: middle; border-color: var(--form-border); }
.borrow-table .borrower-name { font-weight: 600; overflow-wrap: anywhere; }
.borrow-table .borrower-sub { font-size: 11px; color: var(--form-muted); }
.borrow-table tbody tr:hover td { background: #fafcfd; }
.borrow-table .item-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--form-bg);
  border: 1px solid var(--form-border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  margin: 1px 3px 1px 0;
  white-space: nowrap;
}
.borrow-table .item-chip .qty { font-weight: 700; color: var(--form-primary); }

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.status-badge.tone-warning  { background: #fef9ec; color: #8a6412; }
.status-badge.tone-danger   { background: #fef2f2; color: #b91c1c; }
.status-badge.tone-info     { background: #eaf6ff; color: #1e4d7a; }
.status-badge.tone-primary  { background: #f0fafa; color: #0c768a; }
.status-badge.tone-success  { background: #edfaf4; color: #166534; }
.status-badge.tone-secondary{ background: #f1f5f9; color: #475569; }

/* ---------- Request form ---------- */
.request-form .form-label { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.request-form .form-control, .request-form .form-select { font-size: 13px; }
.line-item select { pointer-events: auto; cursor: pointer; position: relative; z-index: 1; }
.line-item {
  background: var(--form-bg);
  border: 1px solid var(--form-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.line-item .line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.line-item .line-head .line-no { font-size: 12px; font-weight: 600; color: var(--form-muted); }
.line-remove { color: var(--form-muted); cursor: pointer; }
.line-remove:hover { color: var(--form-danger); }
.line-remove .mdi { font-size: 18px; }
.avail-hint { font-size: 11px; color: var(--form-muted); margin-top: 4px; }

/* ---------- Empty state ---------- */
.form-empty { text-align: center; color: var(--form-muted); font-size: 13px; padding: 32px 12px; }
.form-empty .mdi { font-size: 34px; display: block; margin-bottom: 8px; color: #b8c2cc; }

/* ---------- Toast ---------- */
.form-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--form-text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1100;
  max-width: calc(100vw - 32px);
}
.form-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.form-footer { border-top: 1px solid var(--form-border); background: #fff; padding: 14px 0; font-size: 12px; color: var(--form-muted); }
.form-footer .mdi { color: var(--form-primary); }

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .form-main { padding: 20px 0 40px; }
  .form-hero { padding: 22px 20px; }
  .form-hero-title { font-size: 20px; }
  .borrow-table { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .filter-chip, .form-toast { transition: none; }
}

/* ============================================================
   Admin panel (Tocly admin shell)
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--form-bg);
}
.auth-screen[hidden] { display: none; }
.auth-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--form-border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(29, 34, 46, .08);
}
.auth-brand {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--form-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
}
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }

.pin-boxes { display: flex; justify-content: center; gap: 8px; }
.pin-box {
  width: 46px; height: 54px;
  border: 1.5px solid var(--form-border);
  border-radius: 10px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  background: #f8fafc;
  color: var(--form-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.pin-box:focus { border-color: var(--form-primary); box-shadow: 0 0 0 3px rgba(12, 118, 138, .15); background: #fff; }
.pin-box:not(:placeholder-shown), .pin-box.filled { border-color: var(--form-primary); }
.pin-box.is-error { border-color: #ef4444; animation: shake .3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.page-title-box h4 { font-weight: 600; letter-spacing: -.2px; }
.stat-card .card-body { padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--form-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.2; }

.form-admin-table { font-size: 13px; }
.form-admin-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--form-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--form-border);
  white-space: nowrap;
}
.form-admin-table td { vertical-align: middle; border-color: var(--form-border); }
.form-admin-table tbody tr:hover td { background: #fafcfd; }

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--form-border);
}
.danger-row:last-child { border-bottom: none; padding-bottom: 0; }
.danger-row:first-child { padding-top: 0; }
.danger-row h6 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.danger-row p { font-size: 12px; color: var(--form-muted); margin: 0; }

.admin-footer { font-size: 12px; color: var(--form-muted); }

/* dialog */
.form-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 20px 50px rgba(29, 34, 46, .25);
}
.form-dialog::backdrop { background: rgba(29, 34, 46, .45); }
