/**
 * Customer Authentication & Portal Styles
 * OSR Capitals - Matches theme variables and animation system
 */

/* Container and layout */
.auth-page {
  padding: 60px 0 100px;
  min-height: calc(100vh - 260px);
  display: flex;
  align-items: center;
  background: var(--tint);
}
.auth-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}
.auth-container--wide {
  max-width: 960px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 42px 38px;
  box-shadow: 0 24px 60px -20px rgba(30, 8, 51, 0.12);
}
@media (max-width: 640px) {
  .auth-page { padding: 36px 0 70px; }
  .auth-card { padding: 30px 22px; }
}

/* Stagger & Motion hooks - seamlessly integrates with existing .reveal observer */
.reveal.m-stagger {
  opacity: 1 !important;
  transform: none !important;
}
.reveal.m-stagger .m-item {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .8s var(--ease), transform .9s var(--ease);
  transition-delay: calc(var(--d, 0) * 70ms);
}
.reveal.m-stagger.is-in .m-item {
  opacity: 1;
  transform: none;
}

/* Headline wipe mask */
.m-rise {
  overflow: hidden;
  padding-bottom: .09em;
  margin-bottom: -.09em;
  display: block;
}
.m-rise > span {
  display: block;
  transform: translateY(115%);
  transition: transform .9s var(--ease);
  transition-delay: calc(var(--d, 0) * 70ms);
}
.reveal.m-stagger.is-in .m-rise > span {
  transform: translateY(0);
}

/* Fix CSS traps */
.display > span {
  color: inherit;
}
.btn > span {
  font-size: inherit;
}

/* Typography & Titles */
.auth-title {
  font-family: var(--display);
  font-stretch: 85%;
  font-weight: 800;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  line-height: 1.1;
  color: var(--plum);
  margin: 0 0 8px;
}
.auth-sub {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 28px;
}

/* Form Fields */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 20px;
  position: relative;
  text-align: left;
}
.auth-field > span {
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  transition: color .25s var(--ease);
}
.auth-field:focus-within > span {
  color: var(--magenta);
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: 500 1rem/1.4 var(--body);
  color: var(--ink);
  background: #fff;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.auth-input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(82, 14, 119, 0.12);
}
.auth-input--pw {
  padding-right: 48px;
}
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color .2s;
}
.pw-toggle:hover {
  color: var(--violet);
}
.pw-toggle .ico {
  width: 20px;
  height: 20px;
}

/* Password Strength Meter */
.pw-meter {
  height: 5px;
  border-radius: 5px;
  background: var(--line);
  margin-top: 8px;
  overflow: hidden;
  position: relative;
}
.pw-meter__bar {
  height: 100%;
  width: 0;
  transition: width .35s var(--ease), background-color .35s var(--ease);
}
.pw-meter__text {
  font-size: .8rem;
  font-weight: 600;
  margin-top: 5px;
  display: block;
}
.pw-score-1 .pw-meter__bar { width: 25%; background: #e53935; }
.pw-score-1 + .pw-meter__text { color: #e53935; }
.pw-score-2 .pw-meter__bar { width: 50%; background: #fb8c00; }
.pw-score-2 + .pw-meter__text { color: #fb8c00; }
.pw-score-3 .pw-meter__bar { width: 75%; background: #fdd835; }
.pw-score-3 + .pw-meter__text { color: #f57f17; }
.pw-score-4 .pw-meter__bar { width: 100%; background: #43a047; }
.pw-score-4 + .pw-meter__text { color: #43a047; }

/* Error shake & Alerts */
.alert--shake {
  animation: auth-drop-shake .5s var(--ease) forwards;
}
@keyframes auth-drop-shake {
  0% { opacity: 0; transform: translateY(-12px); }
  25% { opacity: 1; transform: translateY(0) translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  100% { transform: none; }
}

/* Button Loading Spinner */
.btn.is-busy {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Footer / Links under card */
.auth-foot {
  margin-top: 24px;
  text-align: center;
  font-size: .95rem;
  color: var(--muted);
}
.auth-foot a {
  font-weight: 600;
  text-decoration: underline;
}

/* Portal Account Dashboard */
.acc-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) {
  .acc-grid { grid-template-columns: 1fr; }
}
.acc-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 30px;
  box-shadow: 0 16px 40px -15px rgba(30, 8, 51, 0.08);
  margin-bottom: 24px;
}
.acc-card__title {
  font-family: var(--display);
  font-stretch: 88%;
  font-weight: 800;
  font-size: 1.3rem;
  margin: 0 0 18px;
  color: var(--plum);
  display: flex;
  align-items: center;
  gap: 10px;
}
.acc-card__title .ico {
  color: var(--magenta);
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.user-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
}

/* Navigation user badge */
.nav__user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.nav__user .ico {
  width: 17px;
  height: 17px;
  color: var(--magenta);
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  .reveal.m-stagger,
  .reveal.m-stagger .m-item,
  .m-rise > span {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .alert--shake {
    animation: none !important;
  }
  .btn.is-busy::after {
    animation: none !important;
  }
}
