/**
 * หน้าล็อกอิน Report KC — โครงเดียวกับ Staff Office
 * โหลดท้าย head เพื่อชนะ tissue theme / inline ใน index.php
 */
body.mt-auth-screen .tissue-background,
body.mt-auth-screen .mt-tissue-ambient {
  display: none !important;
}

body.mt-auth-screen #kc-so-topbar,
body.mt-auth-screen #kc-so-bottom-nav,
body.mt-auth-screen #kc-so-drawer-backdrop,
body.mt-auth-screen #b2c-wm {
  display: none !important;
}

body.mt-auth-screen {
  background: #eef2f9 !important;
}

body.mt-auth-screen .app {
  background: #fff !important;
  box-shadow: none !important;
}

body.mt-auth-screen #s-login,
body.mt-auth-screen #s-admin-first-login,
body.mt-auth-screen #s-admin-set-password {
  background: #fff;
  min-height: 100%;
}

/* โลโก้ + แสงประกาย */
.logo-shine-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  isolation: isolate;
}
.logo-shine-wrap .logo-shine-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.logo-shine-wrap .logo-shine-inner svg {
  max-width: 100%;
  max-height: 100%;
}
.logo-shine-wrap::after {
  content: "";
  position: absolute;
  top: -20%;
  left: -130%;
  width: 55%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 38%,
    rgba(255, 255, 255, 0.92) 50%,
    rgba(255, 255, 255, 0) 62%,
    transparent 100%
  );
  transform: skewX(-22deg);
  pointer-events: none;
  z-index: 2;
  animation: kcLogoShineSlide 3.2s ease-in-out infinite;
}
.logo-shine-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
@keyframes kcLogoShineSlide {
  0%, 12% { left: -130%; opacity: 0; }
  18% { opacity: 1; }
  52% { left: 130%; opacity: 1; }
  58%, 100% { left: 130%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .logo-shine-wrap::after { animation: none; opacity: 0; }
}

body.mt-auth-screen .login-hero,
body.mt-tissue-brand.mt-auth-screen .login-hero,
body.mt-tissue-brand.mt-auth-screen #s-login .login-hero,
body.mt-tissue-brand.mt-auth-screen #s-admin-first-login .login-hero,
body.mt-tissue-brand.mt-auth-screen #s-admin-set-password .login-hero {
  background: linear-gradient(155deg, #0a1628 0%, #0d47a1 45%, #1565c0 100%) !important;
  padding: 44px 28px 32px !important;
  text-align: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body.mt-auth-screen .login-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #00b4ff, #ff6b35, transparent);
}

body.mt-auth-screen .login-logo,
body.mt-tissue-brand.mt-auth-screen .login-logo {
  width: 124px;
  height: 124px;
  margin: 0 auto 16px;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 24px rgba(0, 180, 255, 0.12);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.mt-auth-screen .login-logo.logo-shine-wrap::after {
  animation-duration: 3.6s;
}
body.mt-auth-screen .login-logo .logo-shine-inner svg,
body.mt-auth-screen .login-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: scale(1.04);
}

body.mt-auth-screen .login-hero h1,
body.mt-tissue-brand.mt-auth-screen .login-hero h1 {
  color: #fff !important;
  font-family: "Exo 2", Prompt, sans-serif;
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

body.mt-auth-screen .login-hero p {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 13px;
  line-height: 1.55;
  position: relative;
  z-index: 1;
}

body.mt-auth-screen .login-form {
  padding: 24px 22px 32px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  margin-top: -10px;
  flex: 1;
  box-shadow: 0 -8px 32px rgba(10, 22, 40, 0.08);
  position: relative;
  z-index: 2;
}

body.mt-auth-screen .so-login-hint {
  font-size: 11px;
  color: #5a6d85;
  margin-bottom: 14px;
  line-height: 1.45;
  padding: 8px 10px;
  background: #f0f6ff;
  border-radius: 8px;
  border-left: 3px solid #00b4ff;
}
body.mt-auth-screen .so-login-hint i {
  margin-right: 6px;
  color: #1565c0;
}
body.mt-auth-screen .so-login-hint code {
  background: #e3f2fd;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

body.mt-auth-screen .field {
  margin-bottom: 14px;
}
body.mt-auth-screen .field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #5a6d85;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.mt-auth-screen .field input,
body.mt-auth-screen .so-pw-wrap input,
body.mt-tissue-brand.mt-auth-screen .field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #c8d6ea !important;
  border-radius: 10px !important;
  font-size: 15px;
  font-family: inherit;
  background: #f8fafd !important;
  color: #0f1c2e !important;
  box-shadow: none !important;
}
body.mt-auth-screen .field input:focus,
body.mt-auth-screen .so-pw-wrap input:focus,
body.mt-tissue-brand.mt-auth-screen .field input:focus {
  outline: none;
  border-color: #2196f3 !important;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15) !important;
}

body.mt-auth-screen .so-pw-wrap {
  position: relative;
}
body.mt-auth-screen .so-pw-wrap input {
  padding-right: 42px;
}
body.mt-auth-screen .so-pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #5a6d85;
  cursor: pointer;
  padding: 8px;
  font-size: 16px;
  z-index: 2;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
}
body.mt-auth-screen .so-pw-toggle:active {
  color: #0d47a1;
}

body.mt-auth-screen .so-login-error {
  background: #ffebee;
  color: #c62828;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: center;
}

body.mt-auth-screen .so-login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
body.mt-auth-screen .so-login-remember input {
  width: 16px;
  height: 16px;
  accent-color: #1565c0;
  cursor: pointer;
}
body.mt-auth-screen .so-login-remember label {
  font-size: 13px;
  color: #5a6d85;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  margin: 0;
}

body.mt-auth-screen .btn-primary,
body.mt-tissue-brand.mt-auth-screen .btn-primary {
  width: 100%;
  padding: 14px !important;
  border: none !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%) !important;
  color: #fff !important;
  font-size: 15px;
  font-weight: 700;
  font-family: "Exo 2", Prompt, sans-serif;
  cursor: pointer;
  letter-spacing: 0.4px;
  box-shadow: 0 4px 16px rgba(13, 71, 161, 0.35) !important;
  transition: transform 0.12s;
}
body.mt-auth-screen .btn-primary:hover,
body.mt-tissue-brand.mt-auth-screen .btn-primary:hover {
  transform: translateY(-1px);
}
body.mt-auth-screen .btn-primary.is-loading {
  pointer-events: none;
  opacity: 0.92;
}
.kc-btn-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: kcBtnSpin 0.7s linear infinite;
}
@keyframes kcBtnSpin { to { transform: rotate(360deg); } }

body.mt-auth-screen .so-auth-link-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: none;
  background: none;
  color: #1565c0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
}

@media (min-width: 960px) {
  body.mt-auth-screen,
  body.mt-auth-screen:has(#s-login.active),
  body.mt-auth-screen:has(#s-admin-first-login.active),
  body.mt-auth-screen:has(#s-admin-set-password.active) {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: auto;
    background: #eef2f9 !important;
  }

  body.mt-auth-screen .app,
  body.mt-auth-screen:has(#s-login.active) .app,
  body.mt-auth-screen:has(#s-admin-first-login.active) .app,
  body.mt-auth-screen:has(#s-admin-set-password.active) .app {
    flex: 0 1 auto !important;
    width: 100% !important;
    max-width: 440px !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 24px auto !important;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(13, 71, 161, 0.12) !important;
    border: 1px solid #c8d6ea;
    background: #fff !important;
  }

  body.mt-auth-screen #s-login,
  body.mt-auth-screen #s-admin-first-login,
  body.mt-auth-screen #s-admin-set-password {
    overflow: visible;
  }

  body.mt-auth-screen .login-form {
    border-radius: 0;
    margin-top: 0;
    box-shadow: none;
    flex: 0 1 auto;
  }
}
