/*
 * Ezone UI v1 — components. Requires tokens.css. Style guide with markup: https://ezone.vn/ui/
 *
 * Every class starts with "ezu-" so it never collides with Bootstrap or an app's own classes
 * (POS already uses "ez-*"). Nothing here styles bare elements; opt in per element, or put
 * .ezu-page on <body> for the shared background and type.
 */

/* ---------- Page ---------- */
.ezu-page {
  background:
    radial-gradient(1200px 600px at -10% -10%, var(--ez-bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--ez-bg-glow-2), transparent 60%),
    var(--ez-body-bg);
  background-attachment: fixed;
  color: var(--ez-text);
  font-family: var(--ez-font);
  font-size: var(--ez-font-size);
  line-height: var(--ez-line-height);
  -webkit-font-smoothing: antialiased;
}

.ezu-muted { color: var(--ez-text-muted); }
.ezu-soft { color: var(--ez-text-soft); }

/* ---------- Buttons ---------- */
.ezu-btn {
  align-items: center;
  background: var(--ez-surface-hover);
  border: 1px solid transparent;
  border-radius: var(--ez-radius);
  color: var(--ez-text);
  cursor: pointer;
  display: inline-flex;
  font: 600 var(--ez-font-size)/1 var(--ez-font);
  gap: var(--ez-space-2);
  height: var(--ez-control-h);
  justify-content: center;
  padding: 0 var(--ez-space-4);
  text-decoration: none;
  transition: transform .15s var(--ez-ease), box-shadow .2s var(--ez-ease), background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.ezu-btn:hover:not(:disabled) { background: var(--ez-primary-soft); color: var(--ez-primary); }
.ezu-btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.ezu-btn:focus-visible { box-shadow: 0 0 0 4px var(--ez-focus-ring); outline: 0; }
.ezu-btn:disabled { cursor: not-allowed; opacity: .55; }

.ezu-btn-primary { background: var(--ez-brand-grad); box-shadow: var(--ez-shadow-brand); color: var(--ez-on-brand); }
.ezu-btn-primary:hover:not(:disabled) { background: var(--ez-brand-grad); box-shadow: 0 14px 30px rgba(11, 92, 255, .42); color: var(--ez-on-brand); transform: translateY(-1px); }
.ezu-btn-ghost { background: var(--ez-surface); border-color: var(--ez-border); }
.ezu-btn-ghost:hover:not(:disabled) { background: var(--ez-surface); border-color: var(--ez-primary); }
.ezu-btn-danger { background: var(--ez-danger-soft); color: var(--ez-danger); }
.ezu-btn-danger:hover:not(:disabled) { background: var(--ez-danger); color: #fff; }
.ezu-btn-sm { border-radius: var(--ez-radius-sm); font-size: 13px; height: 34px; padding: 0 var(--ez-space-3); }
.ezu-btn-lg { height: 48px; padding: 0 var(--ez-space-5); }
.ezu-btn-block { width: 100%; }

.ezu-icon-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--ez-radius);
  color: var(--ez-text-muted);
  cursor: pointer;
  display: inline-grid;
  flex: none;
  height: 38px;
  place-items: center;
  transition: background .2s, color .2s, transform .15s var(--ez-ease);
  width: 38px;
}
.ezu-icon-btn:hover { background: var(--ez-primary-soft); color: var(--ez-primary); }
.ezu-icon-btn:active { transform: scale(.94); }

/* ---------- Cards and layout helpers ---------- */
.ezu-card {
  background: var(--ez-surface);
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius-card);
  box-shadow: var(--ez-shadow-sm);
  color: var(--ez-text);
  padding: var(--ez-space-5);
}
.ezu-card-title { align-items: center; display: flex; font-size: 16px; font-weight: 700; gap: var(--ez-space-3); margin: 0 0 var(--ez-space-3); }
.ezu-glass {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  background: var(--ez-surface-glass);
}
.ezu-grid { display: grid; gap: var(--ez-space-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.ezu-stack { display: grid; gap: var(--ez-space-3); }
.ezu-row { align-items: center; display: flex; flex-wrap: wrap; gap: var(--ez-space-2); }

.ezu-icon-tile {
  align-items: center;
  background: var(--ez-primary-soft);
  border-radius: var(--ez-radius);
  color: var(--ez-primary);
  display: inline-grid;
  flex: none;
  height: 42px;
  place-items: center;
  width: 42px;
}
.ezu-icon-tile.is-brand { background: var(--ez-brand-grad); box-shadow: var(--ez-shadow-brand); color: #fff; }

/* ---------- Forms ---------- */
.ezu-field { color: var(--ez-text-muted); display: grid; font-size: 13px; font-weight: 600; gap: 6px; }
.ezu-input,
.ezu-select,
.ezu-textarea {
  background: var(--ez-surface-subtle);
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius);
  color: var(--ez-text);
  font: 400 var(--ez-font-size)/1.4 var(--ez-font);
  min-height: var(--ez-touch);
  outline: 0;
  padding: 0 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  width: 100%;
}
.ezu-textarea { min-height: 96px; padding: 10px 14px; resize: vertical; }
.ezu-input:focus,
.ezu-select:focus,
.ezu-textarea:focus { background: var(--ez-surface); border-color: var(--ez-focus-border); box-shadow: 0 0 0 4px var(--ez-primary-soft); }
.ezu-input::placeholder,
.ezu-textarea::placeholder { color: var(--ez-text-soft); }
@media (max-width: 767.98px) {
  .ezu-input, .ezu-select, .ezu-textarea { font-size: 16px; } /* no iOS zoom on focus */
}

/* ---------- Chips / tabs ---------- */
.ezu-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ezu-chips::-webkit-scrollbar { display: none; }
.ezu-chip {
  align-items: center;
  background: transparent;
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius-pill);
  color: var(--ez-text-muted);
  cursor: pointer;
  display: inline-flex;
  flex: none;
  font: 600 13px/1 var(--ez-font);
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  text-decoration: none;
  transition: all .2s var(--ez-ease);
  white-space: nowrap;
}
.ezu-chip:hover { border-color: var(--ez-brand-ring); color: var(--ez-primary); }
.ezu-chip.is-active { background: var(--ez-brand-grad); border-color: transparent; box-shadow: 0 6px 14px rgba(11, 92, 255, .28); color: #fff; }
.ezu-chip-count { background: var(--ez-surface-hover); border-radius: var(--ez-radius-pill); font-size: 11px; padding: 2px 6px; }
.ezu-chip.is-active .ezu-chip-count { background: rgba(255, 255, 255, .22); }

/* ---------- Tags, alerts, avatars, stats ---------- */
.ezu-tag { background: var(--ez-primary-soft); border-radius: var(--ez-radius-pill); color: var(--ez-primary); display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; }
.ezu-tag.is-success { background: var(--ez-success-soft); color: var(--ez-success); }
.ezu-tag.is-warning { background: var(--ez-warning-soft); color: var(--ez-warning); }
.ezu-tag.is-danger { background: var(--ez-danger-soft); color: var(--ez-danger); }

.ezu-alert { border-radius: var(--ez-radius); font-size: 14px; font-weight: 500; padding: 12px 14px; }
.ezu-alert.is-success { background: var(--ez-success-soft); color: var(--ez-success); }
.ezu-alert.is-warning { background: var(--ez-warning-soft); color: var(--ez-warning); }
.ezu-alert.is-danger { background: var(--ez-danger-soft); color: var(--ez-danger); }
.ezu-alert.is-info { background: var(--ez-primary-soft); color: var(--ez-primary); }

.ezu-avatar {
  align-items: center;
  background: var(--ez-brand-grad);
  border-radius: 50%;
  color: #fff;
  display: inline-grid;
  flex: none;
  font-weight: 700;
  height: 36px;
  overflow: hidden;
  place-items: center;
  width: 36px;
}
.ezu-avatar.is-warm { background: linear-gradient(135deg, #fbbf24, #f97316); }
.ezu-avatar.is-lg { font-size: 22px; height: 64px; width: 64px; }
.ezu-avatar img { height: 100%; object-fit: cover; width: 100%; }

.ezu-stat { background: var(--ez-surface); border: 1px solid var(--ez-border); border-radius: var(--ez-radius-card); box-shadow: var(--ez-shadow-sm); padding: 16px 18px; }
.ezu-stat b { display: block; font-size: 24px; }
.ezu-stat span { color: var(--ez-text-muted); font-size: 13px; }

/* ---------- Table ---------- */
.ezu-table { border-collapse: collapse; font-size: 14px; width: 100%; }
.ezu-table th,
.ezu-table td { border-bottom: 1px solid var(--ez-border); padding: 12px 10px; text-align: left; vertical-align: middle; }
.ezu-table th { color: var(--ez-text-muted); font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.ezu-table tr:last-child td { border-bottom: 0; }

/* ---------- App shell: topbar, rail, bottom nav ---------- */
.ezu-topbar {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  background: var(--ez-surface-glass);
  border-bottom: 1px solid var(--ez-border);
}

.ezu-rail {
  background: linear-gradient(180deg, var(--ez-rail-2), var(--ez-rail));
  border-radius: 0 22px 22px 0;
  box-shadow: var(--ez-shadow-md);
  color: var(--ez-rail-text);
}
.ezu-rail-item {
  align-items: center;
  border-radius: var(--ez-radius);
  color: var(--ez-rail-text);
  display: flex;
  gap: var(--ez-space-3);
  min-height: var(--ez-touch);
  padding: 0 var(--ez-space-3);
  text-decoration: none;
  transition: background .2s, color .2s;
}
.ezu-rail-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.ezu-rail-item.is-active { background: var(--ez-rail-active); color: #fff; }

.ezu-bottom-nav {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  background: var(--ez-surface-glass);
  border-top: 1px solid var(--ez-border);
  bottom: 0;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  left: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  position: fixed;
  right: 0;
  z-index: var(--ez-z-bar);
}
.ezu-bottom-nav-item {
  align-items: center;
  background: none;
  border: 0;
  color: var(--ez-text-muted);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 500;
  gap: 3px;
  height: 56px;
  justify-content: center;
  text-decoration: none;
}
.ezu-bottom-nav-item.is-active { color: var(--ez-primary); font-weight: 700; }

/* ---------- Step bar ---------- */
.ezu-stepbar {
  background: var(--ez-surface);
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius-lg);
  box-shadow: var(--ez-shadow-sm);
  display: grid;
  gap: 4px;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  padding: 4px;
}
.ezu-step {
  align-items: center;
  background: none;
  border: 0;
  border-radius: var(--ez-radius);
  color: var(--ez-text-muted);
  display: flex;
  font: 600 13px/1.2 var(--ez-font);
  gap: 6px;
  justify-content: center;
  min-height: var(--ez-touch);
  min-width: 0;
}
.ezu-step-number { align-items: center; background: var(--ez-surface-subtle); border-radius: 50%; display: inline-flex; flex: 0 0 22px; font-size: 12px; height: 22px; justify-content: center; }
.ezu-step.is-active { background: var(--ez-primary-soft); color: var(--ez-primary); }
.ezu-step.is-active .ezu-step-number { background: var(--ez-brand-grad); color: #fff; }
.ezu-step.is-done .ezu-step-number { background: var(--ez-success); color: #fff; }

/* Step forms (ezone-ui.js): steps only split on phones; larger screens show every step. */
.ezu-stepbar:has(+ [data-ezu-steps]) { display: none; }
@media (max-width: 767.98px) {
  .ezu-stepbar:has(+ [data-ezu-steps]) { display: grid; margin-bottom: var(--ez-space-3); position: sticky; top: var(--ez-space-2); z-index: 20; }
  [data-ezu-steps][data-ezu-active-step="1"] [data-ezu-step]:not([data-ezu-step="1"]),
  [data-ezu-steps][data-ezu-active-step="2"] [data-ezu-step]:not([data-ezu-step="2"]),
  [data-ezu-steps][data-ezu-active-step="3"] [data-ezu-step]:not([data-ezu-step="3"]),
  [data-ezu-steps][data-ezu-active-step="4"] [data-ezu-step]:not([data-ezu-step="4"]),
  [data-ezu-steps][data-ezu-active-step="5"] [data-ezu-step]:not([data-ezu-step="5"]) { display: none !important; }
  .ezu-stepbar:has(> :nth-child(4)) .ezu-step:not(.is-active) .ezu-step-label { display: none; }
}
.ezu-step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal / sheet ---------- */
.ezu-backdrop { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); background: rgba(5, 12, 26, .5); inset: 0; position: fixed; }
.ezu-modal {
  background: var(--ez-surface);
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius-xl);
  box-shadow: var(--ez-shadow-lg);
  color: var(--ez-text);
  padding: 22px;
}
.ezu-sheet {
  background: var(--ez-body-bg);
  border-radius: var(--ez-radius-lg) var(--ez-radius-lg) 0 0;
  box-shadow: 0 -12px 32px rgba(15, 23, 42, .18);
}
.ezu-sheet-grip { background: var(--ez-control-border); border-radius: 3px; display: block; height: 5px; margin: 6px auto; width: 40px; }

/* ---------- Scrollbars (opt-in) ---------- */
.ezu-scroll::-webkit-scrollbar { height: 10px; width: 10px; }
.ezu-scroll::-webkit-scrollbar-thumb { background: var(--ez-control-border); background-clip: padding-box; border: 3px solid transparent; border-radius: 10px; }
.ezu-scroll::-webkit-scrollbar-track { background: transparent; }
