/* Costume Inventory — clean, friendly, large-target UI for non-technical users */
:root {
  /* CSBC Saints palette: hunter green (#144734) + white, gold accent */
  --bg: #f3f6f3;
  --card: #ffffff;
  --ink: #1d2a23;
  --muted: #5c6b62;
  --line: #dde6df;
  --brand: #144734;       /* CSBC hunter green */
  --brand-dark: #0e3526;
  --accent: #c39a2e;      /* scholastic gold accent */
  --ok: #2e7d4f;
  --warn: #b5611d;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--brand); color: #fff; padding: 10px 20px;
  box-shadow: var(--shadow);
}
.topbar a { color: #fff; }
.brand { font-weight: 700; font-size: 1.15rem; display: inline-flex; align-items: center; gap: 9px; }
.brand-logo { height: 34px; width: auto; max-width: 150px; vertical-align: middle; background: #fff; border-radius: 5px; padding: 2px; }
.mainnav { display: flex; gap: 16px; flex: 1; }
.mainnav a { opacity: .92; padding: 4px 2px; border-bottom: 2px solid transparent; }
.mainnav a:hover { opacity: 1; text-decoration: none; border-bottom-color: var(--accent); }
.useritem { display: flex; align-items: center; gap: 14px; }
.who { font-size: .85rem; opacity: .85; }

.container { max-width: 1200px; margin: 22px auto; padding: 0 20px; }

/* ---- Flash messages ---- */
.flashes { margin-bottom: 16px; }
/* On the login page the flashes render below the sign-in card. */
.auth-wrap .flashes { margin: 16px 0 0; }
.flash { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 8px; border: 1px solid transparent; }
.flash-success { background: #e7f4ec; color: var(--ok); border-color: #bfe3cd; }
.flash-error   { background: #fbeceb; color: var(--danger); border-color: #f3c9c6; }
/* Default category, e.g. flask-login's "please sign in" notice. */
.flash-message { background: #f7f4ec; color: var(--ink); border-color: var(--line); }

/* ---- Buttons ---- */
.btn {
  display: inline-block; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 9px 16px; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600; line-height: 1.1; text-align: center;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: #fff; border-color: #e3b7b4; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 1.5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 1rem; background: #fff; color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.quick-add-grid { align-items: start; }
.quick-add-card { padding-bottom: 16px; }
.quick-add-details { margin-top: 18px; background: #fbfaf6; }
.quick-add-details summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.quick-add-details[open] summary { margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.field-wide { grid-column: 1 / -1; }
.field-end { align-self: end; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.form-hint { margin: 0 0 12px; }
.inline-form { display: flex; gap: 6px; }
.card-title { margin-top: 0; }
.user-edit-card { max-width: 720px; }

/* ---- Search / filter bar ---- */
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filterbar .field { margin: 0; }
.filterbar .grow { flex: 1; min-width: 220px; }

/* ---- List controls (select-all + view toggle) ---- */
.list-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.list-controls .selall { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--muted); cursor: pointer; }
.list-controls .selall input { width: 18px; height: 18px; accent-color: var(--brand); }
.viewtoggle { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.viewtoggle a { padding: 6px 14px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.viewtoggle a:hover { text-decoration: none; background: #faf8f3; }
.viewtoggle a.on { background: var(--brand); color: #fff; }

/* ---- Table (list) view ---- */
.table-card { padding: 0; overflow-x: auto; }
.item-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.item-table thead th { background: #faf8f3; font-size: .72rem; padding: 11px 12px; white-space: nowrap; }
.item-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.item-table .mono { white-space: nowrap; }
.item-table td:last-child { white-space: nowrap; }
.item-table .strong { min-width: 150px; }
.item-table tbody tr:last-child td { border-bottom: none; }
.item-row { cursor: pointer; }
.item-row:hover td { background: #faf8f3; }
.item-row.selected td { background: #fbf3e2; }
.item-table .col-check { width: 38px; text-align: center; }
.item-table .col-check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.item-table .col-thumb { width: 50px; }
.row-thumb { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 7px; background: #ece6da center/cover no-repeat; font-size: 1rem; }
.item-table .mono { font-variant-numeric: tabular-nums; font-size: .85rem; }
.item-table .strong { font-weight: 700; }

/* ---- Item grid (compact cards) ---- */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.item-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; height: 100%; }
.item-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.item-thumb { aspect-ratio: 4/3; background: linear-gradient(135deg,#efeadf,#e6dfd1) center/cover no-repeat; display: flex; align-items: center; justify-content: center; }
.item-thumb .ph { font-size: 1.7rem; opacity: .45; }
.item-body { padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; }
.item-name { font-weight: 700; color: var(--ink); font-size: .92rem; line-height: 1.25; }
.item-meta { font-size: .76rem; color: var(--muted); }
.item-body .pill { align-self: flex-start; margin-top: 4px; }

/* ---- Bulk selection ---- */
.item-card-wrap { position: relative; }
.item-card-wrap .rowcheck {
  position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; z-index: 3;
  cursor: pointer; accent-color: var(--brand);
  background: #fff; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.item-card-wrap.selected .item-card { outline: 3px solid var(--accent); border-color: var(--accent); }

.bulkbar {
  position: sticky; bottom: 14px; z-index: 20; margin-top: 18px;
  display: none; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.28);
}
.bulkbar.show { display: flex; }
.bulkbar .bulkbar-count { font-size: 1rem; margin-right: 4px; }
.bulkbar .btn { background: #fff; }
.bulk-inline { display: inline-flex; gap: 6px; align-items: center; }
.bulk-select { padding: 6px 9px; border-radius: 8px; font-size: .9rem; min-width: 150px; }

/* ---- Quick filters ---- */
.quickbar { display: flex; flex-wrap: wrap; gap: 7px; margin: -4px 0 16px; }
.quick {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: .82rem;
  font-weight: 600; background: #fff; border: 1px solid var(--line); color: var(--muted);
}
.quick:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.quick.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- Print header (reports & labels) ---- */
.print-header { display: none; align-items: center; gap: 14px; border-bottom: 2px solid var(--brand); padding-bottom: 10px; margin-bottom: 14px; }
.print-header .ph-logo { height: 46px; width: auto; }
.print-header .ph-text { flex: 1; }
.print-header .ph-name { font-weight: 800; font-size: 1.1rem; color: var(--brand); }
.print-header .ph-title { color: var(--muted); }
.print-header .ph-date { color: var(--muted); font-size: .85rem; }
@media print { .print-header { display: flex; } }

/* ---- Tags & chips ---- */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; background: #e8f0ea;
  color: var(--brand); border: 1px solid #cfe0d4; padding: 3px 10px;
  border-radius: 999px; font-size: .82rem; font-weight: 600;
}
a.chip:hover { background: var(--brand); color: #fff; text-decoration: none; border-color: var(--brand); }
.chip-mini { display: inline-block; background: #eef2ef; color: var(--muted); padding: 1px 8px; border-radius: 999px; font-size: .76rem; }
.chip-xs { padding: 1px 8px; font-size: .7rem; font-weight: 600; }
.chip-removable { padding-right: 6px; }
.chip-x { background: none; border: none; cursor: pointer; color: var(--brand); font-size: .8rem; padding: 0 2px; line-height: 1; }
a.chip-x { color: var(--muted); font-weight: 600; }
.active-tag { display: flex; align-items: center; gap: 10px; margin: -4px 0 14px; font-size: .9rem; color: var(--muted); }

/* ---- Custom fields admin ---- */
.row-off td { opacity: .5; }
.inline-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-edit input[type=text] { width: auto; min-width: 120px; }
.inline-edit .opt-in { min-width: 120px; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state .emoji { font-size: 2.6rem; margin: 0 0 4px; }
.empty-state h3 { margin: 6px 0; }
.starter-state { text-align: left; padding: 28px; }
.starter-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 18px 0 16px; }
.starter-state .starter-actions { justify-content: flex-start; }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 18px; }
.starter-card { background: #f7f4ec; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: left; }
.starter-card p { margin-bottom: 0; }

/* ---- Status pills ---- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.pill.s-Available { background: #e7f4ec; color: var(--ok); }
.pill.s-CheckedOut { background: #fdeede; color: var(--warn); }
.pill.s-CleaningRepair { background: #eef0fb; color: #3a4a9b; }
.pill.s-Retired { background: #eee; color: #777; }
.pill.overdue { background: #fbeceb; color: var(--danger); }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:hover td { background: #faf8f3; }

/* ---- Detail layout ---- */
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.gallery-main { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #ece6da; aspect-ratio: 1/1; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.gallery-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.gallery-thumbs img.is-primary { border-color: var(--accent); }
.spec-table td:first-child { color: var(--muted); width: 140px; font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); color: inherit; }
.stat:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.stat .num { font-size: 1.8rem; font-weight: 800; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: .85rem; }
.stat-alert .num { color: var(--danger); }
.quicklinks { display: flex; flex-direction: column; gap: 8px; }
.quicklinks .btn { text-align: left; }

/* ---- Pagination ---- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pager .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- Auth ---- */
.auth-wrap { max-width: 380px; margin: 8vh auto; }
.auth-links { margin: 14px 0 0; text-align: center; font-size: .9rem; }
.auth-wrap .brand-big { text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.auth-wrap .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display:inline-block; background:#efe9dd; color:var(--muted); padding:2px 8px; border-radius:6px; font-size:.78rem; margin:2px 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---- Print: labels & reports ---- */
@media print {
  .topbar, .no-print, .form-actions, .pager { display: none !important; }
  body { background: #fff; }
  .container { margin: 0; max-width: none; }
  .card { box-shadow: none; border: none; }
}
.label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.label { border: 1px solid #ccc; border-radius: 6px; padding: 8px; text-align: center; break-inside: avoid; }
.label img { max-width: 100%; height: auto; }
.label .ln { font-weight: 700; font-size: .8rem; margin-top: 4px; }
.label .nm { font-size: .72rem; color: #444; }

@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
  .mainnav { gap: 12px; font-size: .9rem; }
}
