/*
  Pump Agent AI — Login Page
  Mobile-first, fully responsive across all screen sizes
*/

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

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

/* ─── Tokens ─── */
:root {
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-glow:   rgba(37, 99, 235, 0.25);
  --secondary:      #0f172a;
  --muted:          #64748b;
  --light-muted:    #94a3b8;
  --border:         #e2e8f0;
  --surface:        rgba(255, 255, 255, 0.92);
  --surface-input:  #f8fafc;
  --error-bg:       #fef2f2;
  --error-text:     #b91c1c;
  --radius-xl:      28px;
  --radius-lg:      18px;
  --radius-md:      14px;
  --shadow-card:
    0 4px 6px -2px rgba(15, 23, 42, 0.04),
    0 20px 60px -10px rgba(15, 23, 42, 0.14);
}

/* ─── Body ─── */
body.login-page {
  font-family: 'Cairo', sans-serif;
  min-height: 100svh;         /* svh = safe viewport height — fixes iOS bar issue */
  min-height: 100vh;
  background: linear-gradient(145deg, #e8f0fe 0%, #dbeafe 40%, #eff6ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  position: relative;
  overflow-x: hidden;
  padding: 16px;              /* safe breathing room on all sides */
}

/* ─── Animated Background Blobs ─── */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: blobFloat 18s ease-in-out infinite;
  /* clamp keeps blobs from being huge on large screens or tiny on small */
}

.blob-1 {
  width: clamp(200px, 40vw, 500px);
  height: clamp(200px, 40vw, 500px);
  background: radial-gradient(circle, #3b82f6, #6366f1);
  top: -10%;
  right: -8%;
  animation-delay: 0s;
}

.blob-2 {
  width: clamp(160px, 30vw, 380px);
  height: clamp(160px, 30vw, 380px);
  background: radial-gradient(circle, #60a5fa, #a78bfa);
  bottom: -8%;
  left: -6%;
  animation-delay: -7s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.05); }
  66%       { transform: translate(-15px, 25px) scale(0.97); }
}

/* ─── Shell (centering wrapper) ─── */
.login-shell {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;           /* comfortable form width */
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ─── Card ─── */
.login-card {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  /* fluid padding: enough on desktop, snug on mobile */
  padding: clamp(24px, 6vw, 48px) clamp(20px, 6vw, 44px);
  box-shadow: var(--shadow-card);
}

/* ─── Brand / Logo ─── */
.login-brand {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.login-brand img {
  width: clamp(70px, 18vw, 110px);
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.15));
}

.login-brand h1 {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.login-brand p {
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  color: var(--light-muted);
  font-weight: 600;
}

/* ─── Tabs ─── */
.login-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 5px;
  border-radius: var(--radius-lg);
  margin-bottom: 26px;
  gap: 4px;
}

.login-tab {
  flex: 1;
  padding: 11px 8px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(0.8rem, 2.5vw, 0.93rem);
  color: var(--muted);
  cursor: pointer;
  border-radius: 13px;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;        /* prevents text wrapping inside tabs */
}

.login-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.login-tab:hover:not(.active) {
  color: var(--secondary);
  background: rgba(255,255,255,0.5);
}

/* ─── Error Box ─── */
.login-err {
  display: none;
  background: var(--error-bg);
  color: var(--error-text);
  padding: 13px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  border-inline-end: 4px solid var(--error-text);  /* RTL-safe */
  animation: shake 0.4s ease-in-out;
  line-height: 1.5;
}

.login-err.show { display: block; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

/* ─── Form Fields ─── */
.login-field {
  margin-bottom: 20px;
}

.login-field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.login-field input {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-input);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  /* fixes iOS zoom on focus — font-size must be ≥ 16px on iOS */
}

/* iOS fix: prevent auto-zoom on focus */
@supports (-webkit-touch-callout: none) {
  .login-field input {
    font-size: max(1rem, 16px);
  }
}

.login-field input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ─── Submit Button ─── */
.login-submit {
  width: 100%;
  padding: 15px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.4);
  margin-top: 6px;
  /* touch-action fix for mobile tap accuracy */
  touch-action: manipulation;
}

.login-submit:hover {
  background: var(--primary-hover);
  box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.login-submit:active  { transform: scale(0.97); }

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Hint ─── */
.login-hint {
  text-align: center;
  margin-top: 24px;
  font-size: 0.82rem;
  color: var(--light-muted);
  line-height: 1.6;
  padding: 0 4px;
}

/* ─── Responsive Breakpoints ─── */

/* Small phones (< 360px) */
@media (max-width: 359px) {
  .login-card {
    padding: 20px 14px;
  }
  .login-tab {
    font-size: 0.76rem;
    gap: 4px;
    padding: 10px 4px;
  }
}

/* Landscape phones / Small tablets */
@media (max-height: 600px) and (orientation: landscape) {
  body.login-page {
    align-items: flex-start;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .login-brand {
    margin-bottom: 16px;
    padding-bottom: 14px;
  }
  .login-brand img {
    width: 60px;
    margin-bottom: 6px;
  }
  .login-field {
    margin-bottom: 14px;
  }
}

/* Large screens — center tightly */
@media (min-width: 640px) {
  .login-shell {
    max-width: 460px;
  }
}

.hidden { display: none !important; }

.login-ok {
  display: none;
  background: #ecfdf5;
  color: #047857;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  border-inline-end: 4px solid #059669;
  line-height: 1.5;
}
.login-ok.show { display: block; }

.login-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.login-link-btn:hover { color: var(--primary-hover); }

.login-forgot-panel { margin-top: 4px; }
.login-forgot-lead {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 18px;
  font-weight: 600;
}
.login-otp-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-input);
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--secondary);
  outline: none;
}
.login-otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.login-hint-sep { margin: 0 8px; color: var(--light-muted); }
.login-hint a { color: var(--primary); font-weight: 800; text-decoration: none; }
.login-hint a:hover { text-decoration: underline; }
