/* Advisortool — PIN gate styles (ธีม Light Minimal).
   Self-contained: ใช้ตัวแปรจาก theme.css ถ้ามี ไม่มีก็ fallback เป็นค่าจริง. */

/* ระหว่างล็อก: ซ่อนหน้าจริง + กัน scroll. overlay เป็น sibling ของ body จึงไม่โดนซ่อน. */
html.az-locked { overflow: hidden; background: var(--az-bg, #f7f8fa); }
html.az-locked body { display: none !important; }

.az-pin {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow: auto; /* กันคีย์แพดล้นจอบนหน้าจอเตี้ย (มือถือแนวนอน) ให้เลื่อนได้ */
  background: var(--az-bg, #f7f8fa);
  font-family: var(--az-font, 'IBM Plex Sans Thai', 'Sarabun', 'Segoe UI', Tahoma, sans-serif);
  -webkit-tap-highlight-color: transparent;
  animation: az-pin-in .2s ease;
}
.az-pin--out { animation: az-pin-out .26s ease forwards; }
@keyframes az-pin-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes az-pin-out { from { opacity: 1; } to { opacity: 0; } }

.az-pin__card {
  width: 100%; max-width: 340px; background: var(--az-card, #fff);
  border: 1px solid var(--az-line, #e6e8ec);
  border-radius: 16px; box-shadow: 0 10px 34px -16px rgba(17,24,39,.20);
  padding: 28px 24px 24px; text-align: center;
}
.az-pin__logo {
  display: block; width: min(190px, 72%); height: auto; margin: 0 auto;
  object-fit: contain;
}
.az-pin__title { margin-top: 12px; font-size: 18px; font-weight: 700; color: var(--az-ink-strong, #111827); }

.az-pin__form { margin-top: 20px; }
.az-pin__form.is-disabled { opacity: .55; }

.az-pin__input {
  width: 100%; height: 52px; box-sizing: border-box;
  border: 1px solid var(--az-line, #e6e8ec); border-radius: 12px;
  background: #fff; color: var(--az-ink-strong, #111827);
  font-family: inherit; font-size: 22px; font-weight: 600;
  text-align: center; letter-spacing: 8px;
  transition: border-color .12s, box-shadow .12s;
}
.az-pin__input::placeholder { color: var(--az-muted, #9ca3af); letter-spacing: 8px; }
.az-pin__input:focus {
  outline: none; border-color: var(--az-blue, #2563eb);
  box-shadow: 0 0 0 3px var(--az-blue-l, #eef4ff);
}
.az-pin__input:disabled { cursor: not-allowed; }

.az-pin__msg {
  min-height: 18px; margin-top: 8px; font-size: 12.5px; color: var(--az-bad, #c0392b);
  font-weight: 500; opacity: 0; transition: opacity .15s;
}
.az-pin__msg--show { opacity: 1; }

.az-pin__submit {
  width: 100%; height: 48px; margin-top: 6px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--az-blue, #2563eb); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 700;
  transition: transform .06s, background .12s;
}
.az-pin__submit:hover { background: var(--az-blue-d, #1d4ed8); }
.az-pin__submit:active { transform: scale(.98); }
.az-pin__submit:disabled { cursor: not-allowed; }

.az-shake { animation: az-shake .38s cubic-bezier(.36,.07,.19,.97); }
@keyframes az-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* ปุ่มล็อกลอย (แสดงเมื่อปลดแล้ว) */
.az-lock-btn {
  position: fixed; left: 14px; bottom: 14px; z-index: 2147482000;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--az-line, #e6e8ec);
  background: rgba(255,255,255,.9); color: var(--az-muted, #6b7280);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(16,42,76,.18); opacity: .7;
  transition: opacity .15s, transform .1s;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.az-lock-btn:hover { opacity: 1; }
.az-lock-btn:active { transform: scale(.92); }

@media print { .az-lock-btn { display: none !important; } }
