/* ==============================================================================
   Kite Suite — Universal Authentication Modal & User Bar CSS
   Light & Dark Theme Compatible, Glassmorphic, Accessible
   ============================================================================== */

/* Modal Backdrop */
.kite-auth-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 15, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.kite-auth-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Modal Window */
.kite-auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  width: 92%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--card-border, #1e293b);
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.kite-auth-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.kite-auth-header {
  padding: 1.5rem 1.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border, #1e293b);
  background: var(--bg-secondary, #0f172a);
}

.kite-auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kite-auth-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--app-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kite-auth-title-box h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text, #f8fafc);
  letter-spacing: -0.01em;
}

.kite-auth-title-box p {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.kite-auth-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kite-auth-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #f8fafc);
}

/* Tab Switcher */
.kite-auth-tabs {
  display: flex;
  background: var(--card-inner, #1e293b);
  padding: 0.35rem;
  margin: 1.25rem 1.75rem 0.5rem;
  border-radius: 12px;
  gap: 0.35rem;
}

.kite-auth-tab {
  flex: 1;
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s ease;
}

.kite-auth-tab.active {
  background: var(--card-bg, #0f172a);
  color: var(--text, #f8fafc);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modal Body */
.kite-auth-body {
  padding: 1.25rem 1.75rem 1.75rem;
}

/* Role Selector */
.kite-auth-roles {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kite-role-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--card-border, #1e293b);
  background: var(--bg-secondary, #0f172a);
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.kite-role-chip.active {
  border-color: var(--app-primary, #6366f1);
  background: rgba(99, 102, 241, 0.1);
  color: var(--text, #f8fafc);
}

/* Form Styles */
.kite-auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kite-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.kite-input-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #f8fafc);
}

.kite-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.kite-input-wrap input,
.kite-input-wrap select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--card-inner, #1e293b);
  border: 1px solid var(--card-border, #334155);
  border-radius: 10px;
  color: var(--text, #f8fafc);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kite-input-wrap input:focus,
.kite-input-wrap select:focus {
  border-color: var(--app-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Password with inline generator button */
.kite-pwd-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}

.btn-generate-pwd {
  background: none;
  border: none;
  color: var(--app-primary, #6366f1);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  transition: opacity 0.15s;
}

.btn-generate-pwd:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.pwd-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 0.95rem;
}

/* Generated password helper display */
.pwd-badge-copied {
  display: none;
  background: #10b981;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
}

/* Submit & Helper Buttons */
.btn-auth-submit {
  width: 100%;
  padding: 0.8rem;
  border-radius: 10px;
  border: none;
  background: var(--app-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  margin-top: 0.5rem;
}

.btn-auth-submit:hover {
  transform: translateY(-1px);
  opacity: 0.95;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.btn-auth-demo {
  background: transparent;
  border: 1px dashed var(--card-border, #334155);
  color: var(--text-muted, #94a3b8);
  font-size: 0.78rem;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
  margin-top: 0.25rem;
}

.btn-auth-demo:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #f8fafc);
  border-color: var(--text-muted, #94a3b8);
}

/* Auth Toast Notification */
.kite-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #fff;
  border: 1px solid #10b981;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.kite-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* User Session Pill in Nav */
.kite-user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-inner, #1e293b);
  border: 1px solid var(--card-border, #334155);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.kite-user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
}

.kite-btn-signout {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.kite-btn-signout:hover {
  text-decoration: underline;
}

/* Social links in footer */
.social-links-grid {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.social-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--card-inner, #1e293b);
  border: 1px solid var(--card-border, #334155);
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  transition: all 0.2s ease;
}

.social-link-btn:hover {
  background: var(--app-primary, #6366f1);
  color: #ffffff;
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.social-link-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- Sign-up wizard (business → plan → login) ---------- */
.kite-auth-modal:has(#kiteSignUpForm[style*="flex"]) { max-width: 720px; }
#kiteSignUpForm input, #kiteSignUpForm select { font-size: 1rem; min-height: 46px; }
#kiteSignUpForm label { font-size: .84rem; }
.ksw-steps { display: flex; gap: 6px; margin-bottom: 4px; }
.ksw-steps span { flex: 1; text-align: center; padding: 10px 4px; border-radius: 10px; font-size: .86rem; font-weight: 800; color: var(--text-muted, #94a3b8); background: rgba(148, 163, 184, .1); }
.ksw-steps span.on { background: var(--app-primary, #6366f1); color: #fff; }
.ksw-steps span.done { color: var(--app-primary, #10b981); }
.ksw-page { display: flex; flex-direction: column; gap: .85rem; }
.ksw-page[hidden] { display: none; }
.ksw-row { display: flex; gap: 8px; align-items: center; }
.ksw-3 { display: grid; grid-template-columns: 1.2fr 1fr .8fr; gap: 8px; }
@media (max-width: 520px) { .ksw-3 { grid-template-columns: 1fr 1fr; } }
.ksw-fetch, .ksw-back { flex: 0 0 auto; padding: .7rem .9rem; border-radius: 10px; border: 1px solid var(--card-border, #334155); background: rgba(148, 163, 184, .1); color: inherit; font-weight: 800; font-size: .82rem; cursor: pointer; }
.ksw-fetch:disabled { opacity: .6; cursor: wait; }
.ksw-hint { display: block; font-size: .76rem; color: var(--text-muted, #94a3b8); margin-top: 4px; line-height: 1.45; }
.ksw-hint.ok { color: #34d399; } .ksw-hint.bad { color: #f87171; } .ksw-hint.warn { color: #fbbf24; }
.ksw-plans { display: grid; gap: 8px; }
.ksw-plan { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 14px 16px; border: 2px solid var(--card-border, #334155); border-radius: 12px; }
.ksw-plan b { font-size: 1.05rem; } .ksw-plan em { grid-column: 1; font-style: normal; font-size: .78rem; font-weight: 700; color: var(--app-primary, #818cf8); } .ksw-plan small { grid-column: 1; color: var(--text-muted, #94a3b8); font-size: .74rem; }
.ksw-plan > span { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 800; font-size: 1.05rem; } .ksw-plan > span small { font-weight: 600; }
.ksw-plan.on { border-color: var(--app-primary, #6366f1); background: rgba(99, 102, 241, .1); }
.ksw-seg { display: inline-flex; align-self: flex-start; background: rgba(148, 163, 184, .12); border-radius: 10px; padding: 3px; }
.ksw-seg button { all: unset; cursor: pointer; padding: 7px 16px; border-radius: 8px; font-weight: 800; font-size: .82rem; }
.ksw-seg button.on { background: var(--app-primary, #6366f1); color: #fff; }
.ksw-qty { display: grid; gap: 6px; }
.ksw-q { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--card-border, #334155); border-radius: 10px; font-size: .84rem; font-weight: 700; }
.ksw-q small { display: block; font-weight: 500; font-size: .72rem; color: var(--text-muted, #94a3b8); }
.ksw-st { display: flex; align-items: center; gap: 6px; } .ksw-st b { min-width: 22px; text-align: center; }
.ksw-st button { all: unset; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--card-border, #334155); display: grid; place-items: center; font-weight: 800; }
.ksw-st button:disabled { opacity: .35; cursor: not-allowed; }
.ksw-price { border-radius: 12px; padding: 10px 12px; background: rgba(16, 185, 129, .08); border: 1px solid rgba(16, 185, 129, .25); display: grid; gap: 4px; font-size: .84rem; }
.ksw-price div { display: flex; justify-content: space-between; gap: 10px; }
.ksw-agree { display: flex; gap: .5rem; align-items: flex-start; font-size: .76rem; color: var(--text-muted, #94a3b8); line-height: 1.45; cursor: pointer; }
.ksw-ok { width: 54px; height: 54px; border-radius: 50%; background: #10b981; color: #fff; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900; margin: 6px auto 4px; }
#swDone { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.ksw-cred { display: flex; gap: 10px; justify-content: space-between; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--card-border, #334155); }
.ksw-cred small { display: block; font-size: .72rem; color: var(--text-muted, #94a3b8); } .ksw-cred b { font-family: 'JetBrains Mono', monospace; font-size: .9rem; word-break: break-all; }
