/* ==========================================================================
   MBI SSO Portal (POC) - styling
   shadcn/ui design tokens (CSS variables) so this HTML maps directly onto the
   future Vue 3 + shadcn-vue components. Light + dark via [data-theme].
   ========================================================================== */

:root {
  --background: 0 0% 100%;
  --foreground: 222 47% 11%;
  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;
  --popover: 0 0% 100%;
  --primary: 243 75% 59%;
  --primary-foreground: 0 0% 100%;
  --muted: 210 40% 96%;
  --muted-foreground: 215 16% 47%;
  --border: 214 32% 91%;
  --input: 214 32% 91%;
  --ring: 243 75% 59%;
  --radius: 0.75rem;
  --shadow: 0 1px 2px 0 rgb(15 23 42 / 0.04), 0 8px 24px -12px rgb(15 23 42 / 0.18);
  --surface: 210 40% 98%;
}

[data-theme='dark'] {
  --background: 222 47% 7%;
  --foreground: 210 40% 98%;
  --card: 222 47% 10%;
  --card-foreground: 210 40% 98%;
  --popover: 222 47% 10%;
  --primary: 239 84% 67%;
  --primary-foreground: 222 47% 11%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --border: 217 33% 20%;
  --input: 217 33% 20%;
  --ring: 239 84% 67%;
  --shadow: 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 8px 30px -12px rgb(0 0 0 / 0.6);
  --surface: 222 47% 9%;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* ------------------------------- Header -------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  background: hsl(var(--card) / 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid hsl(var(--border));
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand__logo {
  height: 40px;
  width: auto;
  border-radius: 0.4rem;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand__name {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__title {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
  background: hsl(var(--muted));
}

.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.8rem 0.3rem 0.3rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  max-width: 20rem;
}

.user-chip__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: 700;
  flex: none;
}

.user-chip__name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------- Buttons ------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.05rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.button:focus-visible,
.icon-button:focus-visible,
.system-tile:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.button--primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.button--primary:hover {
  opacity: 0.92;
}

.button--ghost {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}

.button--ghost:hover {
  background: hsl(var(--muted));
}

.button__icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

/* -------------------------------- Main --------------------------------- */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem);
}

.hero {
  text-align: center;
  margin-bottom: 2.25rem;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.9rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
}

.hero__shield svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
  color: hsl(var(--primary));
}

.hero__title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ----------------------------- System grid ----------------------------- */
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.system-tile {
  --tile-accent: hsl(var(--primary));
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  overflow: hidden;
}

.system-tile::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tile-accent);
}

.system-tile:hover {
  transform: translateY(-3px);
  border-color: var(--tile-accent);
}

.system-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--tile-accent) 14%, transparent);
  color: var(--tile-accent);
}

.system-tile__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.system-tile__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.system-tile__name {
  font-size: 1.15rem;
  font-weight: 700;
}

.system-tile__desc {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
}

.system-tile__cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tile-accent);
}

/* --------------------------- Register card ----------------------------- */
.register-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 2.25rem;
  padding: 1.35rem 1.5rem;
  background: hsl(var(--surface));
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
}

.register-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  flex: none;
}

.register-card__icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.register-card__body {
  flex: 1;
  min-width: 200px;
}

.register-card__title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
}

.register-card__text {
  margin: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* -------------------------------- States ------------------------------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  min-height: 40vh;
  text-align: center;
}

.state__title {
  margin: 0;
  font-size: 1.25rem;
}

.state__text {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

.state__icon--error {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  background: hsl(0 84% 60% / 0.12);
  color: hsl(0 72% 51%);
}

.state__icon--error svg {
  width: 1.8rem;
  height: 1.8rem;
}

.empty-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.empty-card__text {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

.spinner {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 3px solid hsl(var(--border));
  border-top-color: hsl(var(--primary));
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------- Footer ------------------------------- */
.app-footer {
  padding: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
}

.app-footer p {
  margin: 0;
}

/* ------------------------------ Responsive ----------------------------- */
@media (max-width: 640px) {
  .brand__title {
    display: none;
  }

  .user-chip__name {
    max-width: 7rem;
  }

  .button--ghost .button__icon {
    display: none;
  }
}

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