/* ==========================================
   auth-hub.css — Symmetrical Premium Auth
   Coldwell Banker CRM | 2026
   ========================================== */

/* ---------- Keyframes ---------- */
@keyframes authFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes authSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

@keyframes authShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes authPulse {
  0%, 100% { opacity: 0.06; transform: scale(1); }
  50%      { opacity: 0.12; transform: scale(1.04); }
}

@keyframes authCheckmark {
  0%   { stroke-dashoffset: 24; }
  100% { stroke-dashoffset: 0; }
}

@keyframes authBorderGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 60, 136, 0.06); }
  50%      { box-shadow: 0 0 0 6px rgba(31, 60, 136, 0.04); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- View Transitions ---------- */
@view-transition {
  navigation: auto;
}

::view-transition-group(auth-card) {
  animation-duration: 0.25s;
  animation-timing-function: ease-out;
}

/* ---------- Body ---------- */
.auth-hub-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, #f7f5f1 0%, #efebe5 50%, #e8e3db 100%);
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Ambient glow */
.auth-hub-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 10% 20%, rgba(31, 60, 136, 0.035) 0%, transparent 55%),
    radial-gradient(ellipse 45% 40% at 90% 80%, rgba(201, 168, 76, 0.035) 0%, transparent 55%);
  pointer-events: none;
}

/* ---------- Container ---------- */
.auth-hub {
  width: min(100% - 32px, 440px);
  margin: 20px auto;
  view-transition-name: auth-card;
}

/* ---------- Logo ---------- */
.auth-hub__logo-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.auth-hub__logo {
  width: 164px;
  max-width: 164px;
  height: auto;
  display: inline-block;
}

/* ---------- Accent bar ---------- */
.auth-hub__accent-bar {
  width: 44px;
  height: 3px;
  margin: 0 auto 22px;
  border-radius: 2px;
  background: linear-gradient(90deg, #c9a84c, #e6d6a0, #c9a84c);
  animation: authFadeIn 0.4s ease-out both;
}

/* ---------- Card ---------- */
.auth-hub__card {
  padding: 36px 32px 32px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 8px 24px rgba(31, 60, 136, 0.06),
    0 24px 48px rgba(31, 60, 136, 0.03);
  animation: authSlideUp 0.4s ease-out both;
}

/* ---------- Tabs ---------- */
.auth-hub__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: 10px;
  background: #f3f1ee;
}

.auth-hub__tab {
  padding: 10px 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.auth-hub__tab:hover {
  color: #1f3c88;
  background: rgba(31, 60, 136, 0.04);
}

.auth-hub__tab.is-active {
  color: #ffffff;
  background: #1f3c88;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(31, 60, 136, 0.15);
}

.auth-hub__tab:focus-visible {
  outline: 2px solid #1f3c88;
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.auth-hub__header {
  margin-bottom: 22px;
}

.auth-hub__header-label {
  display: inline-block;
  margin-bottom: 6px;
  color: #1f3c88;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-hub__header h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.2;
}

.auth-hub__header p {
  margin: 0;
  color: #64748b;
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ---------- Form pane (show/hide) ---------- */
.auth-hub__form-pane {
  display: none;
}

.auth-hub__form-pane.is-visible {
  display: block;
  animation: authSlideDown 0.25s ease-out both;
}

/* ---------- Alerts ---------- */
.auth-hub__alert {
  margin-bottom: 20px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.5;
  animation: authShake 0.3s ease-out;
}

.auth-hub__alert i {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 1rem;
}

.auth-hub__alert--error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.auth-hub__alert--success {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

/* ---------- Form ---------- */
.auth-hub__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-hub__form-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fafbfc;
}

.auth-hub__form-section:focus-within {
  border-color: rgba(31, 60, 136, 0.18);
  background: #f8fafc;
}

.auth-hub__section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.auth-hub__section-title i {
  color: #1f3c88;
  font-size: 0.88rem;
}

.auth-hub__grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---------- Fields ---------- */
.auth-hub__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-hub__field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  transition: color 0.2s;
}

.auth-hub__field:focus-within label {
  color: #1f3c88;
}

.auth-hub__field label .req {
  color: #dc2626;
  font-weight: 600;
}

/* ---------- Input ---------- */
.auth-hub__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-hub__input-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s;
  font-size: 0.95rem;
}

.auth-hub__input-wrap:focus-within > i {
  color: #1f3c88;
}

.auth-hub__input-wrap input,
.auth-hub__input-wrap select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.9rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: all 0.2s ease;
  outline: none;
}

.auth-hub__input-wrap input::placeholder {
  color: #94a3b8;
}

.auth-hub__input-wrap input:hover {
  border-color: #cbd5e1;
}

.auth-hub__input-wrap input:focus {
  border-color: #1f3c88;
  box-shadow: 0 0 0 4px rgba(31, 60, 136, 0.07);
  background: #fafcff;
}

.auth-hub__input-wrap input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px #ffffff inset;
  -webkit-text-fill-color: #0f172a;
  border-color: #c7d2fe;
}

.auth-hub__input-wrap input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #ffffff inset, 0 0 0 4px rgba(31, 60, 136, 0.07);
  border-color: #1f3c88;
}

/* Password field */
.auth-hub__input-wrap.auth-hub__password input {
  padding-right: 48px;
}

.auth-hub__password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-hub__password-toggle:hover {
  color: #1f3c88;
  background: rgba(31, 60, 136, 0.04);
}

.auth-hub__password-toggle:active {
  transform: translateY(-50%) scale(0.92);
}

/* Help text */
.auth-hub__help {
  margin: 2px 0 0;
  color: #94a3b8;
  font-size: 0.75rem;
  line-height: 1.4;
}

.auth-hub__field:focus-within .auth-hub__help {
  color: #64748b;
}

/* ---------- Row ---------- */
.auth-hub__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Checkbox ---------- */
.auth-hub__check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 0.84rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.auth-hub__check:hover {
  color: #1e293b;
}

.auth-hub__check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  accent-color: #1f3c88;
  cursor: pointer;
  flex-shrink: 0;
}

.auth-hub__check--box {
  padding: 14px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  transition: border-color 0.2s, background 0.2s;
}

.auth-hub__check--box:hover {
  border-color: #cbd5e1;
}

.auth-hub__check--box:has(input:checked) {
  border-color: rgba(31, 60, 136, 0.25);
  background: rgba(31, 60, 136, 0.02);
}

/* ---------- KVKK collapsible ---------- */
.auth-hub__kvkk-details {
  margin-bottom: 12px;
}

.auth-hub__kvkk-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f3c88;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  transition: border-color 0.2s, background 0.2s;
  list-style: none;
}

.auth-hub__kvkk-summary::-webkit-details-marker {
  display: none;
}

.auth-hub__kvkk-summary:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.auth-hub__kvkk-details[open] .auth-hub__kvkk-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.auth-hub__kvkk-details[open] .auth-hub__kvkk-summary i {
  transform: rotate(90deg);
}

.auth-hub__kvkk-summary i {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.auth-hub__kvkk-text {
  font-size: 0.8rem;
  color: #64748b;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  padding: 14px 16px;
  line-height: 1.55;
}

.auth-hub__kvkk-text p {
  margin: 0;
}

.auth-hub__kvkk-text strong {
  color: #334155;
}

.auth-hub__form-section .auth-hub__check--box {
  margin-bottom: 8px;
}

/* ---------- Links ---------- */
.auth-hub__link {
  color: #1f3c88;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.auth-hub__link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: currentColor;
  transition: width 0.2s ease;
}

.auth-hub__link:hover {
  color: #17336f;
}

.auth-hub__link:hover::after {
  width: 100%;
}

.auth-hub__link:focus-visible {
  outline: 2px solid #1f3c88;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Submit button ---------- */
.auth-hub__submit {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: #1f3c88;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease,
    background 0.2s ease;
  box-shadow: 0 4px 16px rgba(31, 60, 136, 0.18);
}

.auth-hub__submit:hover {
  background: #17336f;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(31, 60, 136, 0.25);
}

.auth-hub__submit:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(31, 60, 136, 0.12);
}

.auth-hub__submit i {
  font-size: 1rem;
}

/* Loading state */
.auth-hub__submit.is-loading {
  pointer-events: none;
  color: transparent;
}

.auth-hub__submit.is-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
}

/* ---------- Password strength ---------- */
.auth-hub__strength {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.auth-hub__strength span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.3s ease, background 0.3s ease;
}

/* ---------- Switch (bottom links) ---------- */
.auth-hub__switch {
  margin-top: 16px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.84rem;
}

.auth-hub__switch .auth-hub__link {
  font-size: 0.84rem;
}

/* ---------- Footer ---------- */
.auth-hub__footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
}

/* ---------- Success states ---------- */
.auth-hub__success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
  font-size: 1.5rem;
  animation: authPulse 2s ease-in-out infinite;
}

.auth-hub__success-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #059669;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-hub__success-icon svg polyline {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: authCheckmark 0.4s ease-out 0.2s forwards;
}

.auth-hub__center-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.auth-hub__center-actions .auth-hub__submit {
  min-height: 44px;
  font-size: 0.88rem;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .auth-hub__card {
    padding: 28px 20px 24px;
    border-radius: 12px;
  }

  .auth-hub__logo {
    width: 134px;
    max-width: 134px;
  }

  .auth-hub__logo-wrap {
    margin-bottom: 18px;
  }

  .auth-hub__header h2 {
    font-size: 1.25rem;
  }

  .auth-hub__submit {
    min-height: 46px;
    font-size: 0.9rem;
  }

  .auth-hub__grid-2 {
    grid-template-columns: 1fr;
  }

  .auth-hub__tabs {
    gap: 3px;
    padding: 3px;
  }

  .auth-hub__tab {
    font-size: 0.78rem;
    padding: 8px 4px;
  }
}

/* ---------- Container query (cutting-edge) ---------- */
@container auth-card (max-width: 400px) {
  .auth-hub__card {
    padding: 24px 16px 20px;
  }

  .auth-hub__grid-2 {
    grid-template-columns: 1fr;
  }
}
