/* ============================================================
   Farhad YT Pay — Auth pages skin (auth.css)
   Mobile-first: base = phone → override for tablet → desktop split
   ============================================================ */

/* ============================================================
   BASE (mobile-first, < 576px)
   Brand panel hidden, card-panel is the main wrapper
   ============================================================ */

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

body.auth-body {
  min-height: 100vh;
  margin: 0;
  padding: 1.25rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--fyp-body-bg, #F4F6FB);
  font-family: var(--fyp-font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 2rem;
}

/* --- Shell (flex column on mobile) --- */
.auth-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

/* --- Brand panel: HIDDEN on mobile/tablet --- */
.auth-brand-panel {
  display: none;
}

/* --- Card panel: IS the main container on mobile --- */
.auth-card-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Brand logo (above card on mobile) --- */
.auth-brand {
  display: inline-flex;
  margin-bottom: 1.5rem;
}
.auth-brand img {
  max-height: 40px;
  width: auto;
  height: auto;
}

/* --- Card --- */
.auth-card {
  width: 100%;
  background: var(--fyp-surface);
  border: 1px solid var(--fyp-border);
  border-radius: var(--fyp-radius-lg);
  box-shadow: var(--fyp-shadow-md);
  padding: 1.75rem 1.25rem;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--fyp-heading);
  margin-bottom: .4rem;
  line-height: 1.25;
}

.auth-sub {
  color: var(--fyp-muted);
  font-size: .87rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* --- Forms --- */
.auth-card .form-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--fyp-heading);
  margin-bottom: .4rem;
}

.auth-card .form-control {
  border-radius: 12px;
  border: 1.5px solid var(--fyp-border-strong);
  padding: .7rem .9rem;
  font-size: .93rem;
  color: var(--fyp-text);
  background-color: var(--fyp-surface, #fff);
  transition: border-color var(--fyp-dur-fast), box-shadow var(--fyp-dur-fast);
  width: 100%;
}

.auth-card .form-control:focus {
  border-color: var(--fyp-primary);
  box-shadow: 0 0 0 3px var(--fyp-primary-ring, rgba(11,166,120,.22));
  outline: none;
}

.auth-card .form-control::placeholder { color: var(--fyp-placeholder, #94A3B8); }

.auth-card .form-control.is-invalid {
  border-color: var(--fyp-danger, #EF4444);
}
.auth-card .form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--fyp-danger-soft);
}

.auth-card .invalid-feedback {
  font-size: .78rem;
  color: var(--fyp-danger, #EF4444);
  margin-top: .35rem;
  display: none;
}
.auth-card .was-validated .form-control:invalid ~ .invalid-feedback,
.auth-card .form-control.is-invalid ~ .invalid-feedback {
  display: block;
}

.auth-card .form-check-input {
  width: 1.05em;
  height: 1.05em;
  margin-top: .2em;
  border: 1.5px solid var(--fyp-border-strong);
  border-radius: 4px;
  cursor: pointer;
}
.auth-card .form-check-input:checked {
  background-color: var(--fyp-primary);
  border-color: var(--fyp-primary);
}
.auth-card .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--fyp-primary-ring, rgba(11,166,120,.22));
  outline: none;
}

.auth-card .form-check-label {
  font-size: .85rem;
  color: var(--fyp-text);
  cursor: pointer;
  user-select: none;
}

.auth-link-sm {
  font-size: .8rem;
  font-weight: 600;
  color: var(--fyp-primary);
  text-decoration: none;
}
.auth-link-sm:hover { color: var(--fyp-primary-hover, var(--fyp-primary-800)); }

/* Password toggle */
.auth-pass-wrap { position: relative; }
.auth-pass-wrap .form-control { padding-right: 2.8rem; }
.auth-pass-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--fyp-muted, #64748B);
  border-radius: 8px;
  transition: color var(--fyp-dur-fast), background var(--fyp-dur-fast);
  padding: 0;
  font-size: .95rem;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}
.auth-pass-toggle:hover {
  color: var(--fyp-heading);
  background: var(--fyp-surface-3, #EEF2F7);
}
.auth-pass-toggle:focus-visible {
  outline: 2px solid var(--fyp-primary);
  outline-offset: 1px;
}
.auth-pass-toggle .icon-eye-slash { display: none; }
.auth-pass-toggle.is-visible .icon-eye { display: none; }
.auth-pass-toggle.is-visible .icon-eye-slash { display: inline; }

/* OTP */
.otp-input {
  letter-spacing: .55em !important;
  text-indent: .55em;
  text-align: center;
  font-size: 1.2rem !important;
  font-weight: 700;
}

/* Alert */
.auth-alert {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  border-radius: var(--fyp-radius-md);
  font-size: .84rem;
  line-height: 1.5;
  padding: .8rem .9rem;
  margin-bottom: 1rem;
}
.auth-alert i { margin-top: 2px; flex-shrink: 0; }

/* Icon badge */
.auth-icon-badge {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--fyp-gradient-soft);
  color: var(--fyp-primary);
  font-size: 1.35rem;
}

/* --- Buttons --- */
.btn-fyp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--fyp-gradient);
  color: #fff;
  font-weight: 700;
  font-size: .93rem;
  padding: .8rem 1.4rem;
  border: 0;
  border-radius: var(--fyp-radius-pill);
  box-shadow: 0 6px 16px -4px rgba(11, 166, 120, .4);
  transition: transform var(--fyp-dur-fast) var(--fyp-ease), box-shadow var(--fyp-dur-fast);
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  line-height: 1.4;
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
}
.btn-fyp:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--fyp-shadow-glow);
  text-decoration: none;
}
.btn-fyp:active { transform: translateY(0); }
.btn-fyp:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-fyp-block { width: 100%; }

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  margin-top: .8rem;
  background: var(--fyp-surface, #fff);
  border: 1.5px solid var(--fyp-border-strong);
  color: var(--fyp-heading);
  font-weight: 600;
  font-size: .9rem;
  padding: .75rem 1.2rem;
  border-radius: var(--fyp-radius-pill);
  transition: border-color var(--fyp-dur-fast), color var(--fyp-dur-fast);
  text-decoration: none;
  cursor: pointer;
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
}
.btn-google:hover {
  border-color: var(--fyp-primary);
  color: var(--fyp-primary);
  text-decoration: none;
}

.btn-link-plain {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fyp-primary);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-link-plain:hover { color: var(--fyp-primary-hover); text-decoration: underline; }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 1rem 0 .3rem;
  color: var(--fyp-faint, #94A3B8);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fyp-border);
}

/* Footer links */
.auth-alt {
  margin-top: 1.4rem;
  font-size: .88rem;
  color: var(--fyp-muted);
  text-align: center;
  line-height: 1.5;
}
.auth-alt a {
  color: var(--fyp-primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-alt a:hover { color: var(--fyp-primary-hover); }

.auth-copy {
  margin-top: 1.8rem;
  font-size: .78rem;
  color: var(--fyp-muted);
  opacity: .85;
  text-align: center;
}

/* Terms links inside checkbox label */
.auth-card .form-check-label a {
  color: var(--fyp-primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-card .form-check-label a:hover {
  text-decoration: underline;
  color: var(--fyp-primary-hover);
}

/* --- Splash loader --- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--fyp-body-bg, #F4F6FB);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .35s ease;
}
#loader.is-done { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--fyp-primary-200, #A7F3D0);
  border-top-color: var(--fyp-primary);
  animation: authSpin .75s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* --- Page overlay --- */
#page-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fyp-scrim, rgba(8, 15, 30, .45));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
#page-overlay.active { opacity: 1; visibility: visible; }
#page-overlay .page-loading-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  animation: authSpin .75s linear infinite;
}

/* jquery-toast compat */
.jq-toast-wrap { z-index: 10002 !important; }

/* ============================================================
   FYP Toast notifications (toast.js)
   ============================================================ */
.fyp-toast-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: auto;
  z-index: 10003;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-width: 380px;
  width: auto;
  pointer-events: none;
}

.fyp-toast {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .85rem 1rem;
  background: var(--fyp-surface, #fff);
  border: 1px solid var(--fyp-border, #E4E9F1);
  border-radius: var(--fyp-radius-lg, 1rem);
  box-shadow: var(--fyp-shadow-lg, 0 20px 44px -14px rgba(11,21,38,.18));
  pointer-events: auto;
  cursor: default;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
  font-family: var(--fyp-font-sans, system-ui, sans-serif);
}
.fyp-toast.is-shown {
  opacity: 1;
  transform: translateY(0);
}
.fyp-toast.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.fyp-toast-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: .75rem;
}

.fyp-toast.is-success .fyp-toast-ico {
  background: var(--fyp-success-soft, rgba(16,185,129,.12));
  color: var(--fyp-success, #10B981);
}
.fyp-toast.is-error .fyp-toast-ico {
  background: var(--fyp-danger-soft, rgba(239,68,68,.12));
  color: var(--fyp-danger, #EF4444);
}
.fyp-toast.is-warning .fyp-toast-ico {
  background: var(--fyp-warning-soft, rgba(245,158,11,.14));
  color: var(--fyp-warning, #F59E0B);
}
.fyp-toast.is-info .fyp-toast-ico {
  background: var(--fyp-info-soft, rgba(59,130,246,.12));
  color: var(--fyp-info, #3B82F6);
}

.fyp-toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.fyp-toast-title {
  font-size: .8rem;
  font-weight: 700;
  color: var(--fyp-heading, #0B1526);
  line-height: 1.3;
}
.fyp-toast-msg {
  font-size: .82rem;
  color: var(--fyp-text, #3D4C63);
  line-height: 1.45;
  word-break: break-word;
}

.fyp-toast-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--fyp-faint, #94A3B8);
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  font-size: .7rem;
  transition: color .15s, background .15s;
  padding: 0;
}
.fyp-toast-x:hover {
  color: var(--fyp-heading);
  background: var(--fyp-surface-3, #EEF2F7);
}

@media (max-width: 575.98px) {
  .fyp-toast-wrap { top: 12px; right: 12px; left: auto; width: auto; align-items: stretch; }
}

/* Admin variant (mobile) */
.auth-admin .auth-card {
  border-color: var(--fyp-border);
}

/* ============================================================
   TABLET (≥ 576px)
   Centered card, larger padding, decorative blobs
   ============================================================ */
@media (min-width: 576px) {
  body.auth-body {
    padding: 2.5rem 1.5rem;
    align-items: center;
    padding-top: 2.5rem;
  }

  .auth-shell {
    max-width: 480px;
  }

  .auth-brand {
    margin-bottom: 2rem;
  }
  .auth-brand img {
    max-height: 46px;
  }

  .auth-card {
    padding: 2.25rem 2rem;
    border-radius: var(--fyp-radius-xl);
  }

  .auth-title {
    font-size: 1.45rem;
  }

  .auth-sub {
    font-size: .92rem;
    margin-bottom: 1.7rem;
  }

  .btn-fyp { min-height: 48px; }
  .btn-google { min-height: 48px; }

  /* Decorative blobs */
  .auth-shell::before,
  .auth-shell::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: -1;
  }
  .auth-shell::before {
    width: 400px; height: 400px;
    top: -140px; right: -100px;
    background: radial-gradient(circle, rgba(11,166,120,.16) 0%, transparent 70%);
  }
  .auth-shell::after {
    width: 350px; height: 350px;
    bottom: -140px; left: -100px;
    background: radial-gradient(circle, rgba(20,184,166,.12) 0%, transparent 70%);
  }
}

/* ============================================================
   DESKTOP (≥ 992px) — Split layout
   Left: branding panel  |  Right: form card
   ============================================================ */
@media (min-width: 992px) {
  body.auth-body {
    padding: 0;
    background: #fff;
    align-items: stretch;
  }

  .auth-shell {
    flex-direction: row;
    align-items: stretch;
    min-height: 100vh;
    max-width: 100%;
  }

  /* --- Left Branding Panel --- */
  .auth-brand-panel {
    display: flex;
    position: relative;
    width: 44%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--fyp-gradient);
    overflow: hidden;
    flex-shrink: 0;
  }

  .auth-brand-panel::before {
    content: "";
    position: absolute;
    width: 600px; height: 600px;
    top: -180px; left: -120px;
    background: radial-gradient(circle, rgba(255,255,255,.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
  }
  .auth-brand-panel::after {
    content: "";
    position: absolute;
    width: 500px; height: 500px;
    bottom: -160px; right: -100px;
    background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
  }

  .auth-float {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    pointer-events: none;
  }
  .auth-float-1 {
    width: 180px; height: 180px;
    top: 12%; left: 8%;
    animation: authFloat 7s ease-in-out infinite;
  }
  .auth-float-2 {
    width: 120px; height: 120px;
    bottom: 18%; right: 12%;
    animation: authFloat 9s ease-in-out infinite reverse;
  }
  .auth-float-3 {
    width: 80px; height: 80px;
    top: 55%; left: 55%;
    animation: authFloat 6s ease-in-out infinite 1s;
  }
  @keyframes authFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-18px) scale(1.05); }
  }

  .auth-brand-panel .auth-brand {
    position: relative;
    z-index: 2;
    margin-bottom: 2.5rem;
  }
  .auth-brand-panel .auth-brand img {
    max-height: 52px;
    filter: brightness(0) invert(1);
  }

  .auth-panel-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #fff;
    max-width: 360px;
  }
  .auth-panel-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: .75rem;
    line-height: 1.3;
  }
  .auth-panel-desc {
    font-size: .95rem;
    opacity: .85;
    line-height: 1.6;
  }
  .auth-panel-features {
    margin-top: 2.5rem;
    text-align: left;
    list-style: none;
    padding: 0;
  }
  .auth-panel-features li {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem 0;
    font-size: .9rem;
    opacity: .9;
  }
  .auth-panel-features li i {
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .15);
    border-radius: 8px;
    font-size: .75rem;
    flex-shrink: 0;
  }

  /* --- Right Form Panel --- */
  .auth-card-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 3rem;
    background: var(--fyp-body-bg, #F4F6FB);
    overflow-y: auto;
  }

  .auth-card-panel .auth-brand {
    display: none;
  }

  .auth-card-panel .auth-card {
    max-width: 440px;
    padding: 2.5rem 2.25rem;
    border-radius: var(--fyp-radius-xl);
  }

  .auth-card-panel .auth-alt {
    margin-top: 1.8rem;
  }

  /* Remove mobile blobs */
  .auth-shell::before,
  .auth-shell::after {
    display: none;
  }
}

/* Admin variant */
.auth-admin .auth-brand-panel {
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
}
