/**
 * SIM Lab - Halaman Auth (Login, Lupa Password)
 * Bootstrap 5.3 - Robust, responsive, aksesibel
 */

/* ---- Variabel (warna hijau sesuai logo SIM Lab) ---- */
:root {
  --auth-bg: #f0fdf4;
  --auth-bg-end: #dcfce7;
  --auth-card-bg: #ffffff;
  --auth-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 10px 30px -10px rgba(22, 163, 74, 0.12);
  --auth-card-radius: 16px;
  --auth-primary: #16a34a;
  --auth-primary-dark: #15803d;
  --auth-input-radius: 12px;
  --auth-panel-start: #16a34a;
  --auth-panel-mid: #15803d;
  --auth-panel-end: #166534;
  --auth-focus-ring: 0 0 0 3px rgba(22, 163, 74, 0.35);
  --auth-touch-min: 44px;
}

/* ---- Body ---- */
.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, var(--auth-bg) 0%, var(--auth-bg-end) 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Layout utama (flex robust) ---- */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  overflow: hidden;
}

.auth-form-col {
  flex: 1 1 100%;
  min-height: 0; /* allow shrink for overflow */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-form-scroll {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 0.5rem 0;
  flex-shrink: 0;
}

/* ---- Card form ---- */
.auth-form-card {
  background: var(--auth-card-bg);
  border-radius: var(--auth-card-radius);
  box-shadow: var(--auth-card-shadow);
  padding: 2rem 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.auth-logo-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  min-height: var(--auth-touch-min);
  line-height: 1;
}

.auth-logo-img-wrap {
  line-height: 0;
}

.auth-logo-img {
  display: block;
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

.auth-logo-img-panel {
  max-height: 56px;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: #64748b;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.auth-app-name {
  letter-spacing: 0.02em;
}

/* ---- Alert error (robust) ---- */
.auth-alert {
  margin-bottom: 1.25rem;
  border-radius: var(--auth-input-radius);
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.auth-alert ul {
  font-size: 0.9375rem;
}

/* ---- Form ---- */
.auth-form .form-label {
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.35rem;
}

.auth-form .form-control {
  border-radius: var(--auth-input-radius);
  border: 1px solid #e2e8f0;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  min-height: var(--auth-touch-min);
}

.auth-form .form-control:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.auth-form .form-control:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
}

.auth-form .form-control.is-invalid {
  border-color: #dc3545;
}

.auth-form .form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.auth-form .form-control::placeholder {
  color: #94a3b8;
}

.auth-form .input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.auth-form .input-group .auth-toggle-pw {
  border-radius: 0 var(--auth-input-radius) var(--auth-input-radius) 0;
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  padding: 0 1rem;
  min-width: var(--auth-touch-min);
  min-height: var(--auth-touch-min);
}

.auth-form .input-group .auth-toggle-pw:hover {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.auth-form .input-group .auth-toggle-pw:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
  z-index: 3;
}

.auth-form-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.auth-form-options .form-check-label {
  font-size: 0.9375rem;
  color: #475569;
  padding-left: 0.25rem;
}

.auth-form-options .form-check-input {
  min-width: 1.1em;
  min-height: 1.1em;
}

.auth-link {
  font-size: 0.9375rem;
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.35em 0;
  min-height: var(--auth-touch-min);
  display: inline-flex;
  align-items: center;
}

.auth-link:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

.auth-link:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: var(--auth-focus-ring);
}

.auth-link-muted {
  color: #64748b;
}

.auth-link-muted:hover {
  color: #475569;
}

.auth-submit {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--auth-input-radius);
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
  border: none;
  min-height: var(--auth-touch-min);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--auth-primary-dark), #166534);
  border: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -6px rgba(22, 163, 74, 0.4);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
}

.auth-submit:disabled {
  opacity: 0.85;
  cursor: not-allowed;
  transform: none;
}

.auth-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-footer .auth-link {
  min-height: 0;
}

.auth-copy {
  font-size: 0.8125rem;
  color: #94a3b8;
}

/* ---- Panel kanan (desktop) ---- */
.auth-panel {
  flex: 1 1 100%;
  min-height: 40vh;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.auth-panel-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, var(--auth-panel-start) 0%, var(--auth-panel-mid) 45%, var(--auth-panel-end) 100%);
}

.auth-panel-bg::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.auth-panel-bg::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.auth-panel-content {
  position: relative;
  z-index: 1;
  color: #fff;
  max-width: 420px;
}

.auth-panel-logo {
  display: inline-block;
}

.auth-panel-logo .brand-logo {
  color: #fff;
}

.auth-panel-logo .brand-logo:hover {
  color: rgba(255, 255, 255, 0.95);
}

.auth-panel-logo .brand-logo-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.auth-panel-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.auth-panel-desc {
  font-size: 1rem;
  opacity: 0.92;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.auth-panel-features {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9375rem;
  opacity: 0.95;
}

.auth-panel-features li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
}

.auth-panel-features li i {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.auth-panel-card2 {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-panel-card2-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.auth-panel-card2-body {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.94);
  max-height: min(30vh, 240px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.auth-panel-card2-body::-webkit-scrollbar {
  width: 5px;
}

.auth-panel-card2-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

/* Foto mahasiswa / lab (login) */
.auth-panel-photo {
  margin-top: 1.75rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 16px 48px -20px rgba(0, 0, 0, 0.35);
  background: rgba(15, 23, 42, 0.2);
}

.auth-panel-photo img {
  width: 100%;
  display: block;
  height: clamp(200px, 34vh, 300px);
  object-fit: cover;
  object-position: center 22%;
}

.auth-login-hero {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(22, 163, 74, 0.18);
  box-shadow: 0 10px 28px -12px rgba(22, 163, 74, 0.22);
  margin-bottom: 1rem;
}

.auth-login-hero img {
  width: 100%;
  display: block;
  height: 148px;
  object-fit: cover;
  object-position: center 22%;
}

@media (min-width: 400px) {
  .auth-login-hero img {
    height: 168px;
  }
}

@media (min-width: 576px) {
  .auth-login-hero img {
    height: 188px;
  }
}

/* ---- Responsive: tablet ke atas (2 kolom) ---- */
@media (min-width: 992px) {
  .auth-wrap {
    flex-wrap: nowrap;
  }

  .auth-form-col {
    flex: 0 0 50%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem 3rem;
  }

  .auth-form-card {
    padding: 2.5rem 2rem;
  }

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

  .auth-panel {
    display: flex;
    flex: 0 0 50%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 3rem 4rem;
  }

  .auth-panel-title {
    font-size: 2rem;
  }
}

/* ---- Responsive: mobile ---- */
@media (max-width: 575.98px) {
  .auth-form-col {
    padding: 1rem 0.75rem;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .auth-form-card {
    padding: 1.5rem 1.25rem;
    border-radius: 14px;
  }

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

  .auth-form .form-control-lg {
    font-size: 16px;
    padding: 0.75rem 1rem;
  }

  .auth-submit {
    padding: 0.85rem;
    font-size: 1rem;
  }

  .auth-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .auth-footer .auth-link {
    justify-content: center;
  }
}

/* ---- Responsive: layar lebar ---- */
@media (min-width: 1200px) {
  .auth-form-scroll {
    max-width: 440px;
  }

  .auth-form-card {
    padding: 3rem 2.5rem;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .auth-body,
  .auth-submit,
  .auth-form .form-control {
    transition: none;
  }

  .auth-submit:hover:not(:disabled) {
    transform: none;
  }
}

/* ---- Footer situs (layout auth) ---- */
.auth-site-footer {
  font-size: 0.8125rem;
  color: #64748b;
}

.auth-site-footer .developer-credit a {
  color: var(--auth-primary);
  text-decoration: none;
}

.auth-site-footer .developer-credit a:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}
