/* ==========================================================================
   MNHS — Login page (2-column: school mockup left, form right)
   COLOR PALETTE — uses theme from styles.css (logo: red, gold, green, neutrals)
   So login always matches the rest of the site.
   ========================================================================== */

/* Login page palette — mapped to theme variables (--mnhs-* from styles.css) */
.login-page {
  /* Backgrounds — theme */
  --login-bg: var(--mnhs-bg);
  --login-card-bg: var(--mnhs-white);
  --login-panel-header-bg: rgba(255, 255, 255, 0.85);
  /* Primary — theme red */
  --login-primary: var(--mnhs-red);
  --login-primary-hover: var(--mnhs-red-dark);
  --login-primary-light: var(--mnhs-red-light);
  /* Accent — theme gold */
  --login-accent: var(--mnhs-gold);
  --login-accent-soft: var(--mnhs-gold-light);
  /* Neutrals — theme */
  --login-heading: var(--mnhs-dark);
  --login-text: var(--mnhs-text);
  --login-text-muted: var(--mnhs-text-muted);
  --login-border: var(--mnhs-border);
  --login-border-panel: rgba(0, 0, 0, 0.12);
  --login-border-accent: rgba(212, 175, 55, 0.4);
  /* Success — theme green */
  --login-success: var(--mnhs-green);
  --login-success-light: var(--mnhs-green-light);
  /* Shadows — theme-consistent */
  --login-shadow-card:
    0 1px 3px rgba(0, 0, 0, 0.05), 0 10px 28px rgba(0, 0, 0, 0.06);
  --login-shadow-focus: 0 0 0 3px var(--mnhs-red-light);

  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  background: var(--login-bg);
}

.login-layout {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ----- Left panel: same BG color as header & footer (no embed) ----- */
.login-panel-left {
  flex: 1 1 45%;
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--login-primary);
  color: #fff;
  border-right: 2px solid var(--login-border-panel);
}

/* Left panel header — same red as button (light mode) */
.login-left-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 3vw, 1.25rem) clamp(1.5rem, 4vw, 2rem);
  background: var(--login-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.login-back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.login-back-icon {
  flex-shrink: 0;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.95);
}

.login-back-home:hover {
  color: #fff;
}

.login-back-home:hover .login-back-icon {
  transform: translateX(-2px);
}

.login-left-header-brand {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

/* Left panel main (centered content) */
.login-left-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 3.5rem);
}

.login-brand-mockup {
  text-align: center;
  max-width: 680px;
  width: 100%;
  animation: login-panel-fade 0.5s ease-out;
}

@keyframes login-panel-fade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-brand-logo-wrap {
  width: clamp(80px, 12vw, 96px);
  height: clamp(80px, 12vw, 96px);
  margin: 0 auto 1.25rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--login-card-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--login-border);
}

.login-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.login-school-name {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.28;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
}

.login-school-tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin: 0 0 1.5rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.02em;
}

/* Left panel — 3 cards in one row (clean UI/UX) */
.login-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.75rem;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.login-card-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.login-card-item:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
}

.login-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.95);
}

.login-card-icon svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.login-card-title {
  margin: 0 0 0.2rem;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.login-card-desc {
  margin: 0;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.35;
}

@media (max-width: 600px) {
  .login-cards {
    flex-wrap: wrap;
    justify-content: center;
  }
  .login-card-item {
    flex: 1 1 calc(50% - 0.375rem);
    min-width: 120px;
  }
}

/* Content below the cards — motto + supporting text */
.login-below-cards {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.login-motto {
  margin: 0 0 0.5rem;
  font-size: clamp(0.9375rem, 1.8vw, 1.0625rem);
  font-weight: 600;
  font-style: italic;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
}

.login-support-text {
  margin: 0;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

/* Left panel footer — same red as button (light mode) */
.login-left-footer {
  padding: clamp(0.875rem, 2.5vw, 1.125rem) clamp(1.5rem, 4vw, 2rem);
  background: var(--login-primary);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  text-align: center;
}

.login-footer-copy,
.login-footer-deped {
  margin: 0;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

.login-footer-copy {
  font-weight: 500;
}

.login-footer-deped {
  margin-top: 0.2rem;
}

/* ----- Right panel — login form (plain white background) ----- */
.login-panel-right {
  flex: 1 1 55%;
  min-width: 300px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--login-card-bg);
  position: relative;
}

/* Mobile-only back: SVG < at top left (hidden on desktop) */
.login-mobile-back {
  display: none;
  position: absolute;
  top: clamp(1rem, 3vw, 1.25rem);
  left: clamp(1rem, 3vw, 1.5rem);
  z-index: 10;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  color: var(--login-primary);
  text-decoration: none;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.login-mobile-back-text {
  white-space: nowrap;
}

.login-mobile-back:hover {
  color: var(--login-primary-hover);
  background: var(--login-primary-light);
}

.login-mobile-back:focus {
  outline: none;
  box-shadow: var(--login-shadow-focus);
}

.login-wrap {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.login-card {
  width: 100%;
  background: var(--login-card-bg);
  border-radius: 12px;
  box-shadow: var(--login-shadow-card);
  border: 1px solid var(--login-border);
  padding: clamp(1.5rem, 4vw, 2rem);
  border-top: 3px solid var(--login-primary);
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--login-border);
}

.login-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  display: block;
  object-fit: contain;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--login-heading);
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: var(--text-xs);
  color: var(--login-text-muted);
  margin: 0;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

.login-form label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--login-text);
  margin-bottom: 0.375rem;
  transition: color 0.2s ease;
}

.login-form .label-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--login-text-muted);
  transition: color 0.2s ease;
}

.login-form .form-group:focus-within .label-icon {
  color: var(--login-primary);
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--login-text);
  background: var(--login-card-bg);
  border: 1px solid var(--login-border);
  border-radius: 8px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  box-sizing: border-box;
}

.login-form input:focus {
  outline: none;
  border-color: var(--login-primary);
  box-shadow: var(--login-shadow-focus);
}

.login-form input::placeholder {
  color: var(--login-text-muted);
}

.password-input-wrapper {
  position: relative;
  display: block;
}

.password-input-wrapper input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--login-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: var(--login-primary);
}

.password-toggle .eye-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-form .btn-submit .btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.login-form .btn-submit .btn-loader svg {
  animation: login-spin 0.8s linear infinite;
}

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

.login-form .form-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.login-form input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--login-primary);
  margin-right: 0.5rem;
  vertical-align: middle;
}

.login-form .btn-submit {
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--login-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.login-form .btn-submit:hover {
  background: var(--login-primary-hover);
}

.login-form .btn-submit:focus {
  outline: none;
  box-shadow: var(--login-shadow-focus);
}

.login-form .btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Popup — fluid */
.login-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 1.5rem);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.login-popup.login-popup-visible {
  opacity: 1;
  visibility: visible;
}

.login-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.login-popup-box {
  position: relative;
  width: 100%;
  max-width: min(360px, calc(100vw - 2rem));
  background: var(--login-card-bg);
  border-radius: clamp(0.75rem, 2vw, 1rem);
  box-shadow: var(--login-shadow-card);
  padding: clamp(1.25rem, 4vw, 1.75rem);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

.login-popup.login-popup-visible .login-popup-box {
  transform: scale(1);
}

.login-popup-icon {
  margin: 0 auto clamp(0.75rem, 2vw, 1rem);
  width: clamp(40px, 10vw, 48px);
  height: clamp(40px, 10vw, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-popup-icon-char {
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1;
}

.login-popup-error .login-popup-icon,
.login-popup-error .login-popup-icon-char {
  color: var(--login-primary);
}
.login-popup-success .login-popup-icon,
.login-popup-success .login-popup-icon-char {
  color: var(--login-success);
}

.login-popup-icon svg {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
}

.login-popup-message {
  font-size: var(--text-sm);
  color: var(--login-text);
  margin: 0 0 clamp(1rem, 3vw, 1.25rem);
  line-height: 1.5;
}

.login-popup-close {
  display: inline-block;
  padding: clamp(0.5rem, 2vw, 0.625rem) clamp(1.25rem, 3vw, 1.5rem);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.login-popup-error .login-popup-close {
  background: var(--login-primary);
  color: #fff;
}
.login-popup-error .login-popup-close:hover {
  background: var(--login-primary-hover);
}

.login-popup-success .login-popup-close {
  background: var(--login-success);
  color: #fff;
}
.login-popup-success .login-popup-close:hover {
  background: #14532d;
}

.login-footer {
  text-align: center;
  margin-top: clamp(1rem, 3vw, 1.25rem);
  padding-top: clamp(1rem, 3vw, 1.25rem);
  border-top: 1px solid var(--login-border);
}

.login-footer a {
  color: var(--login-primary);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: color 0.2s ease;
}

.login-footer a:hover {
  color: var(--login-primary-hover);
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Want to go back? — Return to homepage (below login card; mobile/tablet only) */
.login-return-home-wrap {
  margin: 0;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--login-border);
  text-align: center;
  display: none;
}

.login-return-prompt {
  margin: 0 0 0.75rem;
  font-size: var(--text-sm);
  color: var(--login-text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.login-return-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--login-primary);
  text-decoration: none;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--login-primary);
  background: transparent;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.login-return-home:hover {
  color: #fff;
  background: var(--login-primary);
  border-color: var(--login-primary);
}

.login-return-home:focus {
  outline: none;
  box-shadow: var(--login-shadow-focus);
}

/* Tablet / iPad (≤1024px): hide left panel, show only login form; top-left SVG back only */
@media (max-width: 1024px) {
  .login-layout {
    flex-direction: column;
  }
  .login-panel-left {
    display: none;
  }
  .login-panel-right {
    flex: 1 1 100%;
    min-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.5rem, 4vw, 2rem);
  }
  .login-mobile-back {
    display: flex;
  }
}

@media (max-width: 480px) {
  .login-form .form-options {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --------------------------------------------------------------------------
   SweetAlert2 — success/error (same as cuatas login)
   -------------------------------------------------------------------------- */
/* SweetAlert2 show/hide animation */
.swal-animate-show {
  animation: swal-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

.swal-animate-hide {
  animation: swal-pop-out 0.25s ease forwards !important;
}

.swal-backdrop-show {
  animation: swal-backdrop-in 0.3s ease forwards !important;
}

.swal-backdrop-hide {
  animation: swal-backdrop-out 0.25s ease forwards !important;
}

@keyframes swal-pop-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes swal-pop-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes swal-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes swal-backdrop-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.swal-popup-sm {
  border-radius: 0.9rem !important;
  background: var(--mnhs-white) !important;
  border: 1px solid var(--mnhs-border) !important;
  color: var(--mnhs-text) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.15) !important;
}

.swal-title-sm {
  font-size: var(--text-base) !important;
  margin-bottom: 0.35rem !important;
  color: var(--mnhs-dark) !important;
}

.swal-html-sm {
  font-size: var(--text-sm) !important;
  color: var(--mnhs-text-muted) !important;
}

.swal-html-sm strong {
  color: var(--mnhs-dark);
}

.swal-confirm-sm {
  font-size: var(--text-sm) !important;
  padding: 0.45rem 1rem !important;
  border-radius: 999px !important;
  min-width: 6rem !important;
  box-sizing: border-box !important;
  background: var(--mnhs-red) !important;
  color: var(--mnhs-white) !important;
  border: none !important;
  transition: all 0.3s ease !important;
  font-weight: 600 !important;
}

.swal-confirm-sm:hover {
  background: var(--mnhs-red-dark) !important;
  filter: brightness(1.05);
}

.swal-popup-sm .swal2-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.swal-icon-sm {
  transform: none !important;
  width: 3.25em !important;
  height: 3.25em !important;
  min-width: 3.25em !important;
  min-height: 3.25em !important;
  margin: 0.15rem auto 0.35rem !important;
  border: none !important;
  background: transparent !important;
  aspect-ratio: 1 / 1 !important;
  box-sizing: content-box !important;
}

/* Circle wrapper with icon inside — perfect circle (square box) */
.swal-icon-circle {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 3rem !important;
  height: 3rem !important;
  min-width: 3rem !important;
  min-height: 3rem !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  border: 3px solid transparent !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.swal-icon-circle.swal-icon-success {
  border-color: var(--mnhs-green) !important;
  background: var(--mnhs-green-light) !important;
}

.swal-icon-circle.swal-icon-error {
  border-color: var(--mnhs-red) !important;
  background: var(--mnhs-red-light) !important;
}

/* Icon character inside circle */
.swal-icon-circle .swal-icon-char {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  font-size: var(--text-2xl) !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.swal-icon-circle.swal-icon-success .swal-icon-char {
  color: var(--mnhs-green) !important;
}

.swal-icon-circle.swal-icon-error .swal-icon-char {
  color: var(--mnhs-red) !important;
}

/* Lock modal (countdown) */
.swal-popup-lock .swal2-html-container {
  padding: 0.5rem 0 !important;
}

.lock-modal-content {
  text-align: center;
  padding: 0.25rem 0;
}

.lock-modal-content p {
  margin: 0.25rem 0;
  font-size: var(--text-base);
  color: var(--mnhs-text);
}

.lock-timer-display,
.lock-timer-display#lock-countdown-timer {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--mnhs-red);
  margin: 0.5rem 0;
}

.lock-timer-text,
#lock-countdown-text {
  font-size: var(--text-sm);
  color: var(--mnhs-text-muted);
  margin: 0;
}
