/**
 * Horsing web portals — shared design tokens & components
 * See docs/WEB-PORTALS-DESIGN-SYSTEM.md
 *
 * Light, public-facing style (not coder/ops dark). Each portal is standalone.
 */

:root {
  --hp-bg: #f7f5f0;
  --hp-surface: #ffffff;
  --hp-surface-2: #f3f1ec;
  --hp-border: #e4e0d8;
  --hp-text: #1a1a1a;
  --hp-muted: #5c5a56;
  --hp-primary: #1e1b4b;
  --hp-accent: #4f46e5;
  --hp-accent-hover: #4338ca;
  --hp-premium: #ca8a04;
  --hp-success: #059669;
  --hp-warning: #d97706;
  --hp-error: #dc2626;
  --hp-radius-sm: 10px;
  --hp-radius: 14px;
  --hp-radius-lg: 20px;
  --hp-font: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --hp-display: "Manrope", system-ui, sans-serif;
  --hp-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --hp-focus: 0 0 0 3px rgba(79, 70, 229, 0.28);
  --hp-shadow: 0 12px 40px rgba(26, 26, 26, 0.06);
}

[data-theme="dark"] {
  --hp-bg: #f7f5f0;
  --hp-surface: #ffffff;
  --hp-surface-2: #f3f1ec;
  --hp-border: #e4e0d8;
  --hp-text: #1a1a1a;
  --hp-muted: #5c5a56;
}

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

html {
  font-family: var(--hp-font);
}

body.hp-body {
  margin: 0;
  min-height: 100vh;
  color: var(--hp-text);
  font-family: var(--hp-font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Dimmed freight photo + soft wash so forms stay readable */
  background-color: var(--hp-bg);
  background-image:
    linear-gradient(
      165deg,
      rgba(247, 245, 240, 0.88) 0%,
      rgba(247, 245, 240, 0.78) 45%,
      rgba(247, 245, 240, 0.9) 100%
    ),
    url("/static/bg/freight-highway.jpg");
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

@media (max-width: 720px) {
  body.hp-body {
    background-attachment: scroll;
  }
}

a.hp-link {
  color: var(--hp-accent);
  font-weight: 600;
  text-decoration: none;
}
a.hp-link:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--hp-accent);
  outline-offset: 2px;
  box-shadow: var(--hp-focus);
}

.hp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hp-hidden {
  display: none !important;
}

/* ── Top bar (single portal — no suite nav) ── */
.hp-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hp-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.hp-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--hp-text);
  text-decoration: none;
}

.hp-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--hp-premium);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hp-primary);
  flex-shrink: 0;
  overflow: hidden;
}

.hp-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hp-mark svg {
  width: 18px;
  height: 18px;
}

.hp-portal-name {
  color: var(--hp-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.hp-session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--hp-muted);
}

.hp-session-bar strong {
  color: var(--hp-text);
  font-weight: 700;
}

/* ── Buttons ── */
.hp-btn,
.hp-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}

.hp-btn:disabled,
.hp-btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hp-btn {
  background: var(--hp-accent);
  color: #fff;
}

.hp-btn:hover:not(:disabled) {
  background: var(--hp-accent-hover);
}

.hp-btn-secondary {
  background: var(--hp-surface);
  color: var(--hp-text);
  border-color: var(--hp-border);
}

.hp-btn-secondary:hover:not(:disabled) {
  border-color: var(--hp-accent);
}

.hp-btn-danger {
  background: rgba(220, 38, 38, 0.08);
  color: var(--hp-error);
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: 999px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

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

/* ── Fields ── */
.hp-label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-weight: 650;
  font-size: 0.86rem;
  color: var(--hp-text);
}

.hp-field,
.hp-select,
.hp-textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  min-height: 48px;
  border-radius: var(--hp-radius-sm);
  border: 1px solid var(--hp-border);
  background: var(--hp-surface);
  color: var(--hp-text);
  font-family: inherit;
  font-size: 0.95rem;
}

.hp-textarea {
  min-height: 5rem;
  resize: vertical;
}

.hp-field:focus,
.hp-select:focus,
.hp-textarea:focus {
  outline: none;
  border-color: var(--hp-accent);
  box-shadow: var(--hp-focus);
}

.hp-hint {
  color: var(--hp-muted);
  font-size: 0.86rem;
  margin: 0.4rem 0 0;
}

/* ── Surfaces ── */
.hp-card {
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  padding: 1.5rem;
  box-shadow: var(--hp-shadow);
}

.hp-alert {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--hp-radius-sm);
  font-size: 0.9rem;
  margin: 0.85rem 0;
  border: 1px solid transparent;
}

.hp-alert[data-variant="success"] {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.35);
  color: var(--hp-text);
}
.hp-alert[data-variant="success"]::before {
  content: "✓";
  font-weight: 700;
  color: var(--hp-success);
  flex-shrink: 0;
}

.hp-alert[data-variant="error"] {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--hp-text);
}
.hp-alert[data-variant="error"]::before {
  content: "!";
  font-weight: 800;
  color: var(--hp-error);
  flex-shrink: 0;
}

.hp-alert[data-variant="info"] {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.28);
  color: var(--hp-text);
}
.hp-alert[data-variant="info"]::before {
  content: "i";
  font-weight: 700;
  color: var(--hp-accent);
  flex-shrink: 0;
}

.hp-empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--hp-muted);
  border: 1px dashed var(--hp-border);
  border-radius: var(--hp-radius);
  background: var(--hp-surface);
}

.hp-empty strong {
  display: block;
  color: var(--hp-text);
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.hp-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.35rem 4rem;
}

.hp-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: transparent;
}

.hp-note {
  margin: 0.85rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--hp-radius-sm);
  border: 1px solid rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.1);
  color: var(--hp-text);
  font-size: 0.9rem;
  line-height: 1.45;
}
.hp-note strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hp-warning);
  margin-bottom: 0.35rem;
}
.hp-note p {
  margin: 0;
}

.hp-login-card {
  width: 100%;
  max-width: 420px;
}

.hp-login-card .hp-login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.hp-login-card .hp-login-brand .hp-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.hp-login-card h1 {
  font-family: var(--hp-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}

.hp-login-card .hp-login-sub {
  text-align: center;
  color: var(--hp-muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.hp-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: var(--hp-surface-2);
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.hp-tab {
  flex: 1;
  min-height: 40px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--hp-muted);
  cursor: pointer;
}

.hp-tab[aria-selected="true"] {
  background: var(--hp-surface);
  color: var(--hp-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.hp-mono {
  font-family: var(--hp-mono);
  font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
