/* components.css — shared UI components. agent3 foundation. */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  padding: 10px 18px; border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text); transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
  min-height: 44px; /* touch target */
}
.btn:hover { background: var(--brand-50); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--accent-500); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .85rem; }
.btn-lg { padding: 14px 26px; min-height: 52px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.field label { font-weight: 600; font-size: .9rem; color: var(--text-2); }
.input, .select, .textarea {
  font: inherit; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  width: 100%; min-height: 44px;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-500); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1); padding: var(--sp-4);
}
.card-pad-lg { padding: var(--sp-5); }

/* Badges & status pills */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-pill); background: var(--brand-100); color: var(--brand-700);
}
.count-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700;
  padding: 4px 12px; border-radius: var(--radius-pill); color: #fff;
}
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.85); }
.status-submitted       { background: var(--st-submitted); }
.status-accepted        { background: var(--st-accepted); }
.status-rejected        { background: var(--st-rejected); }
.status-in_progress     { background: var(--st-in_progress); }
.status-no_real_problem { background: var(--st-no_real_problem); }
.status-resolved        { background: var(--st-resolved); }

/* Circular queue counter (Screen B centrepiece) */
.queue-ring {
  --size: 180px; width: var(--size); height: var(--size); border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto; position: relative;
  background:
    radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%),
    conic-gradient(var(--brand-500) var(--pct, 40%), var(--border) 0);
  box-shadow: var(--shadow-2);
}
.queue-ring .num { font-size: 3rem; font-weight: 800; color: var(--brand-700); line-height: 1; }
.queue-ring .lbl { font-size: .8rem; color: var(--text-2); }

/* Stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-4); text-align: center; box-shadow: var(--shadow-1);
}
.stat .n { font-size: 2rem; font-weight: 800; }
.stat .l { color: var(--text-2); font-size: .85rem; }
.stat.accent .n { color: var(--brand-600); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-2); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.table tr:hover td { background: var(--surface-2); }

/* Toasts */
.toast-root {
  position: fixed; inset-block-start: 16px; inset-inline-end: 16px;
  display: flex; flex-direction: column; gap: 10px; z-index: var(--z-toast); max-width: min(92vw, 380px);
}
.toast {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-inline-start: 5px solid var(--info); border-radius: var(--radius-sm);
  padding: 12px 16px; box-shadow: var(--shadow-3); opacity: 0; transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease; font-weight: 600;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-inline-start-color: var(--success); }
.toast-error   { border-inline-start-color: var(--danger); }
.toast-info    { border-inline-start-color: var(--info); }

/* Persistent status banner (Screen B) */
.banner {
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); color: #fff;
  display: flex; align-items: center; gap: var(--sp-3); box-shadow: var(--shadow-2);
  animation: banner-pulse 2.4s ease-in-out infinite;
}
@keyframes banner-pulse { 0%,100% { box-shadow: var(--shadow-1); } 50% { box-shadow: var(--shadow-2); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2,6,23,.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: var(--z-modal); padding: var(--sp-4);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: var(--sp-5);
}

/* Language toggle & top bars */
.lang-toggle {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-pill);
  padding: 6px 14px; cursor: pointer; font-weight: 700; color: var(--text-2); min-height: 40px;
}

/* Empty state */
.empty { text-align: center; color: var(--text-3); padding: var(--sp-6) var(--sp-4); }

/* --- touch devices: 44px wins over compact ------------------------------
   `.btn-sm` is 36px, which is right for a mouse and wrong for a finger. It is
   the most common control in Screen A — measured 8 to 15 of them per section —
   so on a tablet the whole panel was below the 44px target the spec asks for.
   Keyed on `pointer: coarse` rather than on width, because the thing that
   decides is the input device: a 1280px touchscreen needs the big targets and a
   900px window with a mouse does not. */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; padding: 9px 14px; }
  .lang-toggle { min-height: 44px; }
  .perm-row { padding: 11px 10px; }
  .table th, .table td { padding: 13px 12px; }
  /* The <label> is what a finger actually hits, not the box inside it. */
  .check-row { min-height: 44px; }
}

/* A default checkbox renders at 13x13 — a third of the target the spec asks
   for, and hard to see on a ward tablet at arm's length. `.check-row` marks the
   label that wraps one, so tapping the text toggles it too. */
input[type="checkbox"], input[type="radio"] {
  inline-size: 20px; block-size: 20px; accent-color: var(--brand-600); margin: 0;
}
.check-row { cursor: pointer; }
.check-row input:disabled { cursor: not-allowed; }
