/*
 * ============================================================
 *  MACOSHAN DESIGN SYSTEM — Auth & Subsystem Styles
 *  Authentication pages, subsystem navigation, Coming Soon screens
 * ============================================================
 */


/* ═══════════════════════════════════════════════
   AUTH PAGES — Split Layout
   ═══════════════════════════════════════════════ */

.auth-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}


/* ─── Brand Panel (left) ─── */

.auth-brand {
  background: linear-gradient(135deg, var(--cp-teal-700) 0%, var(--cp-teal-500) 50%, var(--cp-teal-400) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-16);
  color: var(--cp-white);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.auth-brand::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(245,200,66,0.06) 0%, transparent 50%);
  animation: authGlow 25s linear infinite;
}

.auth-brand__logo {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--cp-white);
  text-decoration: none;
  margin-bottom: var(--space-12);
}

.auth-brand__logo img {
  height: 48px;
  width: auto;
}

.auth-brand__tagline {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  line-height: 1.2;
  margin: 0 0 var(--space-6);
  max-width: 400px;
  color: var(--cp-white);
}

.auth-brand__subtitle {
  position: relative;
  z-index: 1;
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.85);
  max-width: 380px;
  line-height: 1.6;
  margin: 0;
}

/* Back / Home link */
.auth-back {
  position: absolute;
  top: var(--space-6);
  left: var(--space-6);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: color 0.2s, background 0.2s;
}

.auth-back:hover {
  color: var(--cp-white);
  background: rgba(255, 255, 255, 0.1);
}


/* ─── Form Panel (right) ─── */

.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-12) var(--space-8);
  background: var(--cp-white);
}

.auth-form {
  width: 100%;
  max-width: 420px;
}

.auth-form__header {
  margin-bottom: var(--space-8);
}

.auth-form__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--cp-slate-900);
  margin: 0 0 var(--space-2);
}

.auth-form__subtitle {
  color: var(--cp-slate-500);
  font-size: var(--text-base);
  margin: 0;
}


/* ─── Inputs ─── */

.auth-input-group {
  margin-bottom: var(--space-5);
}

.auth-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--cp-slate-700);
  margin-bottom: var(--space-2);
}

.auth-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--cp-slate-200);
  border-radius: 10px;
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--cp-slate-800);
  background: var(--cp-slate-50);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.auth-input:focus {
  outline: none;
  border-color: var(--cp-teal-500);
  box-shadow: 0 0 0 3px rgba(10, 110, 110, 0.1);
  background: var(--cp-white);
}

.auth-input::placeholder {
  color: var(--cp-slate-400);
}

.auth-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}


/* ─── Password Toggle ─── */

.auth-password-group {
  position: relative;
}

.auth-password-toggle {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--cp-slate-400);
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
}

.auth-password-toggle:hover {
  color: var(--cp-slate-600);
}


/* ─── Buttons ─── */

.auth-btn {
  width: 100%;
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-btn--primary {
  background: var(--cp-teal-500);
  color: var(--cp-white);
}

.auth-btn--primary:hover:not(:disabled) {
  background: var(--cp-teal-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10, 110, 110, 0.25);
}

.auth-btn--passkey {
  background: var(--cp-slate-800);
  color: var(--cp-white);
}

.auth-btn--passkey:hover:not(:disabled) {
  background: var(--cp-slate-900);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.auth-btn--magic {
  background: transparent;
  color: var(--cp-teal-600);
  border: 1.5px solid var(--cp-teal-200);
}

.auth-btn--magic:hover:not(:disabled) {
  background: var(--cp-teal-50);
  border-color: var(--cp-teal-500);
}


/* ─── Divider ─── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--cp-slate-400);
  font-size: var(--text-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cp-slate-200);
}


/* ─── Status Messages ─── */

.auth-message {
  padding: var(--space-3) var(--space-4);
  border-radius: 8px;
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
  display: none;
  line-height: 1.5;
}

.auth-message--success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.auth-message--error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}


/* ─── Footer Links ─── */

.auth-links {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--cp-slate-500);
}

.auth-links a {
  color: var(--cp-teal-500);
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}


/* ═══════════════════════════════════════════════
   AUTH CALLBACK PAGE
   ═══════════════════════════════════════════════ */

.auth-callback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: var(--space-8);
}

.auth-callback__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--cp-slate-200);
  border-top-color: var(--cp-teal-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-6);
}

.auth-callback h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--cp-slate-800);
  margin: 0 0 var(--space-4);
}


/* ═══════════════════════════════════════════════
   SUBSYSTEM NAVIGATION
   ═══════════════════════════════════════════════ */

.subsystem-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cp-slate-200);
  padding: var(--space-3) 0;
}

.subsystem-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subsystem-nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--cp-slate-800);
  text-decoration: none;
}

.subsystem-nav__logo img {
  height: 32px;
  width: auto;
}

.subsystem-nav__user {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.subsystem-nav__invite-badge {
  position: relative;
  text-decoration: none;
  font-size: 1.25rem;
  line-height: 1;
}

.invite-badge-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  border: 1.5px solid var(--surface, #fff);
}

.subsystem-nav__greeting {
  font-size: var(--text-sm);
  color: var(--cp-slate-600);
  font-weight: 500;
}

.subsystem-nav__logout-form {
  margin: 0;
}

.subsystem-nav__logout-btn {
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--cp-slate-200);
  border-radius: 8px;
  background: transparent;
  color: var(--cp-slate-600);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}

.subsystem-nav__logout-btn:hover {
  border-color: var(--cp-coral-500);
  color: var(--cp-coral-500);
}


/* ═══════════════════════════════════════════════
   COMING SOON PAGES
   ═══════════════════════════════════════════════ */

.subsystem-body {
  margin: 0;
  padding: 0;
}

.coming-soon {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(80px + var(--space-8)) var(--space-6) var(--space-12);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.coming-soon::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  z-index: 0;
}

.coming-soon__content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  animation: fadeInUp 0.8s ease-out;
}

.coming-soon__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: 100px;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-8);
  animation: fadeInUp 0.8s ease-out 0.1s both;
}

.coming-soon__badge-icon {
  font-size: var(--text-xl);
}

.coming-soon__greeting {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-3);
  opacity: 0.9;
  color: inherit;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.coming-soon__title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  line-height: 1.1;
  margin: 0 0 var(--space-6);
  color: inherit;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.coming-soon__title-accent {
  display: block;
}

.coming-soon__description {
  font-size: var(--text-lg);
  line-height: 1.7;
  opacity: 0.85;
  max-width: 560px;
  margin: 0 auto var(--space-10);
  color: inherit;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.coming-soon__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-12);
  animation: fadeInUp 0.8s ease-out 0.5s both;
}

.coming-soon__dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: dotBounce 1.4s ease-in-out infinite;
}

.coming-soon__dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.coming-soon__dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.coming-soon__features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  max-width: 600px;
  margin: 0 auto var(--space-10);
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

.coming-soon__feature {
  padding: var(--space-5) var(--space-4);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.25s ease;
}

.coming-soon__feature:hover {
  transform: translateY(-3px);
}

.coming-soon__feature-icon {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.coming-soon__feature-label {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  color: inherit;
}

.coming-soon__notify {
  font-size: var(--text-sm);
  opacity: 0.7;
  color: inherit;
  animation: fadeInUp 0.8s ease-out 0.7s both;
  margin: 0;
}


/* ═══ Role Themes ═══ */

/* Teacher — Warm Gold */
.subsystem--teacher .coming-soon::before {
  background: linear-gradient(-45deg, #FEF3CD, #FEF9E7, #FCEFC0, #F8DB72);
}
.subsystem--teacher .coming-soon {
  color: var(--cp-slate-800);
}
.subsystem--teacher .coming-soon__badge {
  background: rgba(228, 181, 48, 0.15);
  color: #92600A;
}
.subsystem--teacher .coming-soon__title-accent {
  color: var(--cp-gold-500);
}
.subsystem--teacher .coming-soon__dots span {
  background: var(--cp-gold-400);
}
.subsystem--teacher .coming-soon__feature {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(228, 181, 48, 0.2);
}

/* Support Worker — Brand Teal */
.subsystem--support-worker .coming-soon::before {
  background: linear-gradient(-45deg, #B3E0E0, #E6F5F5, #80CCCC, #4DB8B8);
}
.subsystem--support-worker .coming-soon {
  color: var(--cp-slate-800);
}
.subsystem--support-worker .coming-soon__badge {
  background: rgba(10, 110, 110, 0.1);
  color: var(--cp-teal-700);
}
.subsystem--support-worker .coming-soon__title-accent {
  color: var(--cp-teal-500);
}
.subsystem--support-worker .coming-soon__dots span {
  background: var(--cp-teal-500);
}
.subsystem--support-worker .coming-soon__feature {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(10, 110, 110, 0.15);
}

/* Coordinator — Warm Coral */
.subsystem--coordinator .coming-soon::before {
  background: linear-gradient(-45deg, #FFD4CF, #FFF0EE, #FFB8B0, #FF9C91);
}
.subsystem--coordinator .coming-soon {
  color: var(--cp-slate-800);
}
.subsystem--coordinator .coming-soon__badge {
  background: rgba(255, 107, 90, 0.12);
  color: var(--cp-coral-800);
}
.subsystem--coordinator .coming-soon__title-accent {
  color: var(--cp-coral-500);
}
.subsystem--coordinator .coming-soon__dots span {
  background: var(--cp-coral-500);
}
.subsystem--coordinator .coming-soon__feature {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 107, 90, 0.15);
}

/* Service Provider — Deep Teal (dark theme) */
.subsystem--service-provider .coming-soon::before {
  background: linear-gradient(-45deg, #085858, #0A6E6E, #064242, #042D2D);
}
.subsystem--service-provider .coming-soon {
  color: var(--cp-white);
}
.subsystem--service-provider .coming-soon__badge {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}
.subsystem--service-provider .coming-soon__title-accent {
  color: var(--cp-gold-400);
}
.subsystem--service-provider .coming-soon__dots span {
  background: var(--cp-gold-400);
}
.subsystem--service-provider .coming-soon__feature {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--cp-white);
}
.subsystem--service-provider .subsystem-nav {
  background: rgba(4, 45, 45, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
.subsystem--service-provider .subsystem-nav__logo,
.subsystem--service-provider .subsystem-nav__greeting {
  color: var(--cp-white);
}
.subsystem--service-provider .subsystem-nav__logout-btn {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}
.subsystem--service-provider .subsystem-nav__logout-btn:hover {
  border-color: var(--cp-coral-400);
  color: var(--cp-coral-400);
}


/* ═══ Passkey Prompt (on Coming Soon pages) ═══ */

.passkey-prompt {
  margin-top: var(--space-8);
  padding: var(--space-6);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.06);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  color: inherit;
  animation: fadeInUp 0.8s ease-out 0.8s both;
}

.subsystem--service-provider .passkey-prompt {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.passkey-prompt__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0 0 var(--space-2);
  color: inherit;
}

.passkey-prompt__text {
  font-size: var(--text-sm);
  opacity: 0.8;
  margin: 0 0 var(--space-4);
  line-height: 1.5;
  color: inherit;
}

.passkey-prompt__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  background: var(--cp-slate-800);
  color: var(--cp-white);
  cursor: pointer;
  transition: all 0.25s ease;
}

.passkey-prompt__btn:hover {
  background: var(--cp-slate-900);
  transform: translateY(-1px);
}


/* ═══ Animations ═══ */

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

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

@keyframes authGlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ═══ Responsive ═══ */

@media (max-width: 768px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: var(--space-8) var(--space-6);
    min-height: auto;
  }

  .auth-brand__tagline {
    font-size: var(--text-2xl);
  }

  .auth-brand__subtitle {
    display: none;
  }

  .auth-form-panel {
    padding: var(--space-8) var(--space-6);
  }

  .coming-soon__title {
    font-size: var(--text-4xl);
  }

  .coming-soon__features {
    grid-template-columns: repeat(2, 1fr);
  }

  .subsystem-nav__greeting {
    display: none;
  }
}

@media (max-width: 480px) {
  .coming-soon {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .coming-soon__features {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .passkey-prompt {
    padding: var(--space-4);
  }
}
