/* ============================================
   Carpark shared stylesheet
   ============================================ */
:root {
  --brand: #7a0026;
  --brand-dark: #5c001c;
  --brand-light: #ffe9ee;
  --accent: #0d9488;      /* teal accent for highlights / active nav */
  --accent-dark: #0f766e;
  --bg: #f2f4f7;
  --text: #333;
  --muted: #666;
  --border: #e6e6e6;
  --danger: #c0392b;
  --success: #1e8e3e;
  --warning: #b7791f;
}

* { box-sizing: border-box; }

body {
  font-family: 'Sarabun', -apple-system, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
}

/* ---------- Top navigation ---------- */
.topnav {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  flex-wrap: wrap;
}
.topnav .brand {
  font-weight: 700;
  font-size: 17px;
  padding: 16px 0;
  white-space: nowrap;
}
.topnav .brand small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: 0.8;
}
.topnav nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.topnav nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.topnav nav a:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.topnav nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(13,148,136,0.5);
}
.topnav .user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.topnav .user-label {
  font-size: 12.5px;
  background: rgba(255,255,255,0.12);
  padding: 6px 12px;
  border-radius: 20px;
}
.topnav .logout-link {
  color: #ffd6d6;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
}
.topnav .logout-link:hover { background: rgba(255,255,255,0.12); }
.badge-role {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 6px;
}
.badge-role.admin { background: #ffd166; color: #7a4b00; }
.badge-role.user { background: #a7f3d0; color: #065f46; }

/* ---------- Layout ---------- */
main.page {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 22px;
}
.panel h2 {
  margin-top: 0;
  font-size: 16px;
  color: var(--brand);
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}
.hint { color: #888; font-size: 12px; margin-bottom: 10px; }
.plate-link { font-size: 12.5px; color: var(--accent); text-decoration: none; }
.plate-link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.cards { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  flex: 1;
  min-width: 150px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border-top: 3px solid var(--accent);
}
.card h2 { margin: 0; font-size: 26px; color: var(--brand); border: none; padding: 0; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.card.pending { border-top-color: var(--warning); }
.card.approved { border-top-color: var(--success); }
.card.rejected { border-top-color: var(--danger); }

/* ---------- Forms ---------- */
label { display: block; margin: 8px 0 4px; font-size: 12.5px; color: #444; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #ddd;
  border-radius: 7px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13.5px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 150px; }

/* ---------- Buttons ---------- */
button {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: var(--brand-dark); }
button:active { transform: scale(0.98); }
button.secondary { background: #8a8a8a; }
button.secondary:hover { background: #6f6f6f; }
button.accent { background: var(--accent); }
button.accent:hover { background: var(--accent-dark); }
button.danger { background: var(--danger); }
button.danger:hover { background: #a5271b; }
button.success { background: var(--success); }
button.success:hover { background: #166b31; }
button.small { padding: 5px 10px; font-size: 12px; }
button:disabled { background: #ccc; cursor: not-allowed; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #faf5f6; color: var(--brand); font-weight: 700; }
tr:hover td { background: #fbfbfb; }
img.thumb { width: 32px; height: 40px; object-fit: cover; border-radius: 3px; vertical-align: middle; }
img.thumb-lg { width: 90px; height: 116px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.approved { background: #d1fae5; color: #065f46; }
.status-badge.rejected { background: #fee2e2; color: #991b1b; }

/* ---------- Misc ---------- */
.actions a, .actions button { display: inline-block; margin-right: 10px; margin-bottom: 10px; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 160px; }
ul.plain-list { list-style: none; padding: 0; margin: 0; }
ul.plain-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
}
ul.plain-list li:nth-child(even) { background: #fbfbfc; }
ul.plain-list li:hover { background: #faf5f6; }
ul.plain-list li.selected { background: var(--brand-light); font-weight: 700; }
/* Name/label takes the remaining space and wraps normally; the action
   buttons never shrink or wrap onto their own line, so long bilingual
   names (e.g. "...(DEPARTMENT OF X)") no longer push buttons underneath
   or overlap the text. */
ul.plain-list li > span:first-child { flex: 1 1 auto; min-width: 0; }
ul.plain-list li .li-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.li-actions button { margin: 0; padding: 6px 12px; }
.pager { margin-top: 12px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.notice-box {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: #7a4b00;
  margin-bottom: 18px;
  line-height: 1.7;
}
.notice-box.success { background: #e6f7ee; border-color: #a7f3d0; color: #065f46; }
.notice-box.error { background: #fdecea; border-color: #f5c6cb; color: #991b1b; }
