/* KAYAAN v4 — auth.css — 3-screen auth */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #f97316;
  --primary-light: #fb923c;
  --primary-dim: rgba(249,115,22,0.13);
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --blue-dim: rgba(59,130,246,0.13);
  --bg: #080b12;
  --surface: #111520;
  --surface2: #171c2e;
  --surface3: #1e2438;
  --border: rgba(255,255,255,0.08);
  --text: #e8edf5;
  --text-muted: #8892b0;
  --red: #ef4444;
  --green: #22c55e;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-x: hidden;
  position: relative;
}
[dir="rtl"] body { font-family: 'Inter', 'Tajawal', 'Cairo', system-ui, sans-serif; }

/* ── Ambient orbs ── */
.auth-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  z-index: 0;
}
.auth-orb-1 {
  width: 600px; height: 500px;
  top: -150px; right: -100px;
  background: radial-gradient(circle, rgba(249,115,22,0.18) 0%, transparent 70%);
  animation: orb-drift 12s ease-in-out infinite alternate;
}
.auth-orb-2 {
  width: 500px; height: 400px;
  bottom: -150px; left: -120px;
  background: radial-gradient(circle, rgba(59,130,246,0.14) 0%, transparent 70%);
  animation: orb-drift 16s ease-in-out infinite alternate-reverse;
}
.auth-orb-3 {
  width: 300px; height: 300px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(249,115,22,0.06) 0%, transparent 70%);
  animation: orb-pulse 8s ease-in-out infinite;
}

@keyframes orb-drift {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(40px) scale(1.08); }
}
@keyframes orb-pulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%,-50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%,-50%) scale(1.2); }
}

/* ── Wrapper ── */
.auth-wrapper {
  width: 100%;
  max-width: 860px;   /* wide for owner split; employee card self-limits */
  position: relative;
  z-index: 1;
}

/* ── Topbar (back link + lang) ── */
.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.15s;
  text-decoration: none;
}
.back-link:hover { color: var(--primary); }

.lang-switcher-auth {
  display: flex;
  gap: 3px;
  background: var(--surface2);
  border-radius: 9px;
  padding: 3px;
  border: 1px solid var(--border);
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: .04em;
}
.lang-btn.active, .lang-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Screens ── */
.auth-screen { display: none; animation: screenIn .28s ease; }
.auth-screen.active { display: block; }

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

/* ── Owner split screen ── */
.owner-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 520px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 40px 100px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.04);
}

/* Left branded panel */
.owner-left {
  background: linear-gradient(160deg, #0f1626 0%, #0a0f1e 60%, #0d1526 100%);
  border-right: 1px solid rgba(249,115,22,0.12);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.owner-left::before {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249,115,22,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.owner-left::after {
  content: '';
  position: absolute;
  bottom: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.owner-back {
  position: relative;
  z-index: 1;
  margin-bottom: 1.5rem;
  align-self: flex-start;
}

.owner-brand-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}
.owner-k {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #f97316, #ea6d0a);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 8px 28px rgba(249,115,22,0.45);
  flex-shrink: 0;
}
.owner-brand-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.02em;
}
.owner-brand-sub {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.owner-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  flex: 1;
  position: relative;
  z-index: 1;
}
.owner-features li {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .82rem;
  color: rgba(232,237,245,0.8);
  font-weight: 500;
}
.of-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(249,115,22,0.12);
  border: 1px solid rgba(249,115,22,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.owner-left-footer {
  font-size: .68rem;
  color: rgba(136,146,176,0.5);
  margin-top: 1.5rem;
  position: relative;
  z-index: 1;
  font-weight: 500;
}
.owner-left-emp-link {
  margin-top: .6rem;
  font-size: .75rem;
  color: rgba(136,146,176,0.55);
  position: relative;
  z-index: 1;
}
.owner-left-emp-link a {
  color: var(--blue-light);
  text-decoration: none;
  font-weight: 600;
}
.owner-left-emp-link a:hover { text-decoration: underline; }

/* Right form panel */
.owner-right {
  background: rgba(14,17,26,0.98);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  backdrop-filter: blur(16px);
}

/* Employee card extras */
.emp-card { max-width: 480px; margin: 0 auto; }

.emp-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 1.25rem;
}
.emp-avatar {
  width: 50px; height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e3a5f, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
  flex-shrink: 0;
}
.emp-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.emp-sub   { font-size: .73rem; color: var(--text-muted); margin-top: 1px; }

/* Smaller code field for optional company code */
.code-field-sm {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  letter-spacing: .2em !important;
  text-transform: uppercase !important;
  text-align: center !important;
  border-color: rgba(59,130,246,0.25) !important;
}
.code-field-sm:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px var(--blue-dim) !important;
}
.optional-lbl {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── SCREEN 1: Role selection ── */
.auth-logo-center {
  text-align: center;
  margin-bottom: 2.25rem;
}

.auth-k-badge {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.7rem;
  color: #fff;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 32px rgba(249,115,22,0.45), 0 0 0 1px rgba(249,115,22,0.2);
}
.auth-k-badge.sm {
  width: 40px; height: 40px;
  font-size: 1rem;
  border-radius: 11px;
  margin-bottom: 0;
}

.auth-brand-name {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -.03em;
  line-height: 1;
}
.auth-brand-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

.role-prompt {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem 1.25rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.22s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.role-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(249,115,22,0.1) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.22s;
}
.role-card.employee::before {
  background: radial-gradient(circle at 50% 0%, rgba(59,130,246,0.1) 0%, transparent 65%);
}
.role-card:hover {
  border-color: rgba(249,115,22,0.35);
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(249,115,22,0.15);
}
.role-card:hover::before { opacity: 1; }
.role-card.employee:hover {
  border-color: rgba(59,130,246,0.35);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(59,130,246,0.15);
}

.role-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.2rem;
}
.role-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.role-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.role-cta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.35rem;
  letter-spacing: .03em;
}
.role-card.employee .role-cta { color: var(--blue); }

/* ── Back button (inside card screens) ── */
.auth-back-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: color .15s;
  font-family: inherit;
}
.auth-back-btn:hover { color: var(--primary); }

/* ── Card ── */
.auth-card {
  background: rgba(17,21,32,0.96);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 22px;
  padding: 2.25rem;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249,115,22,0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Logo (inside cards) ── */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
.auth-logo h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -.02em;
}
.auth-logo p {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 500;
}
.emp-icon-badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e3a5f, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}

/* ── Tabs ── */
.auth-tabs {
  display: flex;
  background: var(--surface3);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
  gap: 0;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.6rem;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(249,115,22,0.35);
}

/* ── Form ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.auth-form.hidden { display: none; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.form-group input {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.72rem 1rem;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-group input::placeholder { color: rgba(136,146,176,0.45); }

/* ── Invite code input ── */
.code-field {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  letter-spacing: .35em !important;
  text-align: center !important;
  text-transform: uppercase !important;
  border-color: rgba(59,130,246,0.3) !important;
  padding: 0.9rem 1rem !important;
  background: rgba(30,58,95,0.25) !important;
}
.code-field:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px var(--blue-dim) !important;
}

.field-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── Password wrap ── */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 2.8rem; }
.pass-toggle {
  position: absolute;
  right: 0.75rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; font-size: 1rem;
  color: var(--text-muted);
  padding: 0.25rem;
  line-height: 1;
}

/* ── Buttons ── */
.btn-auth {
  background: linear-gradient(135deg, var(--primary), #ea6d0a);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.35rem;
  font-family: inherit;
  letter-spacing: .03em;
  box-shadow: 0 4px 24px rgba(249,115,22,0.32);
  text-transform: uppercase;
  width: 100%;
}
.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px rgba(249,115,22,0.5);
}
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Employee CTA — blue gradient */
.btn-auth.emp-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 24px rgba(37,99,235,0.35);
}
.btn-auth.emp-btn:hover {
  box-shadow: 0 8px 36px rgba(37,99,235,0.55);
}

/* ── Error ── */
.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--red);
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.83rem;
  text-align: center;
  animation: fadeIn .2s ease;
}
.auth-error.hidden { display: none; }

/* ── Employee portal links ── */
.emp-portal-links {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.emp-portal-links a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}
.emp-portal-links a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 99px; }

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

/* Role selection max-width constraint */
#screen-role { max-width: 460px; margin: 0 auto; }

@media (max-width: 700px) {
  .owner-split { grid-template-columns: 1fr; }
  .owner-left  { display: none; } /* hide on mobile — form only */
}

@media (max-width: 480px) {
  body { padding: 1rem; align-items: flex-start; padding-top: 2rem; }
  .auth-wrapper { max-width: 100%; }
  .role-cards { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; border-radius: 18px; }
  .auth-brand-name { font-size: 1.6rem; }
}
