/**
 * POLMOR CMS Admin — Login Page Premium Styles
 * Scope: login.php only (class namespace: polmor-login-*)
 *
 * Architecture
 * ─────────────────────────────────────────────────────────────────────────────
 * .polmor-login-body          body reset; no overflow on viewport
 * .polmor-login-shell         CSS grid split-screen (left 55% / right 45%)
 *   .polmor-login-left        fixed full-height photo panel (decorative)
 *     .polmor-login-overlay   dark navy gradient overlay (pointer-events:none)
 *     .polmor-login-brand-block  POLMOR logo + wordmark (pointer-events:none)
 *   .polmor-login-right       scrollable panel; centers the card
 *     .polmor-login-card-wrap centering helper
 *     .polmor-login-card      white glass card with shadow
 *
 * Click-blocking prevention
 * ─────────────────────────────────────────────────────────────────────────────
 * All decorative children of .polmor-login-left use pointer-events:none.
 * The right panel and card use position:relative / z-index:1 so they are
 * always the topmost interactive layer.  No z-index arms race required.
 *
 * Stacking order (painted bottom to top):
 *  1. body background (#f4f5f7)
 *  2. .polmor-login-left  (background-image)
 *  3. .polmor-login-overlay  (pointer-events:none)
 *  4. .polmor-login-brand-block  (pointer-events:none)
 *  5. .polmor-login-right  (z-index:1, interactive)
 *  6. .polmor-login-card  (z-index:2, interactive)
 */

/* ─── Body reset ─────────────────────────────────────────────────────────── */
html:has(.polmor-login-body),
body.polmor-login-body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  min-height: 100dvh;
  background: #f4f5f7;
  overflow: hidden;
}

/* ─── Split-screen shell ─────────────────────────────────────────────────── */
.polmor-login-shell {
  display: grid;
  grid-template-columns: 55fr 45fr;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

/* ─── Left photo panel ───────────────────────────────────────────────────── */
.polmor-login-left {
  position: relative;
  height: 100%;
  height: 100dvh;
  background-image: url('../images/polmor-login-bg.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  overflow: hidden;
}

/* Dark navy + subtle blue gradient overlay — decorative only */
.polmor-login-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      160deg,
      rgba(10, 14, 38, 0.72) 0%,
      rgba(22, 32, 80, 0.60) 50%,
      rgba(10, 14, 38, 0.78) 100%
    );
  z-index: 1;
}

/* POLMOR branding block — decorative only */
.polmor-login-brand-block {
  pointer-events: none;
  position: absolute;
  bottom: 36px;
  left: 36px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
}

.polmor-login-brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.92;
  flex-shrink: 0;
}

.polmor-login-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.polmor-login-brand-name {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-transform: uppercase;
}

.polmor-login-brand-sub {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

/* ─── Right panel ────────────────────────────────────────────────────────── */
.polmor-login-right {
  position: relative;
  z-index: 1;                   /* always above the left photo panel */
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  height: 100dvh;
  padding: 1.5rem 1.25rem;
  background: var(--bs-body-bg, #ffffff);
  /* Subtle vertical gradient for depth */
  background-image: linear-gradient(
    180deg,
    rgba(var(--bs-primary-rgb, 89 85 209), 0.04) 0%,
    transparent 40%
  );
  overflow-y: auto;
  box-sizing: border-box;
}

.polmor-login-card-wrap {
  width: 100%;
  max-width: 440px;
}

/* ─── Login card ─────────────────────────────────────────────────────────── */
.polmor-login-card {
  position: relative;
  z-index: 2;                   /* topmost interactive layer */
  background: var(--bs-body-bg, #ffffff);
  border: 1px solid rgba(var(--bs-primary-rgb, 89 85 209), 0.12);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.06),
    0 10px 30px -4px rgba(0, 0, 0, 0.10),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  /* Optional glass effect — gracefully degrades if unsupported */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* Hover micro-lift */
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .polmor-login-card:hover {
    box-shadow:
      0 6px 12px -2px rgba(0, 0, 0, 0.08),
      0 16px 40px -6px rgba(0, 0, 0, 0.13),
      0 0 0 1px rgba(255, 255, 255, 0.55) inset;
    transform: translateY(-1px);
  }
}

/* ─── Input wrappers & inline SVG icons ──────────────────────────────────── */
.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-input-icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-secondary-color, #64748b);
  pointer-events: none;
  user-select: none;
  z-index: 3;
  transition: color 0.2s ease;
  width: 18px;
  height: 18px;
}

.login-input-icon-left svg {
  width: 18px;
  height: 18px;
  display: block;
}

.login-input-with-icon {
  padding-left: 42px !important;
  height: 46px;
  border-radius: 8px;
  font-size: 0.9375rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  background-color: var(--bs-body-bg, #ffffff);
  color: var(--bs-heading-color, #1e293b);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input-password {
  padding-right: 44px !important;
}

/* Color transition when input inside wrapper is focused */
.login-input-wrapper:focus-within .login-input-icon-left {
  color: var(--bs-primary, #5955D1);
}

.login-input-with-icon:focus {
  border-color: var(--bs-primary, #5955D1);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb, 89 85 209), 0.15);
  outline: 0;
}

/* Eye Toggle Button */
.login-toggle-password {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--bs-secondary-color, #64748b);
  cursor: pointer;
  z-index: 4;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.login-toggle-password:hover {
  color: var(--bs-primary, #5955D1);
  background-color: rgba(var(--bs-primary-rgb, 89 85 209), 0.08);
}

.login-toggle-password:focus-visible {
  outline: 2px solid var(--bs-primary, #5955D1);
  outline-offset: 1px;
}

.login-toggle-password svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ─── Form controls — ensure they are never covered ──────────────────────── */
.polmor-login-card .form-control,
.polmor-login-card .form-check-input,
.polmor-login-card .btn {
  position: relative;
  z-index: 1;
}

/* Submit button loading appearance */
.polmor-login-card #submitBtn[disabled] {
  opacity: 0.82;
  cursor: not-allowed;
}

/* ─── Auth brand logo & Tagline ─────────────────────────────────────────── */
.polmor-login-card .auth-brand-logo {
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

.polmor-login-tagline {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bs-primary, #5955D1);
  line-height: 1.2;
}

/* ─── Responsive: Tablet (md, no photo) ─────────────────────────────────── */
@media (max-width: 991.98px) {
  .polmor-login-shell {
    grid-template-columns: 1fr;
  }
  .polmor-login-left {
    display: none;   /* collapse photo panel; form is primary */
  }
  .polmor-login-right {
    background: var(--bs-body-bg, #ffffff);
    background-image: linear-gradient(
      180deg,
      rgba(var(--bs-primary-rgb, 89 85 209), 0.06) 0%,
      transparent 35%
    );
    min-height: 100vh;
  }
}

/* ─── Responsive: Mobile ─────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .polmor-login-right {
    padding: 1.5rem 1rem;
    align-items: flex-start;
    padding-top: 2.5rem;
  }
  .polmor-login-card-wrap {
    max-width: 100%;
  }
  .polmor-login-card {
    /* Remove glass effect on tiny screens for performance */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ─── Responsive: Small Height Laptops (1366x768 / 1536x864) ───────────── */
@media (max-height: 800px) {
  .polmor-login-right {
    padding: 1rem 1.25rem;
  }
  .polmor-login-card {
    padding: 1.5rem 1.75rem !important;
  }
  .polmor-login-card .auth-brand-logo {
    max-height: 38px;
  }
  .polmor-login-card .mb-4 {
    margin-bottom: 0.85rem !important;
  }
  .polmor-login-card .h5 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem !important;
  }
  .polmor-login-card p.text-muted {
    font-size: 0.82rem;
  }
  .polmor-login-brand-block {
    bottom: 24px;
    left: 28px;
  }
  .polmor-login-brand-logo {
    height: 32px;
  }
}

/* ─── Dark mode compatibility ────────────────────────────────────────────── */
[data-bs-theme="dark"] .polmor-login-right {
  background: var(--bs-body-bg);
  background-image: linear-gradient(
    180deg,
    rgba(var(--bs-primary-rgb), 0.06) 0%,
    transparent 40%
  );
}

[data-bs-theme="dark"] .polmor-login-card {
  background: var(--bs-body-bg);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 10px 30px -4px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

[data-bs-theme="dark"] .polmor-login-tagline {
  color: #a5b4fc;
}
