/* ===========================================================================
   DB Viewer - Login Page CSS (Progent branded)
   =========================================================================== */

/* Re-auth blur overlay — applied to #appContainer when re-authentication is
   required so the login form appears on top without destroying app state. */
#appContainer.reauth-blur {
  filter: blur(4px);
  pointer-events: none;
}

#loginPage {
  position: fixed; inset: 0; z-index: 999999;
  background: linear-gradient(160deg, #ffffff 0%, #fef9f0 40%, #fdf2e9 100%);
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: #1e1e1e;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.lp-grid-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.035;
  background-image:
    linear-gradient(rgba(180,40,40,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180,40,40,.18) 1px, transparent 1px);
  background-size: 60px 60px;
}
.lp-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; position: relative; z-index: 1;
  background: #fff; border-bottom: 1px solid #e5e0d8;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.lp-logo { height: 34px; }
.lp-topbar-sep { width: 1px; height: 24px; background: #d4c8b8; }
.lp-topbar-appname { font-size: 15px; font-weight: 700; color: #2d2520; white-space: nowrap; }
.lp-topbar-text { font-size: 13px; color: #8b7355; letter-spacing: 1px; text-transform: uppercase; font-weight: 500; }
.lp-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 60px; padding: 40px 48px; position: relative; z-index: 1;
  flex-wrap: wrap;
}
.lp-hero { max-width: 580px; flex: 1 1 400px; }
.lp-title {
  font-size: 42px; font-weight: 700; line-height: 1.15; margin: 0 0 18px 0;
  background: linear-gradient(135deg, #b71c1c, #d32f2f, #e65100, #f9a825);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lp-subtitle { font-size: 16px; line-height: 1.6; color: #5d5347; margin: 0 0 32px 0; }
.lp-features { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.lp-feature-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: #fff; border: 1px solid #e8ddd0;
  border-radius: 10px; padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.lp-feature-card:hover { box-shadow: 0 4px 12px rgba(180,40,40,0.08); border-color: #d4a574; }
.lp-feature-icon { width: 28px; height: 28px; fill: #c62828; flex-shrink: 0; margin-top: 2px; }
.lp-feature-title { font-size: 14px; font-weight: 600; color: #2d2520; margin-bottom: 2px; }
.lp-feature-desc { font-size: 12px; color: #6b5e52; line-height: 1.5; }
.lp-image-strip { display: flex; gap: 12px; }
.lp-strip-img {
  width: 33%; height: 110px; object-fit: cover; border-radius: 10px;
  border: 1px solid #e0d5c8;
  transition: transform 0.3s, box-shadow 0.3s;
}
.lp-strip-img:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }

/* Login panel */
.lp-login-panel { flex: 0 0 380px; }
.lp-login-card {
  position: relative;
  background: #fff;
  border: 1px solid #e0d5c8;
  border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.lp-sql-accent { text-align: center; margin-bottom: 16px; }
.lp-sql-icon { width: 48px; height: 48px; color: #c62828; }
.lp-login-title { font-size: 22px; font-weight: 700; color: #2d2520; text-align: center; margin: 0 0 4px 0; }
.lp-login-sub { font-size: 13px; color: #7a6e62; text-align: center; margin: 0 0 24px 0; }
.lp-label { display: block; font-size: 12px; font-weight: 600; color: #5d5347; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.lp-input {
  width: 100%; padding: 10px 14px; border: 1px solid #d4c8b8;
  border-radius: 8px; background: #faf8f5; color: #2d2520;
  font-size: 14px; box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.lp-input:focus { border-color: #c62828; box-shadow: 0 0 0 3px rgba(198,40,40,0.15); }
.lp-input::placeholder { color: #a89888; }
.lp-hint { font-size: 11px; color: #8b7e72; margin-top: 4px; }
.lp-error { color: #c62828; font-size: 12px; margin-bottom: 12px; min-height: 16px; }
.lp-signin-btn {
  width: 100%; padding: 11px 0; border: none; border-radius: 8px;
  background: linear-gradient(135deg, #b71c1c, #d32f2f);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.lp-signin-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(183,28,28,0.3); }
.lp-signin-btn:active { transform: translateY(0); }
.lp-signin-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.lp-spinner { display: none; text-align: center; margin-top: 10px; font-size: 12px; color: #8b7e72; }
.lp-login-footer { margin-top: 20px; text-align: center; }
.lp-sql-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; color: #7a6e62;
  background: #faf8f5; border: 1px solid #e0d5c8;
  border-radius: 20px; padding: 5px 14px;
}
.lp-bottombar {
  padding: 14px 32px; text-align: center; font-size: 11px; color: #8b7e72;
  border-top: 1px solid #e5e0d8; background: #fff;
  position: relative; z-index: 1;
}

/* ── Phone portrait (up to 431px -- includes iPhone 14 Pro Max at 430px) ─ */
@media (max-width: 431px) {
  .lp-main {
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 0; padding: 0; flex-wrap: nowrap;
  }
  /* Flatten hero so its children participate in the column order */
  .lp-hero { display: contents; }
  .lp-hero-header { order: 1; padding: 16px 20px 0; }
  .lp-hero-details { order: 3; padding: 0 20px 20px; }
  .lp-login-panel {
    order: 2; flex: none; width: 100%; max-width: 100%;
    margin: 12px 0; padding: 0 8px; box-sizing: border-box;
  }

  .lp-title { font-size: 22px; margin-bottom: 4px; }
  .lp-subtitle { font-size: 12px; margin-bottom: 0; line-height: 1.4; }

  .lp-features { gap: 6px; margin-bottom: 12px; }
  .lp-feature-card { padding: 8px 12px; gap: 8px; }
  .lp-feature-icon { width: 20px; height: 20px; }
  .lp-feature-title { font-size: 12px; }
  .lp-feature-desc { font-size: 11px; }
  .lp-image-strip { gap: 6px; }
  .lp-strip-img { height: 60px; border-radius: 6px; }

  .lp-login-card {
    border: none; border-radius: 12px; padding: 16px 20px;
    background: #f0faf0; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }
  .lp-topbar { padding: 10px 16px; }
  .lp-logo { height: 28px; }
  .lp-topbar-sep { display: none; }
  .lp-topbar-text { display: none; }
  .lp-topbar-appname { font-size: 14px; }
  .lp-sql-accent { display: none; }
  .lp-login-sub { display: none; }
  .lp-login-footer { display: none; }
  .lp-sms-optin { display: none; }
  .lp-login-title { margin-bottom: 12px; font-size: 18px; }
  .lp-error { min-height: 0; }
  .lp-label { margin-bottom: 4px; }
  .lp-input { font-size: 16px; padding: 12px 16px; border-radius: 10px; }
  .lp-signin-btn { padding: 14px 0; font-size: 16px; border-radius: 10px; min-height: 48px; }
  .lp-bottombar { padding: 10px 16px; font-size: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  #twoFaCodeInput, #totpEmailCodeInput, #totpSetupCodeInput,
  #totpVerifyCodeInput, #totpAltEmailCodeInput {
    font-size: 24px; letter-spacing: 8px; padding: 16px;
  }
  #loginLinks a, #forgotPwStep a, #registerStep a,
  #twoFaStep a, #totpEmailStep a, #totpSetupStep a,
  #totpVerifyStep a, #totpAltEmailStep a {
    font-size: 14px; padding: 8px;
  }
}

/* ── Phone landscape ───────────────────────────────────────────────────── */
@media (max-width: 932px) and (orientation: landscape) {
  .lp-hero { display: none; }
  .lp-login-panel { max-width: 480px; margin: 0 auto; }
  .lp-main { padding: 12px 20px; overflow-y: auto; }
  .lp-sql-accent { display: none; }
  .lp-login-sub { display: none; }
  .lp-login-footer { display: none; }
  .lp-sms-optin { display: none; }
}

/* ── Tablet portrait (432px – 1024px) ──────────────────────────────────── */
@media (min-width: 432px) and (max-width: 1024px) {
  .lp-main { gap: 24px; padding: 20px 24px; flex-wrap: wrap; }
  .lp-hero { flex: 1 1 100%; max-width: 100%; }
  .lp-title { font-size: 26px; margin-bottom: 10px; }
  .lp-subtitle { font-size: 13px; margin-bottom: 16px; }
  .lp-features { gap: 8px; margin-bottom: 16px; }
  .lp-feature-card { padding: 10px 14px; gap: 10px; }
  .lp-feature-icon { width: 22px; height: 22px; }
  .lp-feature-title { font-size: 13px; }
  .lp-feature-desc { font-size: 11px; }
  .lp-image-strip { gap: 8px; margin-bottom: 0; }
  .lp-strip-img { height: 70px; border-radius: 8px; }
  .lp-login-panel { flex: 0 0 100%; max-width: 420px; margin: 0 auto; }
  .lp-login-card { padding: 24px 24px; }
  .lp-sql-accent { margin-bottom: 8px; }
  .lp-sql-icon { width: 36px; height: 36px; }
  .lp-input { font-size: 16px; padding: 12px 14px; }
  .lp-signin-btn { padding: 14px 0; }
}

/* ── Tablet landscape / small laptop (1025px – 1366px) ─────────────────── */
/* Split-pane layout like desktop but tighter spacing */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .lp-main { flex-wrap: nowrap; gap: 24px; padding: 20px 28px; }
  .lp-hero { flex: 1 1 auto; max-width: none; }
  .lp-title { font-size: 28px; }
  .lp-subtitle { font-size: 13px; margin-bottom: 18px; }
  .lp-features { gap: 8px; margin-bottom: 16px; }
  .lp-feature-card { padding: 10px 14px; gap: 10px; }
  .lp-feature-icon { width: 22px; height: 22px; }
  .lp-feature-title { font-size: 13px; }
  .lp-feature-desc { font-size: 11px; }
  .lp-image-strip { gap: 8px; }
  .lp-strip-img { height: 80px; }
  .lp-login-panel { flex: 0 0 340px; }
  .lp-login-card { padding: 28px 24px; }
}

/* ── Small desktop / large tablet (1025px – 1366px) ────────────────────── */
@media (min-width: 1025px) and (max-width: 1366px) {
  .lp-main { gap: 40px; padding: 30px 36px; }
  .lp-title { font-size: 36px; }
  .lp-strip-img { height: 90px; }
}
