﻿:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --secondary: #64748b;
  --success: #16a34a;
  --error: #dc2626;
  --danger: #dc2626;
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --neon-blue: #00f0ff;
  --neon-pink: #ff006e;
  --neon-green: #00ff9f;
}

* { box-sizing: border-box; }

body {
  font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
  min-height: 100vh;
  display: block !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  padding: 0 !important;
  margin: 0;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 50%, rgba(0, 240, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 0, 110, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 2px solid rgba(0, 240, 255, 0.2);
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  overflow: clip;
}

.brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  min-width: 0;
}

.logo-seal {
  position: relative;
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-ring {
  position: absolute;
  inset: -7px;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  animation: hb-ring-spin 20s linear infinite;
}

.logo-ring-text {
  fill: rgba(0, 240, 255, 0.88);
  font-size: 8.4px;
  letter-spacing: 0.4px;
  font-family: "Noto Naskh Arabic", serif;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 240, 255, 0.2);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.22), 0 0 26px rgba(0, 240, 255, 0.16);
}

.topbar .home-button {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  color: #f1f5f9;
  text-decoration: none;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(139, 0, 255, 0.14));
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 16px rgba(0, 240, 255, 0.15);
  backdrop-filter: blur(10px);
}

.topbar .home-button:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 240, 255, 0.7);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), 0 0 24px rgba(0, 240, 255, 0.32);
}

.topbar .home-button svg {
  width: 16px;
  height: 16px;
}

.system-chip {
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(255, 178, 45, 0.55);
  min-height: 34px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffe9c0;
  background: linear-gradient(135deg, rgba(255, 145, 0, 0.18), rgba(255, 58, 58, 0.12));
  box-shadow: 0 0 12px rgba(255, 145, 0, 0.26);
}

.secure-chip {
  font-size: 11px;
  line-height: 1;
  min-height: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 159, 0.5);
  background: rgba(0, 255, 159, 0.16);
  color: #e4fff3;
  white-space: nowrap;
  letter-spacing: 0.01em;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 255, 159, 0.18);
}

.brand {
  font-size: 34px;
  font-weight: 700;
  color: var(--neon-blue);
  letter-spacing: 0.02em;
  justify-self: center;
}

.brand-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  border-radius: 18px;
  border: 1px solid transparent;
  background:
    linear-gradient(rgba(2, 6, 23, 0.9), rgba(2, 6, 23, 0.9)) padding-box,
    linear-gradient(120deg, rgba(0, 240, 255, 0.8), rgba(255, 0, 110, 0.85), rgba(0, 255, 159, 0.82)) border-box;
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.22),
    0 0 18px rgba(0, 240, 255, 0.24),
    0 0 30px rgba(255, 0, 110, 0.12);
  overflow: hidden;
}

.brand-frame::before {
  content: "";
  position: absolute;
  inset: -120% -40%;
  background: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.16), transparent 60%);
  transform: rotate(8deg);
  animation: hb-brand-shine 4s linear infinite;
  pointer-events: none;
}

.brand-ar {
  font-family: "Noto Naskh Arabic", serif;
  direction: rtl;
  line-height: 1;
  transform: perspective(420px) rotateX(13deg);
  background: linear-gradient(90deg, #cbf7ff 0%, #00f0ff 30%, #f8feff 55%, #00ff9f 80%, #cbf7ff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 1px 0 #063149,
    0 2px 0 #063149,
    0 3px 0 #052235,
    0 4px 0 #031a2a,
    0 8px 18px rgba(0, 240, 255, 0.38),
    0 16px 34px rgba(0, 0, 0, 0.46);
  animation: hb-brand-flow 6s ease-in-out infinite;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  min-width: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.65);
}

.topbar .lang-btn {
  border: 0;
  color: var(--text-muted);
  background: transparent;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar .lang-btn + .lang-btn {
  border-left: 1px solid rgba(0, 240, 255, 0.2);
}

.topbar .lang-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.32), rgba(139, 0, 255, 0.28));
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  animation: fadeIn 0.3s ease-in;
  position: relative;
  z-index: 1;
}

.auth-shell {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 100px;
}

.logo {
  text-align: center;
  margin-bottom: 20px;
}

#authScreen .logo h1 {
  margin-bottom: 18px;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.04;
  background: linear-gradient(90deg, #cbf7ff 0%, #00f0ff 30%, #f8feff 55%, #00ff9f 80%, #cbf7ff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 2px 0 rgba(3, 12, 22, 0.95),
    0 8px 22px rgba(0, 240, 255, 0.24),
    0 16px 36px rgba(0, 0, 0, 0.45);
  animation: hb-brand-flow 6s ease-in-out infinite;
}

#authScreen .logo .subtitle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 240, 255, 0.22);
  background: linear-gradient(140deg, rgba(3, 9, 24, 0.86), rgba(8, 18, 38, 0.8));
  color: #b8d5e8;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.34);
  margin-top: 2px;
}

.form-card {
  width: min(680px, 94vw);
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  border-radius: 16px;
  padding: 32px;
  animation: slideUp 0.3s ease-out;
}

#authScreen .form-card {
  background: linear-gradient(165deg, rgba(8, 17, 34, 0.94) 0%, rgba(10, 24, 46, 0.9) 100%);
  border: 1px solid rgba(0, 240, 255, 0.28);
  box-shadow:
    0 24px 46px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(0, 240, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -20px 30px rgba(0, 0, 0, 0.2);
}

#authScreen .form-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  background: linear-gradient(140deg, rgba(0, 240, 255, 0.1), transparent 30%, transparent 70%, rgba(0, 240, 255, 0.06));
}

.form-card h2 {
  font-size: 24px;
  margin: 0 0 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.input-group {
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.8) !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #f1f5f9 !important;
  -webkit-text-fill-color: #f1f5f9 !important;
  caret-color: #f1f5f9;
  font-size: 16px;
  transition: all 0.2s;
}

.input-group input:focus {
  outline: none;
  background: rgba(15, 23, 42, 0.85) !important;
  border-color: var(--neon-blue);
  box-shadow:
    0 0 0 3px rgba(0, 240, 255, 0.1),
    0 0 20px rgba(0, 240, 255, 0.3);
}

#loginForm .input-group input,
#registerForm .input-group input {
  background: rgba(15, 23, 42, 0.8) !important;
}

.input-group input::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

#authScreen .form-card .input-group input:-webkit-autofill,
#authScreen .form-card .input-group input:-webkit-autofill:hover,
#authScreen .form-card .input-group input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f1f5f9 !important;
  transition: background-color 5000s ease-in-out 0s;
  box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.8) inset !important;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 48px;
}

.btn-toggle-password {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle-password:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-toggle-password svg {
  width: 20px;
  height: 20px;
}

.btn-toggle-password .eye-off-icon.hidden,
.btn-toggle-password .eye-icon.hidden,
.hidden {
  display: none !important;
}

.btn-3d {
  min-height: 48px;
  padding: 12px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--neon-blue) 0%, #0080ff 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow:
    0 4px 0 0 #005bb5,
    0 8px 16px rgba(0, 128, 255, 0.3),
    0 0 30px rgba(0, 240, 255, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-3d:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 0 #005bb5,
    0 12px 24px rgba(0, 128, 255, 0.4),
    0 0 40px rgba(0, 240, 255, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.btn-3d:active {
  transform: translateY(2px);
}

.btn-3d.btn-auth-prime {
  background: linear-gradient(145deg, #0b1220 0%, #0f1a2f 100%);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #e6f7ff;
  box-shadow:
    0 4px 0 0 #0a1426,
    0 10px 20px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(0, 240, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-3d.btn-auth-prime:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 240, 255, 0.55);
  box-shadow:
    0 5px 0 0 #0a1426,
    0 14px 28px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(0, 240, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-3d-compact {
  min-width: 220px;
  max-width: 280px;
  min-height: 40px;
  padding: 10px 18px;
  font-size: 15px;
  gap: 8px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
}

.btn-3d.loading > * {
  opacity: 0;
}

.btn-3d.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 240, 255, 0.24);
  border-top-color: #a9fbff;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
  transform: translate(-50%, -50%);
}

.links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.auth-link-btn {
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(7, 16, 31, 0.95), rgba(12, 25, 48, 0.9));
  color: #d9f6ff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow:
    0 3px 0 0 #0a1426,
    0 10px 18px rgba(0, 0, 0, 0.35),
    0 0 14px rgba(0, 240, 255, 0.1);
}

.auth-link-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 240, 255, 0.52);
  box-shadow:
    0 4px 0 0 #0a1426,
    0 14px 24px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(0, 240, 255, 0.18);
}

.auth-link-btn:active {
  transform: translateY(1px);
}

.auth-link-btn-wide { grid-column: 1 / -1; }

.info-text {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.5;
}

.error {
  margin-top: 16px;
  padding: 12px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid var(--error);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 14px;
  text-align: center;
}

.success {
  margin-top: 16px;
  padding: 12px;
  background: rgba(0, 255, 159, 0.1);
  border: 1px solid var(--neon-green);
  border-radius: 8px;
  color: var(--neon-green);
  font-size: 14px;
  text-align: center;
}

@keyframes hb-brand-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes hb-ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes hb-brand-shine {
  from { transform: translateX(-45%) rotate(8deg); }
  to { transform: translateX(45%) rotate(8deg); }
}

@keyframes btn-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .btn-3d-compact {
    min-width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  body {
    padding-top: 74px !important;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    justify-items: stretch;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    top: 0;
    overflow: visible;
  }

  .brand-wrap {
    justify-self: start;
    gap: 8px;
  }

  .brand-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 8px 10px;
    max-width: calc(100vw - 136px);
    min-width: 0;
    z-index: 1;
    pointer-events: none;
  }

  .auth-shell {
    min-height: calc(100vh - 148px);
  }

  .brand-ar {
    font-size: clamp(20px, 7vw, 28px);
    white-space: nowrap;
  }

  .header-meta {
    justify-self: end;
    position: relative;
    z-index: 2;
  }

  .brand-logo,
  .logo-seal {
    width: 44px;
    height: 44px;
  }

  .topbar .home-button {
    width: 34px;
    height: 34px;
  }

  .system-chip {
    display: none;
  }

  .secure-chip {
    display: none;
  }

  .form-card {
    padding: 24px;
  }

  .logo h1 {
    font-size: 28px;
  }

  .links {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .auth-link-btn-wide {
    grid-column: auto;
  }
}
