/* ============================================================
   shared.css — 校園演唱會購票系統 共用樣式
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --card: #fff;
  --text: #111;
  --muted: rgba(17,17,17,.65);
  --line: rgba(17,17,17,.10);
  --shadow: 0 14px 40px rgba(0,0,0,.08);
  --shadow-sm: 0 10px 26px rgba(0,0,0,.05);
  --danger: #b91c1c;
  --ok: #166534;
  --info: #1d4ed8;
  --warn-bg: #fff5f5;
  --warn-border: rgba(185,28,28,.18);
  --soft-bg: #f1f2f6;
  --soft-border: rgba(17,17,17,.12);

  --btn-h: 44px;
  --btn-fs: 16px;
  --r: 18px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
}

/* ── Layout ── */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}
.wrap-lg { max-width: 1100px; }
.wrap-xl { max-width: 1080px; }

@media (max-width: 640px) {
  .wrap { padding: 28px 16px; }
}

/* ── Cards ── */
.card, .section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.card-soft, .soft {
  background: var(--soft-bg);
  border: 1px solid var(--soft-border);
}

.card-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

/* ── Typography ── */
h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: .2px; }
h2 { margin: 0; font-size: 16px; font-weight: 900; }
h3 { margin: 0 0 6px; font-size: 15px; font-weight: 900; }

.sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin-top: 6px;
}

.small, .hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.ok  { color: var(--ok);     font-weight: 900; }
.warn{ color: var(--danger); font-weight: 900; }
.info{ color: var(--info);   font-weight: 900; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-h);
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 900;
  font-size: var(--btn-fs);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:hover  { box-shadow: 0 10px 22px rgba(0,0,0,.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

.btn-primary { background: #111; color: #fff; border-color: #111; }
.btn-danger  { background: #fff; color: var(--danger); border-color: rgba(239,68,68,.35); }
.btn-danger-fill { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { height: 40px; padding: 8px 16px; font-size: 15px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tab:hover { box-shadow: 0 10px 22px rgba(0,0,0,.08); transform: translateY(-1px); }
.tab.active { background: #111; color: #fff; border-color: #111; box-shadow: none; transform: none; }

/* ── Pills & Badges ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  font-size: 14px;
  background: #fff;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

/* ── Forms ── */
label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 900;
}
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  outline: none;
  color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }

/* ── Grid Helpers ── */
.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.row-center { align-items: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-end { justify-content: flex-end; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

@media (max-width: 900px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ── List / Item ── */
.list { display: grid; gap: 12px; }
.item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.item-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.45;
}
.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

/* ── Table ── */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  margin-top: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}
th {
  background: #fafafa;
  font-weight: 900;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }

/* ── KV Detail Block ── */
.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.kv:first-child { border-top: none; }
.kv .k { color: var(--muted); font-size: 13px; line-height: 1.5; }
.kv .v { font-size: 13px; font-weight: 900; line-height: 1.5; word-break: break-word; }

@media (max-width: 640px) {
  .kv { grid-template-columns: 105px 1fr; }
}

/* ── Modal ── */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.35);
}
.modal-back.open { display: flex; }
.modal {
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
}
.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 52px;
}
.navbar-brand {
  font-weight: 900;
  font-size: 15px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  padding-right: 16px;
  border-right: 1px solid var(--line);
  margin-right: 14px;
}
.navbar-crumb {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.navbar-role {
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .navbar { padding: 0 16px; }
  .navbar-crumb { display: none; }
}

/* ── Page transition ── */
.page {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
}
.page.on { opacity: 1; transform: translateY(0); }
.page.leaving { opacity: 0; transform: translateY(6px); }

/* ── Tile (dashboard) ── */
.tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: space-between;
}
.tile h3 { margin: 0; font-size: 16px; }
.tile p  { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ── Divider ── */
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* ── Impersonate Banner ── */
.impersonate-banner {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.impersonate-title { font-weight: 900; color: var(--danger); }
