/* ============================================================
   auth.css — Login / Register / Auth overlay styles
   Follows the silatek design system (Tajawal, #30ab59, #4162a9)
   ============================================================ */

/* ---- Full-screen overlay ---- */

#auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a4731 0%, #1e3a6b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
}

#auth-overlay.hidden {
  display: none;
}

/* ---- Auth card ---- */

.auth-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.auth-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 28px 32px 24px;
  text-align: center;
  color: #fff;
}

.auth-card-header .auth-logo {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 8px;
}

.auth-card-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.auth-card-header p {
  font-size: 0.85rem;
  opacity: 0.88;
  margin: 0;
}

/* ---- Tab switcher (login / register) ---- */

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
}

.auth-tab-btn {
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.auth-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.auth-tab-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---- Form body ---- */

.auth-form-body {
  padding: 28px 32px 32px;
}

.auth-section {
  display: none;
}

.auth-section.active {
  display: block;
}

.auth-field {
  margin-bottom: 18px;
}

.auth-field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--bg-page);
  box-sizing: border-box;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: ltr;   /* email & password always LTR */
}

.auth-field input[type="text"],
.auth-field input.rtl-input {
  direction: rtl;   /* Arabic text inputs (family name) */
}

.auth-field input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  background: var(--bg-card);
}

/* ---- Submit button ---- */

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition), transform 0.1s;
  margin-top: 6px;
}

.auth-submit-btn:hover  { opacity: 0.92; }
.auth-submit-btn:active { transform: scale(0.98); }
.auth-submit-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.auth-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Error / info message ---- */

.auth-message {
  min-height: 22px;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 14px;
  border-radius: 6px;
  padding: 0;
  transition: all 0.2s;
}

.auth-message.error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 8px 12px;
}

.auth-message.success {
  color: var(--green-700);
  background: var(--primary-light);
  padding: 8px 12px;
}

/* ---- Forgot password link ---- */

.auth-forgot-link {
  display: block;
  text-align: center;
  font-size: 0.82rem;
  color: var(--secondary);
  text-decoration: none;
  margin-top: 14px;
  cursor: pointer;
  border-radius: var(--radius-xs);
}

.auth-forgot-link:hover { text-decoration: underline; }
.auth-forgot-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---- Divider (أو) ---- */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Google Sign-In button ---- */

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: #fff;
  color: #374151;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}

.auth-google-btn:hover {
  background: var(--bg-page);
  box-shadow: 0 1px 6px rgba(0,0,0,.1);
}

.auth-google-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.auth-google-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Loading spinner inside button ---- */

.auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

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

/* ---- Logged-in user chip (top-right of header) ---- */

#auth-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #fff;
  transition: background 0.2s;
}

#auth-user-chip:hover { background: rgba(255,255,255,0.25); }
#auth-user-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,.5);
}

#auth-user-chip .chip-icon {
  width: 26px;
  height: 26px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

#auth-user-chip.hidden { display: none; }

/* ---- Responsive ---- */

@media (max-width: 480px) {
  .auth-form-body { padding: 22px 20px 28px; }
  .auth-card-header { padding: 22px 20px 18px; }
}
