/* ============================================================
   صفحة تسجيل الدخول — نظام إدارة المقاولين (RTL)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(245, 158, 11, .08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(14, 165, 233, .06) 0%, transparent 60%);
  pointer-events: none;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 250px;
  height: 250px;
  border-radius: 16px;
  margin: 0 auto 12px;
  object-fit: contain;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .3), 0 8px 24px rgba(0, 0, 0, .4);
}

.login-app-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.login-app-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4);
}

.login-heading {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-sub {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: .875rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.form-control {
  width: 100%;
  padding: 11px 42px 11px 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  direction: rtl;
  text-align: right;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.toggle-pw {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  transition: color .2s;
}

.toggle-pw:hover {
  color: var(--primary);
}

.form-error {
  margin-top: 5px;
  font-size: .8rem;
  color: var(--danger);
  display: none;
}

.form-error.visible {
  display: block;
}

.alert-error {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .875rem;
  color: #fca5a5;
  margin-bottom: 16px;
  display: none;
}

.alert-error.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #0f172a;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  background: var(--primary-dark);
}

.btn-login:active {
  transform: scale(.98);
}

.btn-login:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: .8rem;
  color: var(--text-muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(15, 23, 42, .3);
  border-top-color: #0f172a;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}