/* Posterweb — หน้าเข้าสู่ระบบ */

.pw-login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  position: relative;
  overflow: hidden;
}

.pw-login[hidden] {
  display: none !important;
}

/* ── Hero ── */
.pw-login-hero {
  position: relative;
  display: flex;
  align-items: center;
  padding: 56px 48px;
  background:
    radial-gradient(ellipse 70% 55% at 15% 25%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse 50% 45% at 85% 75%, rgba(56, 189, 248, 0.15), transparent),
    linear-gradient(160deg, #070a10 0%, #0f1522 50%, #0a0e18 100%);
  overflow: hidden;
}

.pw-login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, black, transparent);
}

.pw-login-hero::after {
  content: '';
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(120px);
  opacity: 0.12;
  top: -80px;
  right: -60px;
  animation: loginGlow 8s ease-in-out infinite alternate;
}

@keyframes loginGlow {
  from { transform: translate(0, 0) scale(1); opacity: 0.1; }
  to { transform: translate(-30px, 20px) scale(1.1); opacity: 0.16; }
}

.pw-hero-content {
  position: relative;
  z-index: 2;
  max-width: 440px;
}

.pw-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-hover);
  margin-bottom: 28px;
  backdrop-filter: blur(8px);
}

.pw-hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.pw-hero-title {
  margin: 0 0 18px;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.pw-hero-title span {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pw-hero-desc {
  margin: 0 0 36px;
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.pw-hero-stats {
  display: flex;
  gap: 28px;
  margin-bottom: 40px;
}

.pw-hero-stat strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.pw-hero-stat span {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.pw-hero-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pw-hero-features li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition), border-color var(--transition);
}

.pw-hero-features li:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.pw-hero-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* Floating preview cards */
.pw-hero-visual {
  position: absolute;
  right: 40px;
  bottom: 60px;
  z-index: 1;
  width: 280px;
  height: 320px;
  pointer-events: none;
}

.pw-preview-card {
  position: absolute;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 24, 36, 0.85);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.pw-preview-card::before {
  content: '';
  display: block;
  background: linear-gradient(135deg, var(--accent-soft), rgba(56, 189, 248, 0.2));
}

.pw-preview-card:nth-child(1) {
  width: 120px;
  height: 120px;
  top: 0;
  right: 0;
  animation: floatA 6s ease-in-out infinite;
}

.pw-preview-card:nth-child(1)::before {
  height: 100%;
}

.pw-preview-card:nth-child(2) {
  width: 160px;
  height: 90px;
  top: 100px;
  left: 0;
  animation: floatB 7s ease-in-out infinite;
}

.pw-preview-card:nth-child(2)::before {
  height: 100%;
}

.pw-preview-card:nth-child(3) {
  width: 90px;
  height: 160px;
  bottom: 0;
  right: 40px;
  animation: floatC 5.5s ease-in-out infinite;
}

.pw-preview-card:nth-child(3)::before {
  height: 100%;
}

.pw-preview-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

@keyframes floatA {
  0%, 100% { transform: translateY(0) rotate(2deg); }
  50% { transform: translateY(-12px) rotate(-1deg); }
}

@keyframes floatB {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(10px) rotate(1deg); }
}

@keyframes floatC {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Login Panel ── */
.pw-login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--bg);
  position: relative;
}

.pw-login-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.pw-login-mobile-brand {
  display: none;
  text-align: center;
  margin-bottom: 28px;
}

.pw-login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.pw-login-card-head {
  text-align: center;
  margin-bottom: 28px;
}

.pw-login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 8px 32px var(--accent-glow);
}

.pw-login-card-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pw-login-card-head p,
.license-sub {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.pw-login-mobile-brand .license-sub {
  margin-top: 4px;
}

.pw-login-form .pw-input-wrap {
  position: relative;
  margin-bottom: 20px;
}

.pw-login-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pw-input-icon {
  position: absolute;
  left: 14px;
  bottom: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.pw-login-form input[type='email'] {
  width: 100%;
  padding: 13px 14px 13px 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.pw-login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pw-login-form input::placeholder {
  color: var(--text-muted);
}

.pw-login-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  margin-bottom: 16px;
}

.pw-login-error[hidden] {
  display: none !important;
}

.pw-login-error-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.pw-btn-login {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.pw-btn-login:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.pw-btn-login:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.pw-btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.pw-btn-login.is-loading .pw-btn-spinner {
  display: block;
}

.pw-btn-login.is-loading .pw-btn-text {
  opacity: 0.85;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.pw-login-steps {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pw-login-steps-title {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pw-login-step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pw-login-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pw-login-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.pw-login-ext-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.pw-login-ext-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}

.pw-login-ext-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.pw-login-ext-dot.fail { background: var(--danger); }

.pw-login-footer {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  text-align: center;
}

.pw-login-footer p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.pw-login-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pw-login-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.pw-login-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
}

.pw-login-version {
  display: block;
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Legacy class hooks (keep IDs for boot.js) */
.license-form.pw-login-form { margin: 0; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .pw-login {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .pw-login-hero {
    display: none;
  }

  .pw-login-mobile-brand {
    display: block;
  }

  .pw-login-mobile-brand .pw-hero-title {
    font-size: 1.75rem;
    margin-bottom: 4px;
  }

  .pw-login-panel {
    padding: 24px 20px 40px;
    justify-content: flex-start;
    min-height: 100vh;
  }

  .pw-login-card {
    padding: 28px 22px;
  }
}

@media (min-width: 961px) and (max-width: 1100px) {
  .pw-hero-visual {
    opacity: 0.5;
    right: 20px;
  }
}
