/**
 * KinGco Media authentication surfaces
 * Reimagined to mirror the provided inspiration while embracing our teal + gold brand palette.
 */

:root {
  --brand-primary: #26a795;
  --brand-primary-dark: #1f8577;
  --brand-accent: #d4a46a;
  --brand-bg: #f2f6f5;
  --brand-surface: #ffffff;
  --brand-muted: #56706d;
  --brand-text: #0b2524;
  --brand-border: rgba(24, 74, 66, 0.12);
  --brand-outline: rgba(38, 167, 149, 0.25);
  --brand-shadow-soft: 0 24px 48px rgba(14, 55, 49, 0.12);
  --brand-shadow-hero: 0 40px 90px rgba(4, 18, 23, 0.55);
  --shell-padding-x: clamp(14px, 3vw, 48px);
  --shell-padding-y: clamp(14px, 3vw, 48px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(120% 120% at 10% -10%, rgba(38, 167, 149, 0.18) 0%, transparent 55%),
              radial-gradient(140% 100% at 100% 0%, rgba(212, 164, 106, 0.22) 0%, transparent 62%),
              var(--brand-bg);
  color: var(--brand-text);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--shell-padding-y) var(--shell-padding-x);
  width: 100%;
}

.auth-card {
  display: flex;
  /* Subtract the shell gutter so the card never spills past the viewport on tighter widths. */
  width: min(1080px, calc(100% - (var(--shell-padding-x) * 2)));
  max-height: none;
  background: var(--brand-surface);
  border-radius: 28px;
  box-shadow: var(--brand-shadow-soft);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.auth-form-panel {
  flex: 1 1 50%;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 20px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.auth-logo {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  margin-bottom: 6px;
}

.auth-logo img {
  height: 60px;
  width: auto;
  margin: 0 auto;
}

.auth-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-muted);
}

.auth-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(38, 167, 149, 0.18), rgba(212, 164, 106, 0.28));
  color: var(--brand-primary);
  font-weight: 700;
  letter-spacing: 0;
}

.auth-brand-name {
  color: var(--brand-primary-dark);
}

.auth-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--brand-text);
}

.auth-header p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 420px;
}

.auth-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--brand-text);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--brand-muted);
  cursor: pointer;
  user-select: none;
}

.auth-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand-primary);
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-field label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--brand-text);
  letter-spacing: 0.02em;
}

.form-control {
  appearance: none;
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid var(--brand-border);
  background: var(--brand-surface);
  font-size: 0.98rem;
  color: var(--brand-text);
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-control::placeholder {
  color: rgba(11, 37, 36, 0.35);
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--brand-outline);
  outline: none;
}

.kc-password-wrap {
  position: relative;
}

.kc-password-wrap .form-control {
  padding-right: 52px;
}

.kc-password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: rgba(11, 37, 36, 0.5);
  padding: 4px;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
}

.kc-password-toggle .kc-eye-open {
  display: inline;
}

.kc-password-toggle .kc-eye-closed {
  display: none;
}

.kc-password-toggle.is-active .kc-eye-open {
  display: none;
}

.kc-password-toggle.is-active .kc-eye-closed {
  display: inline;
}

.kc-password-toggle:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 8px;
}

.lang-ar .kc-password-wrap .form-control {
  padding-right: 18px;
  padding-left: 52px;
}

.lang-ar .kc-password-toggle {
  right: auto;
  left: 12px;
}

.input-group {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.input-group-phone {
  gap: 0;
}

.input-group-phone .form-select {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-phone .form-control {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}

.form-select {
  appearance: none;
  width: 100%;
  height: 52px;
  padding: 0 36px 0 14px;
  border-radius: 16px;
  border: 1px solid var(--brand-border);
  background-color: var(--brand-surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--brand-muted) 50%), linear-gradient(135deg, var(--brand-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 24px, calc(100% - 12px) 24px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  font-size: 0.98rem;
  color: var(--brand-text);
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--brand-outline);
  outline: none;
}

.max-w-140 {
  max-width: 140px;
  flex: 0 0 140px;
}

.auth-alert {
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(212, 79, 79, 0.1);
  border: 1px solid rgba(212, 79, 79, 0.18);
  color: #b02a37;
  font-weight: 600;
  font-size: 0.95rem;
}

.auth-alert-success {
  background: rgba(38, 167, 149, 0.12);
  border-color: rgba(38, 167, 149, 0.24);
  color: #156a5e;
}

.auth-helper-text {
  margin: 0;
  color: var(--brand-muted);
  font-size: 0.92rem;
}

.auth-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  font-size: 0.92rem;
}

.auth-form-actions-start {
  justify-content: flex-start;
}

.auth-link {
  color: var(--brand-primary-dark);
  font-weight: 600;
}

.auth-link:hover,
.auth-link:focus-visible {
  color: var(--brand-primary);
  text-decoration: underline;
  outline: none;
}

.auth-button {
  border: 0;
  border-radius: 18px;
  height: 52px;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #26a795 0%, #1f8577 55%, #d4a46a 110%);
  box-shadow: 0 18px 36px rgba(31, 133, 119, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  cursor: pointer;
}

.auth-button:hover,
.auth-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(31, 133, 119, 0.28);
  filter: brightness(1.02);
  outline: none;
}

.auth-button-secondary {
  height: 44px;
  border-radius: 14px;
  background: #ffffff;
  color: var(--brand-primary-dark);
  border: 1px solid var(--brand-border);
  box-shadow: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-button-secondary:hover,
.auth-button-secondary:focus-visible {
  box-shadow: 0 10px 24px rgba(4, 18, 23, 0.08);
  transform: translateY(-1px);
  filter: none;
}

/* OAuth / social login button row */
.oauth-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--brand-muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  height: 1px;
  background: var(--brand-border);
  flex: 1 1 auto;
}

.oauth-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--brand-border);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-weight: 700;
  text-decoration: none;
  height: 48px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  width: 100%;
  justify-content: flex-start; /* icon on left, text aligned */
}

.oauth-button:hover,
.oauth-button:focus {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(4, 18, 23, 0.06);
  outline: none;
}

.oauth-button svg { width: 20px; height: 20px; display: block; flex: 0 0 20px; }

.oauth-button .oauth-text { display: inline-block; }

.oauth-google {
  border-color: rgba(0,0,0,0.06);
  background: #ffffff;
  color: #202124;
}

.oauth-google:hover { box-shadow: 0 8px 20px rgba(60,64,67,0.12); }

.auth-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--brand-muted);
}

.auth-footer .auth-link {
  font-weight: 700;
}

.auth-hero {
  flex: 1 1 50%;
  position: relative;
  background: radial-gradient(120% 120% at 10% -20%, rgba(38, 167, 149, 0.35) 0%, transparent 60%),
              linear-gradient(155deg, #0c2a35 0%, #071821 45%, #041118 100%);
  color: #f3fffd;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(38, 167, 149, 0.35) 0%, rgba(212, 164, 106, 0.28) 55%, rgba(12, 42, 53, 0.35) 100%);
  opacity: 0.75;
}

.auth-hero::after {
  content: "";
  position: absolute;
  top: -25%;
  right: -35%;
  width: 70%;
  height: 150%;
  background: rgba(255, 255, 255, 0.08);
  transform: skewX(-18deg);
  filter: blur(0.5px);
  opacity: 0.55;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(32px, 4vw, 62px);
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(38, 167, 149, 0.2);
  color: rgba(243, 255, 253, 0.92);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero-badge-icon {
  width: 1.1rem;
.oauth-button svg,
.oauth-button img {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 20px;
}
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-accent);
}

.hero-badge-icon path {
  fill: currentColor;
}

.auth-hero h2 {
  margin: 0;
  font-size: clamp(2.1rem, 3vw, 2.7rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.auth-hero p {
  margin: 0;
  max-width: 360px;
  color: rgba(243, 255, 253, 0.8);
  line-height: 1.6;
  font-size: 1rem;
}

.hero-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.98rem;
  color: rgba(243, 255, 253, 0.88);
}

.hero-points i {
  margin-top: 3px;
  color: var(--brand-accent);
  font-size: 0.95rem;
}

.hero-visual {
  margin-top: auto;
}

.hero-visual img {
  max-width: 350px;
  width: 100%;
  filter: drop-shadow(0 30px 60px rgba(4, 18, 23, 0.45));
}

/* Bottom-left social icons inside the hero */
.auth-hero-social {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 12px;
  z-index: 2; /* above hero overlays */
}

.auth-hero-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}

.auth-hero-social a:hover,
.auth-hero-social a:focus {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.auth-hero-social svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

@media (max-width: 1100px) {
  .auth-card {
    border-radius: 28px;
  }
}

@media (max-width: 992px) {
  .auth-card {
    flex-direction: column;
    max-width: 640px;
    max-height: none;
    height: auto;
    overflow: visible;
  }

  .auth-form-panel {
    padding: clamp(30px, 6vw, 52px);
  }

  .auth-hero {
    order: -1;
    min-height: 300px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .hero-inner {
    padding: clamp(30px, 7vw, 52px);
    text-align: center;
    align-items: center;
    gap: 16px;
  }

  .auth-hero p,
  .hero-points li {
    max-width: 520px;
  }

  .hero-visual {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    --shell-padding-x: 16px;
    --shell-padding-y: 18px;
    /* Center horizontally on small screens so the card doesn't hug the left edge */
    justify-content: center;
  }

  .auth-card {
    /* Ensure the card is centered and doesn't exceed the viewport on small devices */
    margin: 0 auto;
    width: 100%;
    max-width: 540px;
    border-radius: 24px;
  }

  /* Slightly round form inputs on mobile for a softer look */
  .form-control {
    border-radius: 20px;
  }

  .auth-form-panel {
    padding: 28px 22px 32px;
  }

  .auth-header h1 {
    font-size: 2.15rem;
  }

  .auth-form {
    gap: 16px;
  }

  .auth-form-actions {
    justify-content: flex-start;
  }

  .auth-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  body {
    background: var(--brand-bg);
  }

  .auth-shell {
    --shell-padding-x: 12px;
    --shell-padding-y: 16px;
    /* Keep the card comfortably centered vertically as well on very small devices */
    align-items: center;
  }

  .auth-card {
    /* Explicit mobile-safe sizing to avoid overflow/left-hug issues */
    margin: 12px auto;
    width: 100%;
    max-width: 520px;
    border-radius: 20px;
  }

  /* Ensure inputs are also rounded on the smallest screens */
  .form-control {
    border-radius: 20px;
  }

  .auth-header p {
    font-size: 0.95rem;
  }

  .auth-button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .auth-hero {
    display: none;
  }

  .auth-shell {
    min-height: auto;
  }

  .auth-card {
    box-shadow: none;
    border-radius: 18px;
  }

  .auth-form-panel {
    padding: 26px 20px 32px;
  }
}

/* Strong mobile override: ensure the auth card is centered and rounded on small devices.
   This lives at the end of the file so it wins over any earlier rules or cached bundles. */
@media (max-width: 768px) {
  .auth-shell {
    justify-content: center !important;
    align-items: center !important;
  }

  .auth-card {
    margin: 12px auto !important;
    width: 100% !important;
    max-width: 560px !important;
    border-radius: 20px !important;
    /* Keep children clipped so the rounded corners are visible */
    overflow: hidden !important;
  }

  .form-control,
  .auth-button {
    border-radius: 18px !important;
  }
}
