/* Sign-in / sign-up / recovery cards: glass card with a slowly turning gradient frame, outlined fields whose label
   sits on the border, icons inside the fields, a segmented switch between "دخول" and "حساب جديد". */

.auth-stage { position: relative; display: grid; place-items: center; padding: 6px 0 40px; }
.auth-stage::before, .auth-stage::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; z-index: 0; }
.auth-stage::before { width: 320px; height: 320px; background: radial-gradient(circle, #29a9e8, transparent 70%); top: 40px; inset-inline-start: calc(50% - 360px); animation: auth-float 9s ease-in-out infinite; }
.auth-stage::after { width: 280px; height: 280px; background: radial-gradient(circle, #0b3b8c, transparent 70%); bottom: 10px; inset-inline-end: calc(50% - 340px); animation: auth-float 11s ease-in-out infinite reverse; }
@keyframes auth-float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(20px, -24px); } }

.auth-card { position: relative; z-index: 1; width: 100%; max-width: 470px; padding: 30px 30px 24px; border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(8, 37, 79, .22), 0 2px 0 rgba(255, 255, 255, .6) inset; animation: auth-in .6s cubic-bezier(.2, .8, .2, 1) both; isolation: isolate; }
.auth-card.wide { max-width: 580px; }
/* turning gradient frame */
.auth-card::before { content: ""; position: absolute; inset: 0; padding: 1.6px; border-radius: inherit; z-index: -1;
  background: conic-gradient(from var(--auth-angle, 0deg), #29a9e8, #0b3b8c, #7dd3fc, #0277bd, #29a9e8);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: auth-turn 6s linear infinite; }
@property --auth-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes auth-turn { to { --auth-angle: 360deg; } }
@keyframes auth-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head .auth-logo { margin-bottom: 4px; }
.auth-head .auth-logo img { width: 84px; height: 84px; }
.auth-head h1 { margin: 6px 0 0; font-size: 1.65rem; font-weight: 800; letter-spacing: -.3px;
  background: linear-gradient(100deg, var(--navy), var(--primary) 55%, #29a9e8); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: dark) { .auth-head h1 { background-image: linear-gradient(100deg, #e4eef8, #4fc3f7); } }

/* segmented switch دخول / حساب جديد */
.auth-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; margin: 0 0 22px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.auth-switch a { position: relative; z-index: 1; text-align: center; padding: 9px 0; border-radius: 12px; font-weight: 700; color: var(--muted); transition: color .25s; }
.auth-switch a.active { color: #fff; }
.auth-switch .pill { position: absolute; top: 5px; bottom: 5px; width: calc(50% - 5px); border-radius: 12px; background: linear-gradient(120deg, var(--primary), #29a9e8);
  box-shadow: 0 8px 20px rgba(2, 119, 189, .35); transition: inset-inline-start .35s cubic-bezier(.3, 1.4, .5, 1); inset-inline-start: 5px; }
.auth-switch[data-tab="register"] .pill { inset-inline-start: 50%; }

/* outlined fields: label on the border, icon inside */
.auth-card .field { position: relative; margin: 0 0 20px; }
.auth-card .field > label { position: absolute; top: -10px; inset-inline-start: 14px; z-index: 3; padding: 0 8px; margin: 0; font-size: .8rem; font-weight: 700;
  color: var(--muted); background: var(--surface); border-radius: 8px; line-height: 1.5; transition: color .2s; pointer-events: none; }
.auth-card .field:focus-within > label { color: var(--primary); }
.auth-card .field > .ic { position: absolute; top: 28px; inset-inline-start: 15px; transform: translateY(-50%); color: var(--muted); display: grid; transition: color .2s, transform .2s; pointer-events: none; z-index: 2; }
.auth-card .field:focus-within > .ic { color: var(--primary); transform: translateY(-50%) scale(1.1); }
.auth-card .field > input, .auth-card .field > textarea, .auth-card .field > select, .auth-card .phone-field {
  height: 56px; width: 100%; border-radius: 16px; border: 1.5px solid var(--border); font-size: 1rem;
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); transition: border-color .2s, box-shadow .25s, transform .2s; }
.auth-card .field > textarea { height: auto; min-height: 120px; padding: 18px 16px 12px; line-height: 1.7; resize: vertical; }
.auth-card .field > input { padding: 0 16px; }
.auth-card .field > .ic + input, .auth-card .field > .ic + textarea, .auth-card .field > .ic + select { padding-inline-start: 48px; }
.auth-card .field > input:hover, .auth-card .field > textarea:hover, .auth-card .phone-field:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.auth-card .field > input:focus, .auth-card .field > textarea:focus, .auth-card .field > select:focus, .auth-card .phone-field:focus-within {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft), 0 10px 24px rgba(2, 119, 189, .14); }
.auth-card .field > input.has-eye { padding-inline-end: 50px; }
.auth-card .field > .pw-eye { position: absolute; top: 28px; inset-inline-end: 10px; right: auto; transform: translateY(-50%); z-index: 2; }

/* WhatsApp number field inside the card */
.auth-card .phone-field { overflow: visible; }
.auth-card .phone-field .pf-country { border-radius: 0 14px 14px 0; padding: 0 14px; background: linear-gradient(135deg, var(--primary-soft), transparent); border-inline-end: 1.5px solid var(--border); }
.auth-card .phone-field input[type=tel] { height: 100%; background: transparent; font-size: 1.05rem; letter-spacing: 1px; padding: 0 14px; }
.auth-card .phone-hint { margin-top: 6px; min-height: 0; }
.auth-card .phone-hint:empty { display: none; }

/* human check */
.auth-card .captcha { border: 1.5px dashed var(--border); border-radius: 16px; padding: 16px 12px 12px; gap: 12px; flex-wrap: nowrap; justify-content: space-between; }
.auth-card .captcha img { border-radius: 12px; }
.auth-card .captcha input { height: 48px; flex: 1; width: auto !important; max-width: 160px; border-radius: 12px; border: 1.5px solid var(--border); font-size: 1.15rem; }
.auth-card .captcha input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* switches and checks */
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 18px; font-size: .9rem; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--border); transition: background .25s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: inset-inline-start .25s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + .track { background: linear-gradient(120deg, var(--primary), #29a9e8); }
.switch input:checked + .track::after { inset-inline-start: 21px; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--primary-soft); }
.auth-card .terms-check { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; font-weight: 600; }
.auth-card .terms-check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* main button with a light sweep */
.btn-auth { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px; border: 0; border-radius: 16px;
  font: inherit; font-size: 1.08rem; font-weight: 800; color: #fff; cursor: pointer; background: linear-gradient(120deg, var(--navy), var(--primary) 55%, #29a9e8);
  background-size: 160% 100%; box-shadow: 0 14px 30px rgba(2, 119, 189, .35); transition: transform .2s, box-shadow .25s, background-position .5s; }
.btn-auth::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; inset-inline-start: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg); animation: auth-sweep 3.5s ease-in-out infinite; }
@keyframes auth-sweep { 0%, 60% { inset-inline-start: -60%; } 100% { inset-inline-start: 130%; } }
.btn-auth:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 18px 36px rgba(2, 119, 189, .45); }
.btn-auth:active { transform: translateY(0); }
.btn-auth svg { transform: scaleX(-1); }

.auth-foot { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.auth-foot a { font-weight: 700; }
.auth-foot .sep { margin: 0 8px; opacity: .5; }
.auth-card .otp-status { border-radius: 14px; }
.auth-card .recover-way { border-radius: 16px; padding: 16px 18px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.auth-card .otp-input { height: 64px !important; font-size: 1.9rem !important; letter-spacing: 14px; text-align: center; padding: 0 !important; }

/* field groups side by side on wide cards */
.auth-card .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) {
  .auth-card { padding: 24px 18px 20px; border-radius: 22px; }
  .auth-card .pair { grid-template-columns: 1fr; }
  .auth-stage::before, .auth-stage::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { .auth-card, .auth-card::before, .btn-auth::after, .auth-stage::before, .auth-stage::after { animation: none; } }

/* fields with a textarea: icon at the top line; budget + currency side by side */
.auth-card .field > .ic.ic-top { top: 30px; }
.auth-card .budget-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
.auth-card .currency-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; height: 56px; padding: 5px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface-2); }
.auth-card .currency-pick .cur { position: relative; display: block; margin: 0; cursor: pointer; }
.auth-card .currency-pick input { position: absolute; opacity: 0; }
.auth-card .currency-pick span { display: grid; place-items: center; height: 100%; border-radius: 12px; font-weight: 700; font-size: .9rem; color: var(--muted); transition: background .25s, color .25s; }
.auth-card .currency-pick input:checked + span { color: #fff; background: linear-gradient(120deg, var(--primary), #29a9e8); box-shadow: 0 6px 16px rgba(2, 119, 189, .3); }
.auth-card .currency-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.ref-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--primary-soft); font-size: .88rem; font-weight: 600; margin: 0 0 18px; }
@media (max-width: 560px) { .auth-card .budget-row { grid-template-columns: 1fr; } }
/* the number box itself shows the focus; the input inside it must not draw a second frame */
.phone-field input[type=tel], .phone-field input[type=tel]:focus { box-shadow: none !important; outline: none !important; border: 0 !important; background: transparent !important; }
