/* ══════════════════════════════════════════════════════════════════════════════
   Trio Primêr Authorisation — Premium Glassmorphism Theme
   School Palette: Navy (#0f172a), Gold (#d97706), White & Red
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
html[data-trio-module="authorisation"] {
  /* Brand */
  --ui-primary: #0f172a;
  --ui-primary-deep: #1e293b;
  --trio-navy: #0f172a;
  --trio-navy-light: #1e293b;
  --trio-gold: #d97706;
  --trio-gold-hover: #b45309;
  --trio-gold-light: #fef3c7;
  --trio-red: #dc2626;
  --trio-red-light: #fef2f2;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.055);
  --glass-bg-hover: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(255, 255, 255, 0.22);
  --glass-blur: 28px;
  --glass-saturation: 160%;

  /* Input Glass */
  --input-bg: rgba(255, 255, 255, 0.065);
  --input-border: rgba(255, 255, 255, 0.14);
  --input-border-hover: rgba(255, 255, 255, 0.26);
  --input-focus-glow: rgba(217, 119, 6, 0.32);

  /* Text on dark */
  --text-primary: rgba(255, 255, 255, 0.94);
  --text-secondary: rgba(255, 255, 255, 0.62);
  --text-muted: rgba(255, 255, 255, 0.42);
}

/* ── Animated Background ───────────────────────────────────────────────────── */
html[data-trio-module="authorisation"] :is(body, .auth-page) {
  min-height: 100vh;
  background: linear-gradient(135deg, #070b14 0%, #0f172a 35%, #150e2e 65%, #0d1117 100%);
  overflow-x: hidden;
}

/* Floating luminous orbs via the .auth-orb elements added in the HTML */
.auth-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.auth-orb--gold {
  width: 420px;
  height: 420px;
  top: -8%;
  left: -6%;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.5), transparent 70%);
  animation: orbDrift1 18s ease-in-out infinite alternate;
}

.auth-orb--blue {
  width: 350px;
  height: 350px;
  bottom: -10%;
  right: -8%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.4), transparent 70%);
  animation: orbDrift2 22s ease-in-out infinite alternate;
}

.auth-orb--teal {
  width: 280px;
  height: 280px;
  top: 55%;
  left: 60%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.3), transparent 70%);
  animation: orbDrift3 25s ease-in-out infinite alternate;
}

@keyframes orbDrift1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(80px, 60px) scale(1.15); }
}

@keyframes orbDrift2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-70px, -50px) scale(1.1); }
}

@keyframes orbDrift3 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, 30px) scale(1.2); }
}

/* ── Page Layout ───────────────────────────────────────────────────────────── */
.auth-page {
  display: grid;
  place-items: center;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

/* ── Glassmorphism Card ────────────────────────────────────────────────────── */
.auth-card,
.login-card,
.otp-card,
html[data-trio-module="authorisation"] body > .shell {
  position: relative;
  width: 100%;
  max-width: 31rem;
  padding: 2.2rem 2rem;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 0 80px rgba(217, 119, 6, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  z-index: 1;
}

/* Top gold accent line via pseudo-element */
.auth-card::before,
.login-card::before,
.otp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, transparent, var(--trio-gold), transparent);
  opacity: 0.7;
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card--wide {
  max-width: 64rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.auth-head,
.login-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.auth-head > div:last-child,
.login-header > div:last-child {
  min-width: 0;
}

.auth-head h1,
.auth-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.auth-head p,
.auth-subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
}

/* Security shield icon next to title */
.auth-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(217, 119, 6, 0.18), rgba(217, 119, 6, 0.06));
  border: 1px solid rgba(217, 119, 6, 0.25);
  color: var(--trio-gold);
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.12);
}

/* ── Auth Body Text ────────────────────────────────────────────────────────── */
.auth-body > p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ── Form Layout ───────────────────────────────────────────────────────────── */
.auth-form {
  display: grid;
  gap: 0.9rem;
}

.auth-field {
  display: grid;
  gap: 0.4rem;
}

.auth-field label {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 750;
}

/* ── Glass Inputs & Selects ────────────────────────────────────────────────── */
.auth-field input[type="text"],
.auth-field input[type="password"],
.auth-field input[type="email"],
.auth-field input[type="tel"],
.auth-field input[type="number"],
.auth-field select,
.auth-select {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 1rem;
  border: 1.5px solid var(--input-border);
  border-radius: 14px;
  outline: none;
  color: var(--text-primary);
  background: var(--input-bg);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Custom dropdown chevron — white for dark backgrounds */
.auth-field select,
.auth-select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.7)' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.1rem;
  cursor: pointer;
}

/* Hover */
.auth-field input:hover,
.auth-field select:hover,
.auth-select:hover {
  border-color: var(--input-border-hover);
  background-color: var(--glass-bg-hover);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Focus — Gold glow ring */
.auth-field input:focus,
.auth-field select:focus,
.auth-select:focus {
  border-color: var(--trio-gold);
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 3px var(--input-focus-glow),
    0 0 20px rgba(217, 119, 6, 0.1),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Placeholder */
.auth-field input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Chrome/Safari Autofill Override */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus,
.auth-field input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.95) inset !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.9) !important;
  transition: background-color 5000s ease-in-out 0s;
  border-radius: 14px !important;
  border: 1.5px solid var(--trio-gold) !important;
  caret-color: var(--trio-gold);
}

/* ── OTP Digit Inputs ──────────────────────────────────────────────────────── */
.otp-digit-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
}

.otp-digit {
  min-width: 0;
  min-height: 52px;
  padding-inline: 0.2rem;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 850;
  border: 1.5px solid var(--input-border);
  border-radius: 14px;
  outline: none;
  color: var(--text-primary);
  background: var(--input-bg);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.25s ease;
}

.otp-digit:focus {
  border-color: var(--trio-gold);
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 3px var(--input-focus-glow),
    0 0 20px rgba(217, 119, 6, 0.1);
  transform: translateY(-2px);
}

/* ── Primary Auth Button ───────────────────────────────────────────────────── */
.auth-button {
  position: relative;
  width: 100%;
  min-height: 48px;
  margin-top: 0.6rem;
  padding: 0.75rem 1.25rem;
  border: 1.5px solid rgba(217, 119, 6, 0.4);
  border-radius: 14px;
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--trio-navy) 0%, #1a2744 50%, var(--trio-navy-light) 100%);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(217, 119, 6, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}

/* Gold shimmer sweep on hover */
.auth-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(217, 119, 6, 0.25),
    rgba(217, 119, 6, 0.12),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1;
}

.auth-button:hover {
  border-color: var(--trio-gold);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.35),
    0 0 40px rgba(217, 119, 6, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.auth-button:hover::after {
  left: 150%;
}

.auth-button:active {
  transform: translateY(1px);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── Forgot Password Link ──────────────────────────────────────────────────── */
.auth-forgot-link {
  color: var(--trio-gold);
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.auth-forgot-link:hover {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(217, 119, 6, 0.35);
}

/* ── Auth Links ────────────────────────────────────────────────────────────── */
.auth-links,
.auth-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ── Banners (Error / Success / Notice) ────────────────────────────────────── */
.auth-security-note,
.auth-banner {
  margin-top: 0.9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: 14px;
  color: var(--text-primary);
  background: rgba(217, 119, 6, 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.auth-banner--error {
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.12);
}

.auth-banner--success {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
}

/* ── Welcome / Access-Denied Shell ─────────────────────────────────────────── */
html[data-trio-module="authorisation"] body > .shell {
  margin: 2rem auto;
  text-align: center;
}

html[data-trio-module="authorisation"] body > .shell > .icon {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 0.9rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #fb7185, #e11d48 52%, #be123c);
  box-shadow: 0 5px 0 #9f1239, 0 10px 20px rgba(225, 29, 72, 0.27);
  font-size: 1.35rem;
}

/* ── Actions Bar ───────────────────────────────────────────────────────────── */
.auth-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Funky 3D "Terug na Tuisblad" Button — Glass-Accented ─────────────────── */
.auth-home-action {
  margin-top: 1.6rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
}

.btn-3d-funky-home {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 24rem;
  padding: 0.95rem 1.4rem;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.85) 0%, rgba(180, 83, 9, 0.9) 100%);
  color: #ffffff !important;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow:
    0 6px 0 rgba(120, 53, 15, 0.8),
    0 12px 28px rgba(217, 119, 6, 0.22),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transform: translateY(0);
  transition:
    transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.12s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.15s ease;
  overflow: hidden;
}

/* Glossy Light Flare */
.btn-3d-funky-home::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.04));
  border-radius: 16px 16px 100px 100px / 16px 16px 24px 24px;
  pointer-events: none;
}

/* Shimmer sweep */
.btn-3d-funky-home::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-24deg);
  transition: left 0.75s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.btn-3d-funky-home:hover {
  filter: brightness(1.08) saturate(115%);
  transform: translateY(-2px);
  box-shadow:
    0 8px 0 rgba(120, 53, 15, 0.8),
    0 16px 32px rgba(217, 119, 6, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.btn-3d-funky-home:hover::after {
  left: 150%;
}

.btn-3d-funky-home:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 rgba(120, 53, 15, 0.8),
    0 4px 10px rgba(217, 119, 6, 0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.2);
  filter: brightness(0.96);
}

.btn-3d-funky-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.22);
  font-size: 1.05rem;
  color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-3d-funky-home:hover .btn-3d-funky-icon {
  transform: scale(1.18) rotate(-7deg);
}

.btn-3d-funky-label {
  flex: 1;
  text-align: center;
  letter-spacing: 0.01em;
}

.btn-3d-funky-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.85rem;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-3d-funky-home:hover .btn-3d-funky-badge {
  transform: translateX(4px) scale(1.15);
}

.btn-3d-funky-home:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.5);
  outline-offset: 3px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .auth-page {
    padding: 0.45rem;
  }

  .auth-card,
  .login-card,
  .otp-card,
  html[data-trio-module="authorisation"] body > .shell {
    padding: 1.2rem 1rem;
    border-radius: 20px;
  }

  .auth-head {
    align-items: center;
  }

  .auth-head-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    border-radius: 12px;
  }

  .otp-digit-grid {
    gap: 0.25rem;
  }

  /* Reduce orb sizes on mobile for performance */
  .auth-orb--gold  { width: 250px; height: 250px; }
  .auth-orb--blue  { width: 200px; height: 200px; }
  .auth-orb--teal  { width: 160px; height: 160px; opacity: 0.3; }
}

/* ── Reduced Motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .login-card,
  .otp-card {
    animation: none;
  }
  .auth-orb { animation: none !important; }
  .auth-button::after { transition: none; }
  .btn-3d-funky-home::after { transition: none; }
}
