/* ═══════════════════════════════════════════════════════════════
   CST Login Branding — Custom dark split-screen login page
   All selectors are scoped under .cst-login-page to avoid
   leaking into frappe's existing styles.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset: take over the full viewport ─── */
.cst-login-page {
  position: fixed;
  inset: 0;
  z-index: 10;        /* above frappe body bg; below its modals (z 1050+) */
  display: flex;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
}

/* ═══════════════════════════════════════════
   LEFT PANEL — dark navy, grid, branding
   ═══════════════════════════════════════════ */
.cst-left-panel {
  width: 55%;
  flex-shrink: 0;
  background-color: #0a1628;
  /* Subtle grid pattern */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  overflow: hidden;
  position: relative;
}

/* Gradient glow at bottom of left panel for depth */
.cst-left-panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to top, rgba(37, 99, 235, 0.08), transparent);
  pointer-events: none;
}

.cst-left-inner {
  max-width: 480px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Brand block */
.cst-brand-block {
  margin-bottom: 56px;
}

.cst-logo-tile {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  overflow: hidden;
}

.cst-brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.cst-logo-fallback {
  font-size: 32px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1;
}

.cst-company-name {
  font-size: 32px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 0 0 12px 0;
}

.cst-tagline {
  font-size: 15px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.5;
}

/* Feature rows */
.cst-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cst-feature {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cst-feature-icon {
  width: 40px;
  height: 40px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #60a5fa;
}

.cst-feature span {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.4;
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   RIGHT PANEL — near-black, centered form
   ═══════════════════════════════════════════ */
.cst-right-panel {
  flex: 1;
  min-width: 0;
  background-color: #0d1117;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 48px 24px;
}

.cst-form-wrap {
  width: 100%;
  max-width: 420px;
}

/* Mobile compact header (hidden by default, shown <768px) */
.cst-mobile-header {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  justify-content: center;
}
.cst-mobile-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.cst-mobile-app-name {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
}

/* Right panel brand strip (logo + site name + domain) */
.cst-right-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}
.cst-right-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}
.cst-right-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cst-right-app-name {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.2;
}
.cst-right-domain {
  font-size: 11px;
  color: #64748b;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.2;
}

/* ─── Section head ─── */
.cst-section-head {
  margin-bottom: 28px;
}
.cst-welcome {
  font-size: 26px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 6px 0;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.cst-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* ─── Form card — override frappe .login-content.page-card ─── */
.cst-login-page .login-content.page-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* ─── page-card-body (frappe error class target) ─── */
.cst-login-page .page-card-body {
  padding: 0 !important;
  margin-bottom: 4px;
}
.cst-login-page .page-card-body.invalid .cst-input {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* ─── Invalid-login shake animation ─── */
@keyframes cst-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.cst-login-page .login-content.page-card.invalid-login {
  animation: cst-shake 0.4s ease;
}

/* ─── Fields ─── */
.cst-field {
  margin-bottom: 16px;
}
.cst-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8 !important;
  margin-bottom: 6px;
  line-height: 1;
}

.cst-input,
.cst-login-page .form-control {
  background-color: #1a2233 !important;
  border: 1px solid #2d3748 !important;
  border-radius: 8px !important;
  color: #e2e8f0 !important;
  font-size: 15px !important;
  height: 48px !important;
  padding: 0 14px !important;
  width: 100% !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  box-shadow: none !important;
  -webkit-appearance: none;
}
.cst-input::placeholder,
.cst-login-page .form-control::placeholder {
  color: #475569 !important;
}
.cst-input:focus,
.cst-login-page .form-control:focus {
  outline: none !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
  background-color: #1e2a40 !important;
}

/* Password field wrapper */
.cst-field-password .cst-password-wrap {
  position: relative;
}
.cst-toggle-pw,
.cst-login-page .toggle-password {
  position: absolute !important;
  right: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: 12px !important;
  color: #64748b !important;
  cursor: pointer !important;
  user-select: none !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  line-height: 1 !important;
}
.cst-toggle-pw:hover,
.cst-login-page .toggle-password:hover {
  color: #94a3b8 !important;
}

/* Forgot password row */
.cst-forgot-row {
  text-align: right;
  margin-top: -4px;
  margin-bottom: 8px;
}

/* ─── Links ─── */
.cst-link,
.cst-login-page a.cst-link {
  color: #3b82f6 !important;
  text-decoration: none !important;
  font-size: 13px;
}
.cst-link:hover {
  color: #60a5fa !important;
  text-decoration: underline !important;
}

/* ─── Action area ─── */
.cst-actions,
.cst-login-page .page-card-actions {
  padding: 0 !important;
  margin-top: 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

/* Primary button */
.cst-btn-primary,
.cst-login-page .btn-primary.btn-login,
.cst-login-page .btn-primary.btn-forgot,
.cst-login-page .btn-primary.btn-login-with-email-link {
  background-color: #2563eb !important;
  border: none !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  height: 48px !important;
  min-height: 48px !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background-color 0.15s ease, transform 0.1s ease !important;
  letter-spacing: 0.01em !important;
  padding: 0 20px !important;
}
.cst-btn-primary:hover,
.cst-login-page .btn-primary.btn-login:hover,
.cst-login-page .btn-primary.btn-forgot:hover,
.cst-login-page .btn-primary.btn-login-with-email-link:hover {
  background-color: #1d4ed8 !important;
  color: #fff !important;
}
.cst-btn-primary:active {
  transform: scale(0.99) !important;
}

/* Secondary / LDAP button */
.cst-btn-secondary,
.cst-login-page .btn-default.btn-ldap-login {
  background-color: #1a2233 !important;
  border: 1px solid #2d3748 !important;
  border-radius: 8px !important;
  color: #94a3b8 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  height: 44px !important;
  min-height: 44px !important;
  width: 100% !important;
  cursor: pointer !important;
}
.cst-btn-secondary:hover {
  background-color: #1e2a40 !important;
  color: #e2e8f0 !important;
  border-color: #3d5068 !important;
}

/* Social login buttons */
.cst-social {
  margin-top: 12px;
}
.cst-or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #374151;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cst-or-divider::before,
.cst-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #1e293b;
}
.cst-or-divider span {
  color: #4b5563;
}

.cst-btn-social,
.cst-login-page .btn-login-option {
  background-color: #1a2233 !important;
  border: 1px solid #2d3748 !important;
  border-radius: 8px !important;
  color: #94a3b8 !important;
  height: 44px !important;
  font-size: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: background-color 0.15s ease !important;
  margin-bottom: 8px;
}
.cst-btn-social:hover {
  background-color: #1e2a40 !important;
  color: #e2e8f0 !important;
  border-color: #3d5068 !important;
}

/* Support & nav links below form */
.cst-support {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: #475569;
}
.cst-signup-msg {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: #475569;
}
.cst-back-link {
  text-align: center;
  margin-top: 8px;
}
.cst-signup-disabled {
  color: #64748b;
  font-size: 14px;
  padding: 8px 0;
}

/* ─── 2FA / OTP area inherits correct colors ─── */
.cst-login-page #twofactor_div .form-control,
.cst-login-page #login_token {
  background-color: #1a2233 !important;
  border: 1px solid #2d3748 !important;
  border-radius: 8px !important;
  color: #e2e8f0 !important;
  height: 48px !important;
  padding: 0 14px !important;
}
.cst-login-page #twofactor_div .btn-primary,
.cst-login-page #verify_token {
  background-color: #2563eb !important;
  border: none !important;
  border-radius: 8px !important;
  color: #fff !important;
  height: 48px !important;
  width: 100% !important;
  font-weight: 600 !important;
  margin-top: 16px !important;
}
.cst-login-page .text-muted {
  color: #64748b !important;
}
.cst-login-page .indicator {
  color: #60a5fa !important;
}

/* ─── Frappe msgprint / indicator overrides ─── */
.cst-login-page .page-card-head {
  margin-bottom: 16px;
}

/* ════════════════════════════════════════════════
   RESPONSIVE — Tablet: 768px–1023px
   ════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  .cst-left-panel {
    width: 40%;
    padding: 40px 32px;
  }
  /* Hide feature list on tablet to keep layout clean */
  .cst-features {
    display: none;
  }
  .cst-company-name {
    font-size: 26px;
  }
  .cst-right-panel {
    padding: 40px 20px;
  }
}

/* ════════════════════════════════════════════════
   RESPONSIVE — Mobile: < 768px
   ════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .cst-login-page {
    flex-direction: column;
    overflow-y: auto;
  }

  /* Hide left panel completely */
  .cst-left-panel {
    display: none !important;
  }

  /* Show mobile compact header */
  .cst-mobile-header {
    display: flex;
  }

  .cst-right-panel {
    flex: 1;
    width: 100%;
    padding: 24px 16px 40px;
    justify-content: flex-start;
    overflow-y: visible;
  }

  .cst-form-wrap {
    max-width: 100%;
  }

  /* Hide the right-panel brand strip on mobile (mobile header replaces it) */
  .cst-right-brand {
    display: none;
  }

  .cst-welcome {
    font-size: 22px;
  }

  .cst-input,
  .cst-login-page .form-control {
    height: 52px !important;  /* taller for touch */
    font-size: 16px !important; /* prevent iOS zoom */
  }

  .cst-btn-primary,
  .cst-login-page .btn-primary.btn-login,
  .cst-login-page .btn-primary.btn-forgot,
  .cst-login-page .btn-primary.btn-login-with-email-link {
    height: 52px !important;
    min-height: 52px !important;
    font-size: 16px !important;
  }
}

/* ─── Copyright footer ─── */
.cst-copyright {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  margin-top: 32px;
  letter-spacing: 0.2px;
  user-select: none;
}
