/* =====================================================================
 * KS-AUTH-V1 — Auth pages polish (2026-05-13)
 *
 * Targets:
 *   body#authentication        — /logowanie  (login)
 *   body#registration          — /rejestracja (register)
 *   body#password              — /haslo (password reset)
 *
 * Issues fixed (from audit):
 *   - P0 inputs floating inside dark-blue containers (label contrast + tap)
 *   - P1 nested heavy-blue panel inside the white card
 *   - P1 clunky "POKAŻ" toggle overlapping the password field
 *   - P3 login CTA not full-width on mobile
 *   - P3 noise — simplify header on auth pages
 *
 * Strategy: unified white card, full-width Stripe-style inputs, eye icon
 * inside the password field, orange CTA matching the rest of the site.
 * ===================================================================== */

body#authentication,
body#registration,
body#password {
  --ks-primary: #f97316;
  --ks-primary-hover: #ea580c;
  --ks-border: #e2e8f0;
  --ks-border-strong: #cbd5e1;
  --ks-text: #0f172a;
  --ks-text-secondary: #334155;
  --ks-text-muted: #64748b;
  --ks-bg-soft: #f8fafc;
  background: var(--ks-bg-soft);
}

/* =============================================================
 * KILL the dark-navy outer card painted by PS classic theme
 *
 * Element chain: body > main > section#wrapper > .container > .row >
 * #content-wrapper > section#main > #content.page-content.card.card-block
 * > section.login-form > form#login-form > .form-group.row > ...
 *
 * The PS classic `.card.card-block` class plus theme overrides paint
 * the wrapper dark. Force transparent at every level except form#login-form
 * which is the actual white card we want.
 * ============================================================= */
body#authentication #wrapper,
body#authentication #content-wrapper,
body#authentication #main,
body#authentication #content.page-content,
body#authentication #content.card,
body#authentication #content.card-block,
body#authentication .page-content,
body#authentication .card-block,
body#authentication section.login-form,
body#registration #wrapper,
body#registration #content-wrapper,
body#registration #main,
body#registration #content.page-content,
body#registration #content.card,
body#registration #content.card-block,
body#registration .page-content,
body#registration .card-block,
body#registration section.register-form,
body#password #wrapper,
body#password #content-wrapper,
body#password #main,
body#password #content.page-content,
body#password #content.card,
body#password #content.card-block,
body#password .page-content,
body#password .card-block {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* =============================================================
 * PAGE SHELL
 * ============================================================= */
body#authentication #main,
body#registration #main,
body#password #main {
  max-width: 440px;
  margin: 40px auto 64px;
  padding: 0 16px;
}

body#authentication #content-wrapper,
body#registration #content-wrapper,
body#password #content-wrapper {
  background: transparent !important;
}

/* Hide noise on auth pages */
body#authentication .breadcrumb,
body#registration .breadcrumb,
body#password .breadcrumb,
body#authentication .ks-trust-strip,
body#registration .ks-trust-strip,
body#password .ks-trust-strip {
  display: none !important;
}

/* =============================================================
 * AUTH CARD — single unified white card
 * ============================================================= */
body#authentication .login-form,
body#registration .register-form,
body#password .send-renew-password-link,
body#authentication #login-form,
body#registration #customer-form,
body#password .forgotten-password,
body#authentication form,
body#registration form,
body#password form {
  background: #fff;
  border: 1px solid var(--ks-border);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  margin: 0;
}

/* =============================================================
 * HEADER — clean title + subtitle
 * ============================================================= */
body#authentication h1.h1,
body#registration h1.h1,
body#password h1.h1,
body#authentication .page-header h1,
body#registration .page-header h1,
body#password .page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--ks-text);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  text-align: center;
}
body#authentication .page-header,
body#registration .page-header,
body#password .page-header {
  margin-bottom: 24px;
}

/* Tagline / subtitle */
body#authentication .page-header + p,
body#registration .page-header + p,
body#password .page-header + p {
  text-align: center;
  color: var(--ks-text-muted);
  font-size: 14px;
  margin: 0 0 16px;
}

/* =============================================================
 * FORM FIELDS — Stripe-style inputs
 *
 * The audit flagged: input was a tiny white box inside a dark-blue
 * container. Reset that — paint the WHOLE form-group as plain
 * background, label above the input, full-width 48px field.
 * ============================================================= */
body#authentication .form-group,
body#registration .form-group,
body#password .form-group {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 0 16px !important;
  box-shadow: none !important;
  display: block !important;
}

/* Bootstrap col-md-* inside the form-group must collapse to full-width
 * on all viewports — PS classic keeps them as 3/6/3 columns at desktop
 * which truncates the input. Force 100% across the board. */
body#authentication .form-group .col-md-3,
body#authentication .form-group .col-md-6,
body#authentication .form-group .form-control-label,
body#authentication .form-group .js-input-column,
body#authentication .form-group .form-control-comment,
body#registration .form-group .col-md-3,
body#registration .form-group .col-md-6,
body#registration .form-group .form-control-label,
body#registration .form-group .js-input-column,
body#registration .form-group .form-control-comment,
body#password .form-group .col-md-3,
body#password .form-group .col-md-6,
body#password .form-group .form-control-label,
body#password .form-group .js-input-column,
body#password .form-group .form-control-comment {
  flex: none !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}
body#authentication .form-group .form-control-comment:empty,
body#registration .form-group .form-control-comment:empty,
body#password .form-group .form-control-comment:empty {
  display: none !important;
}

body#authentication label,
body#registration label,
body#password label,
body#authentication .form-control-label,
body#registration .form-control-label,
body#password .form-control-label {
  display: block !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--ks-text-secondary) !important;
  margin: 0 0 6px !important;
  text-align: left !important;
  background: transparent !important;
  letter-spacing: 0.005em;
}

body#authentication input.form-control,
body#authentication input[type="text"],
body#authentication input[type="email"],
body#authentication input[type="password"],
body#authentication input[type="tel"],
body#authentication input[type="search"],
body#authentication input[type="number"],
body#authentication select.form-control,
body#authentication select,
body#registration input.form-control,
body#registration input[type="text"],
body#registration input[type="email"],
body#registration input[type="password"],
body#registration input[type="tel"],
body#registration input[type="search"],
body#registration input[type="number"],
body#registration select.form-control,
body#registration select,
body#password input.form-control,
body#password input[type="text"],
body#password input[type="email"],
body#password input[type="password"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 48px !important;
  padding: 13px 14px !important;
  border: 1.5px solid var(--ks-border-strong) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--ks-text) !important;
  font-family: inherit !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
  box-shadow: none !important;
  margin: 0 !important;
  flex: 1 1 auto !important;
  display: block !important;
}

body#authentication input:hover:not(:focus):not([aria-invalid="true"]),
body#registration input:hover:not(:focus):not([aria-invalid="true"]),
body#password input:hover:not(:focus):not([aria-invalid="true"]) {
  border-color: var(--ks-text-muted) !important;
}
body#authentication input:focus,
body#registration input:focus,
body#password input:focus,
body#authentication select:focus,
body#registration select:focus {
  border-color: var(--ks-primary) !important;
  outline: 0 !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16) !important;
}
body#authentication input[aria-invalid="true"],
body#registration input[aria-invalid="true"],
body#password input[aria-invalid="true"] {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10) !important;
}

/* Form error messages under fields */
body#authentication .form-control-comment,
body#registration .form-control-comment,
body#authentication .help-block,
body#registration .help-block {
  font-size: 12.5px !important;
  color: var(--ks-text-muted) !important;
  margin-top: 4px !important;
  padding: 0 !important;
  background: transparent !important;
}

/* =============================================================
 * PASSWORD FIELD — eye toggle styled cleanly
 *
 * PS classic injects a span/button after the password input as a
 * "show password" toggle. Style as a borderless icon button positioned
 * absolutely on the right of the input.
 * ============================================================= */
body#authentication .form-group:has(input[type="password"]),
body#registration .form-group:has(input[type="password"]) {
  position: relative;
}

body#authentication .input-group:has(input[type="password"]),
body#registration .input-group:has(input[type="password"]) {
  position: relative;
  display: block;
}

body#authentication input[type="password"],
body#registration input[type="password"] {
  padding-right: 80px !important;
}

/* The .input-group wrapper around password input + show-toggle.
 * Force flex layout so the password input fills available width minus
 * the toggle button width. */
body#authentication .input-group.js-parent-focus,
body#registration .input-group.js-parent-focus {
  display: flex !important;
  position: relative !important;
  width: 100% !important;
  align-items: stretch;
}
body#authentication .input-group.js-parent-focus > input.form-control,
body#registration .input-group.js-parent-focus > input.form-control {
  flex: 1 1 auto !important;
  width: auto !important;
  padding-right: 64px !important;
  border-radius: 8px !important;
}

/* Show-password toggle — POSITION INSIDE the input as a discrete icon */
body#authentication .input-group-btn,
body#authentication span.input-group-btn,
body#registration .input-group-btn,
body#registration span.input-group-btn {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 56px !important;
  height: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  z-index: 2 !important;
}
body#authentication .input-group-btn > button[data-action="show-password"],
body#authentication button[data-action="show-password"],
body#registration .input-group-btn > button[data-action="show-password"],
body#registration button[data-action="show-password"] {
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  color: var(--ks-text-muted) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  border-radius: 0 8px 8px 0 !important;
  transition: background 0.15s, color 0.15s !important;
}
body#authentication button[data-action="show-password"]:hover,
body#registration button[data-action="show-password"]:hover {
  background: rgba(249, 115, 22, 0.08) !important;
  color: var(--ks-primary) !important;
}

/* =============================================================
 * PRIMARY CTA — orange, full-width
 * ============================================================= */
body#authentication form .form-control-submit,
body#registration form .form-control-submit,
body#password form .form-control-submit,
body#authentication form button[type="submit"],
body#registration form button[type="submit"],
body#password form button[type="submit"],
body#authentication form input[type="submit"],
body#registration form input[type="submit"],
body#password form input[type="submit"],
body#authentication form .btn-primary,
body#registration form .btn-primary,
body#password form .btn-primary,
body#authentication form button.btn,
body#registration form button.btn,
body#password form button.btn {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 48px !important;
  background: var(--ks-primary) !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-size: 15.5px !important;
  font-weight: 600 !important;
  padding: 0 16px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35), 0 2px 4px rgba(234, 88, 12, 0.18) !important;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s !important;
  margin-top: 8px !important;
  cursor: pointer !important;
}
/* The show-password button is INSIDE form — exclude it from the rule */
body#authentication form button[data-action="show-password"],
body#registration form button[data-action="show-password"] {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--ks-text-muted) !important;
  border-radius: 0 8px 8px 0 !important;
  margin: 0 !important;
}
body#authentication .btn-primary:hover,
body#registration .btn-primary:hover,
body#password .btn-primary:hover,
body#authentication button[type="submit"].btn:hover {
  background: var(--ks-primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.45) !important;
}

/* =============================================================
 * REMEMBER ME / CONSENT CHECKBOX
 * ============================================================= */
body#authentication input[type="checkbox"],
body#registration input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  border: 1.5px solid var(--ks-border-strong) !important;
  border-radius: 4px !important;
  background: #fff !important;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin: 0 8px 0 0 !important;
  flex-shrink: 0;
}
body#authentication input[type="checkbox"]:checked,
body#registration input[type="checkbox"]:checked {
  background: var(--ks-primary) !important;
  border-color: var(--ks-primary) !important;
}
body#authentication input[type="checkbox"]:checked::after,
body#registration input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
body#authentication .form-control-comment,
body#registration .form-control-comment {
  display: flex;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ks-text-secondary);
  margin: 12px 0;
}

/* =============================================================
 * BOTTOM LINKS — forgot password / register
 * ============================================================= */
body#authentication .form-footer,
body#registration .form-footer,
body#password .form-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ks-border);
  text-align: center;
}
body#authentication .lost_password,
body#authentication .forgot-password,
body#registration .lost_password,
body#authentication .login-form a,
body#registration .login-form a {
  color: var(--ks-text-secondary);
  font-size: 13.5px;
  text-decoration: none;
  font-weight: 500;
}
body#authentication .lost_password a:hover,
body#authentication .login-form a:hover {
  color: var(--ks-primary);
  text-decoration: underline;
}

/* Register-section link below login card */
body#authentication .no-account,
body#authentication #content-wrapper p:last-child:has(> a) {
  margin-top: 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ks-text-muted);
}
body#authentication .no-account a {
  color: var(--ks-primary);
  font-weight: 600;
  text-decoration: none;
}
body#authentication .no-account a:hover { text-decoration: underline; }

/* =============================================================
 * REGISTER PAGE — multi-section form (personal / address)
 * ============================================================= */
body#registration .register-section-title,
body#registration h2,
body#registration h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ks-text);
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--ks-border);
  letter-spacing: -0.005em;
}
body#registration h2:first-of-type,
body#registration h3:first-of-type,
body#registration .register-section-title:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

/* =============================================================
 * RESPONSIVE — desktop two-column for register
 * ============================================================= */
@media (min-width: 768px) {
  body#registration #main {
    max-width: 600px;
  }
  body#registration .form-group.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  body#authentication #main,
  body#registration #main,
  body#password #main {
    margin: 16px auto 32px;
  }
  body#authentication .login-form,
  body#registration .register-form,
  body#password .send-renew-password-link,
  body#authentication form,
  body#registration form,
  body#password form {
    padding: 20px 16px;
    border-radius: 12px;
  }
}

/* =============================================================
 * SUCCESS / ERROR ALERTS
 * ============================================================= */
body#authentication .alert,
body#registration .alert,
body#password .alert {
  background: #fff !important;
  border: 1px solid var(--ks-border) !important;
  border-left: 4px solid #16a34a !important;
  color: var(--ks-text) !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
  margin: 0 0 16px !important;
  font-size: 14px !important;
}
body#authentication .alert-danger,
body#registration .alert-danger,
body#password .alert-danger {
  border-left-color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.03) !important;
}
body#authentication .alert ul,
body#registration .alert ul,
body#password .alert ul {
  margin: 0;
  padding-left: 18px;
}
