/* ══════════════════════════════════════════
   iClinicOS — Register Page Styles (v2)
   ══════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  --bg: #050914;
  --bg-2: #0A1525;
  --surface: #0F1C30;
  --surface-2: #152840;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --primary: #00D4B4;
  --primary-2: #00A888;
  --primary-glow: rgba(0, 212, 180, 0.25);
  --accent: #5B8DEF;
  --danger: #EF4444;
  --success: #10B981;
  --warm: #F5A623;
  --white: #FFFFFF;
  --text: #E8EEF5;
  --text-dim: #8A9AAE;
  --text-mute: #5A6A7E;
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 48px rgba(0, 212, 180, 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Reset ─── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: auto; overflow-x: hidden; }
body {
  font-family: 'Cairo', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 500px at 20% 20%, rgba(0, 212, 180, 0.12), transparent 55%),
    radial-gradient(ellipse 700px 500px at 80% 30%, rgba(91, 141, 239, 0.1), transparent 55%),
    radial-gradient(ellipse 900px 600px at 50% 100%, rgba(139, 92, 246, 0.08), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
  opacity: 0.3;
}

/* Animated orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  animation: float 14s ease-in-out infinite;
}
.orb1 { width: 520px; height: 520px; background: radial-gradient(circle, rgba(0, 212, 180, 0.2) 0%, transparent 70%); top: -180px; right: -180px; }
.orb2 { width: 440px; height: 440px; background: radial-gradient(circle, rgba(91, 141, 239, 0.18) 0%, transparent 70%); bottom: -160px; left: -160px; animation-delay: 6s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 20px) scale(1.08); }
}

/* ─── Back to home ─── */
.back-home {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(15, 28, 48, 0.6);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  transition: all 0.25s var(--ease-out);
}
.back-home:hover { color: var(--white); border-color: var(--primary); background: rgba(15, 28, 48, 0.9); }
[dir="ltr"] .back-home { right: auto; left: 24px; }

/* ─── Register Card ─── */
.register-box {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 40px 38px 32px;
  position: relative;
  z-index: 5;
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--border);
  backdrop-filter: blur(20px);
  animation: boxIn 0.7s var(--ease-out) both;
}

@keyframes boxIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.register-box::before {
  content: '';
  position: absolute;
  top: -1px; left: 15%; right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.6;
  pointer-events: none;
}

/* ─── Logo ─── */
.logo {
  text-align: center;
  margin-bottom: 24px;
}
.logo img {
  width: 130px;
  height: auto;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 24px rgba(0, 212, 180, 0.25));
}
.logo h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #FFFFFF 0%, #B8C5D5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo p {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ─── Step Indicator ─── */
.steps-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.step-dot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mute);
  transition: color 0.3s;
}
.step-dot.active { color: var(--primary); }
.step-dot.done { color: var(--success); }
.step-dot-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 900;
  transition: all 0.3s var(--ease-out);
}
.step-dot.active .step-dot-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #041812;
  box-shadow: 0 0 20px rgba(0, 212, 180, 0.5);
}
.step-dot.done .step-dot-num {
  background: var(--success);
  border-color: var(--success);
  color: #041812;
}
.step-line {
  width: 40px; height: 2px;
  background: var(--border-strong);
  transition: background 0.3s;
}
.step-line.active { background: var(--primary); }

/* ─── Messages ─── */
.error, .success {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.error {
  background: rgba(239, 68, 68, 0.1);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: shake 0.4s var(--ease-out);
}
.success {
  background: rgba(16, 185, 129, 0.1);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ─── Form Section ─── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0 16px;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Form Groups ─── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group {
  margin-bottom: 14px;
  position: relative;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}
.form-group label .req { color: var(--danger); margin-inline-start: 2px; }

.input-wrap { position: relative; }
.input-wrap .icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text-mute);
  font-size: 15px;
  pointer-events: none;
  transition: color 0.2s;
}
[dir="ltr"] .input-wrap .icon { right: auto; left: 14px; }

.form-group input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  background: var(--bg-2);
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.25s var(--ease-out);
}
[dir="ltr"] .form-group input { padding: 12px 14px 12px 40px; }
.form-group input::placeholder { color: var(--text-mute); }
.form-group input:focus {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(0, 212, 180, 0.12);
}
.input-wrap:focus-within .icon { color: var(--primary); }

/* Phone with country code */
.phone-wrap {
  display: flex;
  gap: 8px;
}
.country-select {
  flex-shrink: 0;
  padding: 10px 8px;
  background: var(--bg-2);
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  color: var(--white);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: not-allowed;
  outline: none;
  width: 78px;
  text-align: center;
  opacity: 0.75;
}
.country-select:hover { border-color: var(--border-strong); }
.phone-input-wrap { flex: 1; }

/* Password toggle */
.pw-toggle {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 14px;
  transition: color 0.2s;
  z-index: 2;
}
.pw-toggle:hover { color: var(--primary); }
[dir="ltr"] .pw-toggle { left: auto; right: 10px; }

/* Password strength */
.pw-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.pw-strength.visible { opacity: 1; }
.pw-strength-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.3s;
}
.pw-strength[data-level="1"] .pw-strength-bar:nth-child(1) { background: var(--danger); }
.pw-strength[data-level="2"] .pw-strength-bar:nth-child(-n+2) { background: var(--warm); }
.pw-strength[data-level="3"] .pw-strength-bar:nth-child(-n+3) { background: var(--accent); }
.pw-strength[data-level="4"] .pw-strength-bar { background: var(--success); }

.pw-hint {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 6px;
  line-height: 1.5;
}

/* ─── Terms Checkbox ─── */
.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 4px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.terms-row:hover { border-color: var(--primary); background: rgba(0, 212, 180, 0.04); }
.terms-cb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-2);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  transition: all 0.2s var(--ease-out);
}
.terms-cb:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.terms-cb:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #041812;
  font-size: 13px;
  font-weight: 900;
}
.terms-cb:focus-visible { box-shadow: 0 0 0 4px rgba(0, 212, 180, 0.2); outline: none; }
.terms-text {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  user-select: none;
}
.terms-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}
.terms-text a:hover { text-decoration: underline; }

/* ─── Submit Button ─── */
.btn-register {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #041812;
  border: none;
  border-radius: 11px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 8px 28px rgba(0, 212, 180, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.btn-register:hover:not(:disabled) {
  background: #1EE0C0;
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(0, 212, 180, 0.4);
}
.btn-register:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-register .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(4, 24, 18, 0.3);
  border-top-color: #041812;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-register.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── OTP Screen ─── */
.otp-header {
  text-align: center;
  margin-bottom: 24px;
}
.otp-icon {
  width: 72px; height: 72px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, rgba(0, 212, 180, 0.15), rgba(91, 141, 239, 0.15));
  border: 1px solid rgba(0, 212, 180, 0.3);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.otp-title { font-size: 18px; font-weight: 800; color: var(--white); margin-bottom: 6px; }
.otp-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.otp-email { font-size: 14px; color: var(--primary); font-weight: 700; }
.otp-back {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all 0.2s;
}
.otp-back:hover { color: var(--primary); background: rgba(0, 212, 180, 0.08); }

/* OTP boxes */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  direction: ltr;
}
.otp-inputs input {
  width: 48px; height: 58px;
  background: var(--bg-2);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  color: var(--white);
  font-family: inherit;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  outline: none;
  transition: all 0.2s var(--ease-out);
}
.otp-inputs input:focus {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(0, 212, 180, 0.12);
  transform: scale(1.04);
}
.otp-inputs input.filled {
  border-color: var(--primary);
  color: var(--primary);
}

/* Resend */
.resend-row {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.resend-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.resend-btn:hover { color: #1EE0C0; }
.resend-timer {
  font-size: 12px;
  color: var(--text-mute);
  display: none;
}

/* ─── Login Link ─── */
.login-link {
  text-align: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.login-link a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s;
}
.login-link a:hover { color: #1EE0C0; text-decoration: underline; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  body { padding: 64px 16px 32px; align-items: flex-start; }
  .back-home { top: 14px; right: 14px; padding: 8px 12px; font-size: 12px; }
  [dir="ltr"] .back-home { right: auto; left: 14px; }
  .register-box { padding: 28px 22px 24px; border-radius: 20px; }
  .logo img { width: 110px; }
  .logo h1 { font-size: 19px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-group input { padding: 11px 38px 11px 13px; font-size: 13px; }
  [dir="ltr"] .form-group input { padding: 11px 13px 11px 38px; }
  .steps-indicator { gap: 6px; }
  .step-line { width: 24px; }
  .step-dot { font-size: 10px; }
  .otp-inputs { gap: 6px; }
  .otp-inputs input { width: 42px; height: 52px; font-size: 20px; }
  .otp-icon { width: 60px; height: 60px; font-size: 28px; }
  .otp-title { font-size: 16px; }
}
