/* BoothMe Studio portal — bàn làm việc trên máy tính: nền sáng, chữ 14px,
   bảng nhiều cột. Bảng màu kế thừa portal Fortomedia (xanh dương trên nền kem). */

:root {
  --bm-canvas: #F3F8FD;
  --bm-card: #FFFFFF;
  --bm-text: #062158;
  --bm-muted: #58749D;
  --bm-blue: #0B8FF0;
  --bm-blue-strong: #06327C;
  --bm-blue-soft: #E8F6FF;
  --bm-border: #D5EAFB;
  --bm-ok: #138A52;
  --bm-ok-soft: rgba(19, 138, 82, .12);
  --bm-danger: #9B3A2E;
  --bm-danger-soft: rgba(155, 58, 46, .10);
  --bm-shadow: 0 18px 42px rgba(11, 143, 240, .08);
  --bm-radius: 10px;
  --bm-font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(11, 143, 240, .10), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(125, 211, 252, .16), transparent 32%),
    var(--bm-canvas);
  color: var(--bm-text);
  font-family: var(--bm-font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--bm-blue); outline-offset: 2px; }
a { color: var(--bm-blue-strong); }
.muted { color: var(--bm-muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ── Nút & ô nhập ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 16px;
  border: 1px solid var(--bm-blue); border-radius: var(--bm-radius);
  background: linear-gradient(135deg, #13A8FF 0%, #0B8FF0 48%, #06327C 100%);
  color: #fff; font: inherit; font-size: 13px; font-weight: 700;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 10px 24px rgba(11, 143, 240, .18);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; opacity: .9; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn--ghost { background: #fff; color: var(--bm-text); border-color: rgba(11, 143, 240, .3); box-shadow: none; }
.btn--ghost:hover { background: var(--bm-blue-soft); }
.btn--danger { background: #fff; color: var(--bm-danger); border-color: rgba(155, 58, 46, .35); box-shadow: none; }
.btn--danger:hover { background: var(--bm-danger-soft); }
.btn--sm { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.btn--wide { width: 100%; }

.label { display: block; margin: 12px 0 5px; font-size: 12px; font-weight: 700; }
.field {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--bm-border); border-radius: var(--bm-radius);
  background: #F7FBFF; color: var(--bm-text); font: inherit;
}
.field:focus { outline: none; border-color: var(--bm-blue); box-shadow: 0 0 0 3px rgba(11, 143, 240, .15); }
.form-error { margin: 12px 0 0; color: var(--bm-danger); font-size: 13px; white-space: pre-wrap; }

/* ── Đăng nhập ────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 100%); padding: 34px 30px 30px;
  background: var(--bm-card); border: 1px solid var(--bm-border); border-radius: 16px;
  box-shadow: var(--bm-shadow);
}
.login-title { margin: 14px 0 4px; font-size: 20px; text-align: center; }
.login-sub { margin: 0 0 14px; font-size: 13px; text-align: center; }
.login-card .btn { margin-top: 20px; min-height: 46px; }

.brand-mark {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto;
  border-radius: 16px;
  background: linear-gradient(135deg, #13A8FF 0%, #06327C 100%);
  color: #fff; font-size: 26px; font-weight: 700;
  box-shadow: 0 12px 26px rgba(11, 143, 240, .25);
}
.brand-mark--sm { width: 38px; height: 38px; margin: 0; border-radius: 11px; font-size: 18px; }

/* ── Khung ứng dụng ───────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bm-border);
}
.topbar-brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 0; }
.topbar-copy { display: grid; line-height: 1.15; min-width: 0; }
.topbar-copy strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-copy span { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--bm-muted); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav-item {
  padding: 8px 12px; border: 0; border-radius: var(--bm-radius);
  background: transparent; color: var(--bm-muted);
  font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.topnav-item:hover { background: var(--bm-blue-soft); color: var(--bm-text); }
.topnav-item.active { background: var(--bm-blue-soft); color: var(--bm-text); box-shadow: inset 0 0 0 1px rgba(11, 143, 240, .18); }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 26px 28px 60px; outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 2px 0 0; font-size: 22px; line-height: 1.25; }
.crumb { font-size: 12.5px; }
.crumb a { text-decoration: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Thẻ số liệu ──────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { padding: 14px 16px; background: var(--bm-card); border: 1px solid var(--bm-border); border-radius: var(--bm-radius); }
.stat-label { font-size: 11.5px; color: var(--bm-muted); font-weight: 600; }
.stat-value { margin-top: 2px; font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-sub { margin-top: 2px; font-size: 12px; color: var(--bm-muted); }

.card { background: var(--bm-card); border: 1px solid var(--bm-border); border-radius: 14px; box-shadow: var(--bm-shadow); }
.card-pad { padding: 18px 20px; }
.section-title { margin: 26px 0 12px; font-size: 15px; }

/* ── Danh sách máy ────────────────────────────────────────────────────────── */
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.machine { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.machine-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.machine-name { margin: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.machine-meta { font-size: 12px; color: var(--bm-muted); overflow-wrap: anywhere; }
.machine-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.machine-numbers div { padding: 8px 10px; background: var(--bm-blue-soft); border-radius: 8px; }
.machine-numbers b { display: block; font-size: 16px; }
.machine-numbers span { font-size: 11px; color: var(--bm-muted); }
.machine-actions { display: flex; gap: 8px; margin-top: auto; }
.machine-actions .btn { flex: 1; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--on { color: var(--bm-ok); background: var(--bm-ok-soft); }
.status--off { color: var(--bm-muted); background: rgba(88, 116, 157, .12); }

/* ── Bảng sự kiện ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--bm-border); vertical-align: middle; }
table.data th { font-size: 11.5px; color: var(--bm-muted); font-weight: 700; white-space: nowrap; background: #F9FCFF; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--bm-text); }
table.data th .arrow { opacity: .6; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data td .actions { display: flex; gap: 6px; justify-content: flex-end; }
.event-name { font-weight: 600; }
.note { margin: 10px 0 0; font-size: 12px; color: var(--bm-muted); }

/* ── Trang sự kiện ────────────────────────────────────────────────────────── */
.event-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.qr-card { padding: 18px; text-align: center; position: sticky; top: 84px; }
.qr-card canvas { width: 100%; max-width: 240px; height: auto; image-rendering: pixelated; border-radius: 8px; }
.qr-url { margin: 10px 0 12px; font-size: 11.5px; overflow-wrap: anywhere; color: var(--bm-muted); }
.qr-actions { display: grid; gap: 8px; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--bm-radius); font-size: 13px; margin-bottom: 14px; }
.banner--warn { background: var(--bm-danger-soft); color: var(--bm-danger); }
.banner--info { background: var(--bm-blue-soft); color: var(--bm-blue-strong); }

.sessions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.session {
  display: block; overflow: hidden;
  background: var(--bm-card); border: 1px solid var(--bm-border); border-radius: var(--bm-radius);
  color: inherit; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.session:hover { transform: translateY(-2px); box-shadow: var(--bm-shadow); }
.session-thumb { aspect-ratio: 2 / 3; background: var(--bm-blue-soft); display: grid; place-items: center; color: var(--bm-muted); font-size: 12px; }
.session-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.session-label { padding: 8px 10px; font-size: 12.5px; font-weight: 600; }

/* ── Thương hiệu ──────────────────────────────────────────────────────────── */
.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 54px; height: 44px; padding: 3px; border: 1px solid var(--bm-border); border-radius: var(--bm-radius); background: #fff; cursor: pointer; }
.color-row .field { max-width: 140px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--bm-border); cursor: pointer; }
.logo-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-thumb { width: 96px; height: 96px; border: 1px dashed var(--bm-border); border-radius: 12px; display: grid; place-items: center; background: #F7FBFF; overflow: hidden; color: var(--bm-muted); font-size: 11px; text-align: center; }
.logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

.preview { overflow: hidden; border-radius: 18px; border: 1px solid var(--bm-border); box-shadow: var(--bm-shadow); }
.preview-page { padding: 22px 18px 18px; text-align: center; min-height: 380px; transition: background-color .2s ease, color .2s ease; }
.preview-logo { height: 46px; margin: 0 auto 10px; display: grid; place-items: center; }
.preview-logo img { max-height: 46px; max-width: 160px; object-fit: contain; }
.preview-logo span { font-weight: 700; font-size: 14px; }
.preview-title { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.preview-hero { aspect-ratio: 2 / 3; max-width: 170px; margin: 0 auto 12px; border-radius: 10px; background: rgba(255, 255, 255, .55); box-shadow: 0 10px 24px rgba(0, 0, 0, .10); }
.preview-btn { display: inline-block; padding: 9px 14px; border-radius: 999px; background: #0B8FF0; color: #fff; font-size: 12px; font-weight: 700; }

/* ── Hộp thoại & thông báo ────────────────────────────────────────────────── */
.modal { border: 0; padding: 0; border-radius: 16px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(6, 33, 88, .25); }
.modal::backdrop { background: rgba(6, 33, 88, .35); }
.modal-card { padding: 22px 22px 18px; }
.modal-title { margin: 0 0 6px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px;
  background: var(--bm-text); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 16px 40px rgba(6, 33, 88, .3);
}
.toast--error { background: var(--bm-danger); }

.empty { padding: 34px 20px; text-align: center; color: var(--bm-muted); }
.skeleton { padding: 40px; text-align: center; color: var(--bm-muted); }

@media (max-width: 900px) {
  .event-layout, .brand-layout { grid-template-columns: 1fr; }
  .qr-card { position: static; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar-copy span { display: none; }
  .content { padding: 18px 14px 48px; }
  .page-head h1 { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
