/* ══════════════════════════════════════════════════════
   auth.css  — DistribuLink Login & Register Pages
   ✔ Multi-step layout logic added
   ✔ Grid conflicts resolved
   ✔ Select drop/phone fixes (Plugin Class Inheritance & Wrapper sizing fixed)
══════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   PAGE BASE & WRAPPERS
─────────────────────────────────────────── */
.auth-page { background: #f4f6fa; }

.auth-main {
  padding: 28px 0 40px;
  min-height: calc(100vh - 360px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.auth-wrap {
  display: grid;
  grid-template-columns: 480px 1fr;
  min-height: 600px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 22px;
  align-items: start;
  box-sizing: border-box;
}
.auth-main--register .auth-wrap {
  grid-template-columns: 520px 1fr;
  max-width: 1160px;
}

/* ─────────────────────────────────────────
   FORM COLUMN (LEFT)
─────────────────────────────────────────── */
.auth-form-col {
  background: var(--white);
  border-radius: 22px;
  box-shadow: 0 4px 32px rgba(10,22,40,.10);
  border: 1px solid var(--gray-100);
}
.auth-form-inner {
  padding: 34px 36px 30px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: var(--white);
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 18px;
  width: fit-content;
}
.auth-brand-pill i { color: var(--gold-400); font-size: .7rem; }

.auth-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.5vw, 1.9rem);
  font-weight: 800;
  color: var(--navy-900);
  letter-spacing: -.035em;
  line-height: 1.15;
  margin-bottom: 5px;
}
.auth-subtitle {
  font-size: .88rem;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ─────────────────────────────────────────
   ROLE TOGGLE
─────────────────────────────────────────── */
.auth-role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  transition: opacity var(--transition);
}
.auth-role-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-200);
  font-size: .84rem;
  font-weight: 700;
  color: var(--gray-600);
  background: var(--gray-50);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
  text-align: center;
}
.auth-role-btn:hover { border-color: var(--navy-400); color: var(--navy-700); background: var(--white); }
.auth-role-btn--active {
  border-color: var(--navy-600);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: var(--white);
  box-shadow: var(--shadow-navy);
}
.auth-role-btn--active i { color: var(--gold-400); }

/* ─────────────────────────────────────────
   FORM VISIBILITY LOGIC
─────────────────────────────────────────── */
.reg-form-wrapper { width: 100%; }
.reg-form-hidden { display: none !important; }
.reg-form-active { display: block !important; }

/* Form Base */
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.auth-req { color: var(--red); font-size: .72rem; }
.auth-label { font-size: .78rem; font-weight: 600; color: var(--gray-600); line-height: 1; }

/* Input Base */
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.auth-input-icon {
  position: absolute;
  left: 13px;
  font-size: .78rem;
  color: var(--gray-400);
  pointer-events: none;
  z-index: 2;
  transition: color var(--transition);
}
.auth-input {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 10px 42px 10px 38px;
  font-size: .88rem;
  color: var(--gray-800);
  background: var(--gray-50);
  outline: none;
  font-family: var(--font-body);
  transition: all var(--transition);
  height: 44px;
}
.auth-input:focus {
  border-color: var(--navy-400);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(61,107,196,.10);
}
.auth-input:focus ~ .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon { color: var(--navy-500); }
.auth-input.auth-input--err { border-color: var(--red); background: #fff5f5; }

.auth-file-input { padding-left: 38px; padding-top: 8px; font-size: 0.8rem; }
.auth-file-input::file-selector-button {
  background: var(--gray-200);
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--gray-700);
  font-family: var(--font-body);
  cursor: pointer;
  margin-right: 10px;
}

.auth-eye-btn {
  position: absolute;
  right: 12px;
  width: 28px; height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: .85rem;
  display: grid;
  place-items: center;
  transition: color var(--transition);
  border-radius: 6px;
  z-index: 3;
}
.auth-eye-btn:hover { color: var(--navy-600); background: var(--gray-100); }
.auth-field-err {
  font-size: .72rem; color: var(--red); font-weight: 600; min-height: 14px; display: flex; align-items: center; gap: 4px;
}

/* ─────────────────────────────────────────
   STEP INDICATORS
─────────────────────────────────────────── */
.auth-step-indicator {
  display: flex; align-items: center; gap: 6px; margin-bottom: 20px;
}
.auth-step-dot {
  width: 28px; height: 28px; border-radius: 50%; background: var(--gray-200); color: var(--gray-500);
  font-size: .72rem; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; font-family: var(--font-display);
}
.auth-step-dot--active {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: var(--white); box-shadow: 0 2px 10px rgba(10,22,40,.25);
}
.auth-step-dot--done { background: linear-gradient(135deg, var(--emerald), #059669); color: var(--white); }
.auth-step-dot--done i { font-size: .6rem; }
.auth-step-line { flex: 1; height: 2px; background: var(--gray-200); border-radius: 2px; }
.auth-step-line--done { background: var(--emerald); }
.auth-step-label { font-size: .72rem; color: var(--gray-400); font-weight: 600; white-space: nowrap; margin-left: 4px; }

/* ─────────────────────────────────────────
   DROPDOWN & PLUGINS FIXES
─────────────────────────────────────────── */
/* Base Select Visibility */
select.tom-select-input { display: none !important; }

/* RESET WRAPPER: Prevent inheriting .auth-input sizing/borders that cause overflow/detachment */
.ts-wrapper { 
  width: 100% !important; 
  flex: 1; 
  z-index: 1; 
  position: relative; 
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  height: auto !important;
  min-height: auto !important;
  box-shadow: none !important;
}
.ts-wrapper.focus { z-index: 999; } 

/* STRICT INNER CONTROL SIZING: Match original input exactly */
.ts-control {
  border: 1.5px solid var(--gray-200) !important;
  border-radius: var(--radius-md) !important;
  padding: 0 10px 0 38px !important;
  font-size: .88rem;
  color: var(--gray-800);
  background: var(--gray-50) !important;
  box-shadow: none !important;
  min-height: 44px !important;
  height: 44px !important; 
  display: flex;
  align-items: center;
  width: 100% !important;
}
.ts-control.focus { 
  border-color: var(--navy-400) !important; 
  background: var(--white) !important; 
  box-shadow: 0 0 0 3px rgba(61,107,196,.10) !important; 
}
.ts-wrapper.auth-input--err .ts-control { 
  border-color: var(--red) !important; 
  background: #fff5f5 !important; 
}

/* Inner input fix */
.ts-control input {
  font-size: .88rem !important;
  color: var(--gray-800) !important;
  font-family: var(--font-body) !important;
}

/* DROPDOWN PANEL STYLING & POSITIONING */
.ts-dropdown { 
  border-radius: var(--radius-md) !important; 
  box-shadow: var(--shadow-lg) !important; 
  border: 1px solid var(--gray-200) !important; 
  background: var(--white) !important; 
  color: var(--gray-800) !important;
  z-index: 1000 !important;
  margin-top: 4px !important;
  overflow: hidden; 
  width: 100% !important; /* Lock width to parent container */
  left: 0 !important;
}
.ts-dropdown .ts-dropdown-content {
  max-height: 240px;
  overflow-y: auto;
}
.ts-dropdown .option {
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--gray-800);
  background: var(--white);
  cursor: pointer;
  transition: background var(--transition);
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: var(--gray-50);
  color: var(--navy-800);
  font-weight: 600;
}

/* Intl Tel Input Integration (Padding & flex fix) */
.iti { width: 100%; display: block; position: relative; flex: 1; }
.iti__flag-container { z-index: 2; }
.iti__country-list { z-index: 1000 !important; box-shadow: var(--shadow-lg) !important; border-radius: var(--radius-md) !important; }
.iti--allow-dropdown input[type="tel"],
.iti--allow-dropdown input[type="text"],
.iti--separate-dial-code input[type="tel"],
.iti--separate-dial-code input[type="text"],
.iti-phone {
  padding-left: 95px !important; 
}

/* ─────────────────────────────────────────
   DYNAMIC PRODUCTS
─────────────────────────────────────────── */
.auth-products-wrap { display: flex; flex-direction: column; gap: 8px; }
.auth-product-row { display: grid; grid-template-columns: 1fr 1.5fr auto; gap: 8px; align-items: center; }
.auth-btn-product {
  width: 44px; height: 44px; border-radius: var(--radius-md); border: none; display: grid;
  place-items: center; color: var(--white); cursor: pointer; transition: all var(--transition);
}
.auth-btn-add { background: var(--navy-600); }
.auth-btn-add:hover { background: var(--navy-800); }
.auth-btn-remove { background: var(--red); }
.auth-btn-remove:hover { background: #b91c1c; }

/* ─────────────────────────────────────────
   BUTTONS
─────────────────────────────────────────── */
.auth-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 24px;
  border-radius: var(--radius-md); font-size: .9rem; font-weight: 700; font-family: var(--font-body);
  cursor: pointer; border: none; transition: all var(--transition); letter-spacing: .01em;
}
.auth-btn--primary {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: var(--white); box-shadow: var(--shadow-navy); margin-top: 4px;
}
.auth-btn--primary:hover { background: linear-gradient(135deg, var(--gold-500), var(--gold-600)); color: var(--navy-900); box-shadow: var(--shadow-gold); transform: translateY(-1px); }
.auth-btn--ghost { background: var(--gray-100); color: var(--gray-600); border: none; }
.auth-btn--ghost:hover { background: var(--gray-200); color: var(--gray-800); }
.auth-btn--outline { border: 2px solid var(--gray-200); color: var(--navy-700); background: transparent; }
.auth-btn--outline:hover { border-color: var(--navy-500); background: var(--gray-50); }

.auth-step2-btns { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.auth-step2-btns .auth-btn--ghost { width: auto; padding: 12px 18px; }

/* ─────────────────────────────────────────
   THANK YOU
─────────────────────────────────────────── */
.auth-success-wrap { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.auth-success-icon {
  width: 72px; height: 72px; background: linear-gradient(135deg, var(--emerald), #059669); color: var(--white);
  border-radius: 50%; display: grid; place-items: center; font-size: 2rem; box-shadow: 0 8px 24px rgba(16,185,129,.3); margin-bottom: 10px;
}
.auth-success-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 800; color: var(--navy-900); }
.auth-success-text { font-size: .9rem; color: var(--gray-500); line-height: 1.6; max-width: 380px; margin-bottom: 10px; }

/* ─────────────────────────────────────────
   BOTTOM LINKS
─────────────────────────────────────────── */
.auth-switch-text { font-size: .83rem; color: var(--gray-500); text-align: center; }
.auth-switch-link { color: var(--navy-600); font-weight: 700; text-decoration: none; transition: color var(--transition); }
.auth-switch-link:hover { color: var(--gold-600); }
.auth-legal { font-size: .72rem; color: var(--gray-400); text-align: center; margin-top: 8px; line-height: 1.6; }

/* Animations */
@keyframes authShake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
.auth-shake { animation: authShake .38s ease; }
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-form-col { animation: authFadeUp .4s ease both; }
.auth-panel-col { animation: authFadeUp .4s .12s ease both; }

/* ─────────────────────────────────────────
   RIGHT PANEL 
─────────────────────────────────────────── */
.auth-panel-col { position: sticky; top: calc(var(--topbar-h) + var(--header-h) + 14px); }
.auth-panel-inner {
  background: linear-gradient(145deg, var(--navy-950) 0%, #162040 60%, var(--navy-800) 100%);
  border-radius: 22px; padding: 34px 30px; height: 100%; display: flex; flex-direction: column;
  gap: 24px; position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.06); box-shadow: 0 8px 40px rgba(5,12,26,.30);
}
.auth-panel-inner::before {
  content: ''; position: absolute; top: -80px; right: -80px; width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(245,158,11,.15) 0%, transparent 60%); border-radius: 50%; pointer-events: none;
}
.auth-panel-inner::after {
  content: ''; position: absolute; bottom: -50px; left: -50px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(30,58,110,.50) 0%, transparent 65%); border-radius: 50%; pointer-events: none;
}
.auth-panel-inner > * { position: relative; z-index: 1; }

.auth-panel-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: .67rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--gold-400); background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.22);
  padding: 3px 10px; border-radius: 20px; margin-bottom: 10px; width: fit-content;
}
.auth-panel-headline h2 {
  font-family: var(--font-display); font-size: clamp(1.4rem, 2.2vw, 1.75rem); font-weight: 800;
  color: var(--white); letter-spacing: -.03em; line-height: 1.2; margin-bottom: 8px;
}
.auth-panel-accent { color: var(--gold-400); }
.auth-panel-headline p { font-size: .85rem; color: rgba(255,255,255,.45); line-height: 1.65; }

/* Unique specific classes for right side cards */
.reg-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.reg-info-card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: all var(--transition);
  height: 100%;
}
.reg-info-title { font-size: .78rem; color: rgba(255,255,255,.75); margin-bottom: 0; line-height: 1.3; }
.reg-info-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.1rem;
}

.auth-benefits { display: flex; flex-direction: column; gap: 8px; }
.auth-benefit-item { display: flex; align-items: center; gap: 9px; font-size: .82rem; color: rgba(255,255,255,.55); }
.auth-benefit-item i { color: var(--emerald); font-size: .78rem; }

.auth-panel-stats { display: flex; align-items: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 14px 16px; }
.auth-pstat { flex: 1; text-align: center; }
.auth-pstat-num { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; color: var(--gold-400); line-height: 1; margin-bottom: 4px; }
.auth-pstat-lbl { font-size: .68rem; color: rgba(255,255,255,.38); font-weight: 500; }
.auth-pstat-sep { width: 1px; height: 32px; background: rgba(255,255,255,.10); }

/* ─────────────────────────────────────────
   RESPONSIVE
─────────────────────────────────────────── */
@media (max-width: 1040px) {
  .auth-main--register .auth-wrap { grid-template-columns: 440px 1fr; gap: 16px; }
}
@media (max-width: 860px) {
  .auth-main--register .auth-wrap { grid-template-columns: 1fr; max-width: 520px; }
  .auth-panel-col { display: none; }
  .auth-main { padding: 20px 0 36px; }
}
@media (max-width: 560px) {
  .auth-wrap { padding: 0 12px; }
  .auth-form-inner { padding: 24px 20px 22px; }
  .auth-form-row { grid-template-columns: 1fr; }
  .auth-role-toggle { grid-template-columns: 1fr; }
  .auth-step2-btns { grid-template-columns: 1fr; }
  .auth-step2-btns .auth-btn--ghost { width: 100%; }
  .auth-title { font-size: 1.5rem; }
  .auth-product-row { grid-template-columns: 1fr; }
  .reg-info-grid { grid-template-columns: 1fr; }
}