/* RacqTrack component styles. Every color here comes from theme.css. */

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

/* --- Navigation ----------------------------------------------------- */

.rt-nav {
  display: flex;
  align-items: center;
  gap: var(--rt-space-5);
  padding: var(--rt-space-3) var(--rt-space-5);
  background: var(--rt-surface-1);
  border-bottom: 1px solid var(--rt-border);
}

.rt-brand {
  display: flex;
  align-items: center;
  gap: var(--rt-space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.rt-wordmark {
  font-size: var(--rt-text-lg);
  font-weight: 500;
  letter-spacing: -0.3px;
  color: var(--rt-text-primary);
}
.rt-wordmark-accent { color: var(--rt-accent-text); }

.rt-nav-links { display: flex; gap: var(--rt-space-2); }

.rt-nav-links a {
  padding: 6px 12px;
  border-radius: var(--rt-radius);
  color: var(--rt-text-secondary);
  text-decoration: none;
  font-size: var(--rt-text-sm);
}
.rt-nav-links a:hover { background: var(--rt-surface-2); color: var(--rt-text-primary); }
.rt-nav-links a.is-active { background: var(--rt-primary-bg); color: var(--rt-primary-text); }

.rt-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--rt-space-3);
}
.rt-nav-user { font-size: var(--rt-text-sm); color: var(--rt-text-secondary); }

/* --- Layout --------------------------------------------------------- */

.rt-main { max-width: 1100px; margin: 0 auto; padding: var(--rt-space-5); }
.rt-main--bare {
  max-width: 420px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.rt-page-head {
  display: flex;
  align-items: center;
  gap: var(--rt-space-3);
  margin-bottom: var(--rt-space-5);
  flex-wrap: wrap;
}
.rt-page-head h1 { margin: 0; font-size: var(--rt-text-xl); font-weight: 500; }
.rt-page-head .rt-spacer { margin-left: auto; }

.rt-sub { color: var(--rt-text-secondary); font-size: var(--rt-text-sm); margin: 0; }

.rt-card {
  background: var(--rt-surface-1);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-lg);
  padding: var(--rt-space-5);
}

.rt-grid { display: grid; gap: var(--rt-space-4); }
.rt-grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.rt-grid--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* --- Buttons -------------------------------------------------------- */

.rt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rt-space-2);
  height: var(--rt-h-control);
  padding: 0 var(--rt-space-4);
  border-radius: var(--rt-radius);
  border: 1px solid var(--rt-border-strong);
  background: transparent;
  color: var(--rt-text-primary);
  font-size: var(--rt-text-sm);
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.rt-btn:hover { background: var(--rt-surface-2); border-color: var(--rt-text-muted); }
.rt-btn:active { transform: scale(0.99); }

.rt-btn--primary {
  background: var(--rt-primary);
  border-color: var(--rt-primary);
  color: var(--rt-on-primary);
}
.rt-btn--primary:hover { background: var(--rt-primary-hover); border-color: var(--rt-primary-hover); }

.rt-btn--ghost { border-color: transparent; color: var(--rt-text-secondary); }
.rt-btn--ghost:hover { background: var(--rt-surface-2); color: var(--rt-text-primary); }

.rt-btn--danger { border-color: var(--rt-danger); color: var(--rt-danger-text); }
.rt-btn--danger:hover { background: var(--rt-danger-bg); }

.rt-btn--block { width: 100%; }

/* --- Forms ---------------------------------------------------------- */

.rt-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--rt-space-4); }
.rt-field label { font-size: var(--rt-text-sm); color: var(--rt-text-secondary); }
.rt-field .rt-hint { font-size: var(--rt-text-xs); color: var(--rt-text-muted); }

.rt-input, .rt-select, .rt-textarea {
  width: 100%;
  min-height: var(--rt-h-control);
  padding: 7px var(--rt-space-3);
  border-radius: var(--rt-radius);
  border: 1px solid var(--rt-border);
  background: var(--rt-surface-2);
  color: var(--rt-text-primary);
  font-family: inherit;
  font-size: var(--rt-text-base);
}
.rt-textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.rt-input:hover, .rt-select:hover, .rt-textarea:hover { border-color: var(--rt-border-strong); }
.rt-input::placeholder, .rt-textarea::placeholder { color: var(--rt-text-disabled); }

.rt-field--error .rt-input,
.rt-field--error .rt-select,
.rt-field--error .rt-textarea { border-color: var(--rt-danger); }
.rt-error { font-size: var(--rt-text-xs); color: var(--rt-danger-text); }

.rt-checkbox { display: flex; align-items: center; gap: var(--rt-space-2); }
.rt-checkbox input { width: 16px; height: 16px; accent-color: var(--rt-primary); }
.rt-checkbox label { color: var(--rt-text-primary); font-size: var(--rt-text-base); }

.rt-fieldset { border: 0; padding: 0; margin: 0 0 var(--rt-space-6); }
.rt-fieldset legend {
  padding: 0 0 var(--rt-space-3);
  font-size: var(--rt-text-sm);
  font-weight: 500;
  color: var(--rt-accent-text);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.rt-form-actions {
  display: flex;
  gap: var(--rt-space-3);
  align-items: center;
  padding-top: var(--rt-space-4);
  border-top: 1px solid var(--rt-border);
}

/* --- Banners -------------------------------------------------------- */

.rt-banner {
  display: flex;
  align-items: center;
  gap: var(--rt-space-3);
  flex-wrap: wrap;
  padding: var(--rt-space-3) var(--rt-space-4);
  border-radius: var(--rt-radius);
  margin-bottom: var(--rt-space-4);
  font-size: var(--rt-text-sm);
}
.rt-banner--success { background: var(--rt-success-bg); color: var(--rt-success-text); }
.rt-banner--info    { background: var(--rt-info-bg);    color: var(--rt-info-text); }
.rt-banner--warning { background: var(--rt-warning-bg); color: var(--rt-warning-text); }
.rt-banner--danger  { background: var(--rt-danger-bg);  color: var(--rt-danger-text); }
.rt-banner a { color: inherit; margin-left: auto; }

/* --- Tables --------------------------------------------------------- */

.rt-table-wrap {
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-lg);
  overflow: hidden;
  background: var(--rt-surface-1);
}
.rt-table { width: 100%; border-collapse: collapse; font-size: var(--rt-text-sm); }
.rt-table th {
  text-align: left;
  padding: var(--rt-space-3) var(--rt-space-4);
  background: var(--rt-surface-2);
  color: var(--rt-text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--rt-border);
}
.rt-table td {
  padding: var(--rt-space-3) var(--rt-space-4);
  border-bottom: 1px solid var(--rt-border);
  color: var(--rt-text-primary);
}
.rt-table tbody tr:last-child td { border-bottom: 0; }
.rt-table tbody tr:hover td { background: var(--rt-surface-2); }
.rt-table a { color: var(--rt-primary-text); text-decoration: none; }
.rt-table a:hover { text-decoration: underline; }
.rt-table .rt-muted { color: var(--rt-text-muted); }

.rt-toolbar {
  display: flex;
  gap: var(--rt-space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--rt-space-4);
}
.rt-toolbar .rt-input { width: auto; flex: 1 1 260px; }

.rt-empty { padding: var(--rt-space-6); text-align: center; color: var(--rt-text-secondary); }

/* Inline +/- stock stepper in the inventory table */
.rt-stock { display: flex; align-items: center; gap: var(--rt-space-2); }
.rt-stock form { display: inline-flex; }
.rt-step {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rt-radius-sm);
  border: 1px solid var(--rt-border-strong);
  background: transparent;
  color: var(--rt-text-primary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.rt-step:hover { background: var(--rt-surface-2); border-color: var(--rt-primary); }

/* Per-row action clusters in the users table */
.rt-row-actions { display: flex; align-items: center; gap: var(--rt-space-2); flex-wrap: wrap; }
.rt-row-actions form { display: inline-flex; }
.rt-inline-form { display: inline-flex; gap: 6px; align-items: center; }
.rt-inline-form .rt-input { width: 150px; height: 30px; font-size: var(--rt-text-sm); }

/* Inline add-a-brand panel on the string form */
.rt-add-brand {
  display: flex;
  gap: var(--rt-space-2);
  align-items: center;
  margin-top: var(--rt-space-2);
  padding: var(--rt-space-3);
  border-radius: var(--rt-radius);
  background: var(--rt-surface-0);
  border: 1px solid var(--rt-border-accent, var(--rt-border-strong));
}
.rt-add-brand .rt-input { flex: 1; }
.rt-add-brand[hidden] { display: none; }

/* Sticker preview — white stage so the label reads as paper, not UI */
.rt-label-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--rt-space-5);
  background: #fff;
  border-radius: var(--rt-radius);
  border: 1px solid var(--rt-border);
}
.rt-label-stage img { image-rendering: pixelated; display: block; }

.rt-steps { margin: 0; padding-left: 1.2rem; color: var(--rt-text-secondary); font-size: var(--rt-text-sm); }
.rt-steps li { margin-bottom: var(--rt-space-2); line-height: 1.6; }

/* $ prefix on money inputs */
.rt-input-prefix { display: flex; align-items: center; gap: 6px; }
.rt-input-prefix > span { color: var(--rt-text-muted); font-size: var(--rt-text-sm); }

.rt-pager {
  display: flex;
  align-items: center;
  gap: var(--rt-space-3);
  margin-top: var(--rt-space-4);
  font-size: var(--rt-text-sm);
  color: var(--rt-text-secondary);
}

/* --- Detail view ---------------------------------------------------- */

.rt-metric {
  background: var(--rt-surface-1);
  border-radius: var(--rt-radius);
  padding: var(--rt-space-4);
}
.rt-metric .rt-metric-label {
  font-size: var(--rt-text-xs);
  color: var(--rt-text-secondary);
  margin: 0 0 4px;
}
.rt-metric .rt-metric-value { font-size: 26px; font-weight: 500; margin: 0; }

.rt-dl { display: grid; grid-template-columns: 150px 1fr; gap: var(--rt-space-3) var(--rt-space-4); margin: 0; }
.rt-dl dt { color: var(--rt-text-secondary); font-size: var(--rt-text-sm); }
.rt-dl dd { margin: 0; color: var(--rt-text-primary); }
.rt-dl dd.rt-unset { color: var(--rt-text-muted); }

/* --- Login ---------------------------------------------------------- */

.rt-login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rt-space-2);
  margin-bottom: var(--rt-space-5);
}
.rt-login-brand .rt-wordmark { font-size: 26px; }

@media (max-width: 720px) {
  .rt-nav { flex-wrap: wrap; gap: var(--rt-space-3); }
  .rt-nav-right { width: 100%; margin-left: 0; }
  .rt-dl { grid-template-columns: 1fr; gap: 4px var(--rt-space-4); }
  .rt-dl dd { margin-bottom: var(--rt-space-3); }
}
