/* ============================================================
   Bank of DSA — Authentication Page (index.html)
   IBM Plex Sans · Primary #2563EB · Minimal Professional
   ============================================================ */

/* ── Custom Properties ────────────────────────────────────── */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-darker: #1e3a8a;
  --accent: #f97316;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-placeholder: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --error: #ef4444;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-primary: 0 6px 24px rgba(37, 99, 235, 0.3);

  --t-fast: 150ms ease-out;
  --t-base: 250ms ease-out;
  --t-slow: 350ms ease-out;

  --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button {
  font-family: var(--font);
  cursor: pointer;
}

/* ── Auth Layout ──────────────────────────────────────────── */
.auth-container {
  display: flex;
  min-height: 100dvh;
}

/* ── Brand Panel ──────────────────────────────────────────── */
.brand-panel {
  width: 44%;
  background: linear-gradient(140deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Decorative blobs */
.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.brand-panel::before {
  width: 440px;
  height: 440px;
  top: -160px;
  right: -140px;
  background: rgba(255, 255, 255, 0.06);
}
.brand-panel::after {
  width: 560px;
  height: 560px;
  bottom: -220px;
  left: -160px;
  background: rgba(255, 255, 255, 0.04);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 56px;
  animation: fadeUp 0.6s ease-out both;
}

.brand-logo-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.brand-logo-name {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-headline {
  color: #fff;
  font-size: clamp(26px, 2.8vw, 40px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  animation: fadeUp 0.6s 0.1s ease-out both;
}

.brand-tagline {
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  margin-bottom: 48px;
  line-height: 1.65;
  animation: fadeUp 0.6s 0.2s ease-out both;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp 0.6s 0.3s ease-out both;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 500;
}

.brand-feature-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Form Panel ───────────────────────────────────────────── */
.form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 40px;
  background: var(--card);
  overflow-y: auto;
}

.form-panel-inner {
  width: 100%;
  max-width: 420px;
}

/* Mobile logo — only visible on small screens */
.mobile-logo {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 36px;
}
.mobile-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-logo-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ── Tab Switcher ─────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 32px;
  position: relative;
}

.tab-slider {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: calc(50% - 4px);
  background: var(--card);
  border-radius: calc(var(--radius-md) - 4px);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--t-base);
  pointer-events: none;
}
.tab-slider.at-signup {
  transform: translateX(100%);
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: calc(var(--radius-md) - 4px);
  transition: color var(--t-fast);
  position: relative;
  z-index: 1;
}
.tab-btn.active {
  color: var(--text);
}
.tab-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Form ─────────────────────────────────────────────────── */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 20px;
}
.auth-form.active {
  display: flex;
  animation: fadeUp var(--t-slow) both;
}

.form-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.form-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 0;
}

/* ── Floating-Label Input ─────────────────────────────────── */
.input-group {
  position: relative;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}
.input-group input::placeholder {
  color: transparent;
}
.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.input-group input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-group label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(
    -56%
  ); /* nudge slightly above the math-center so capital text reads centered */
  font-size: 15px;
  color: var(--text-placeholder);
  pointer-events: none;
  transition: all var(--t-fast);
  background: var(--card);
  padding: 0 4px;
  line-height: 1;
}
.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  top: 0;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}
.input-group input.error ~ label {
  color: var(--error);
}

/* Password input right-padding to avoid overlap with toggle */
.input-group.password-group input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast);
}
.password-toggle:hover {
  color: var(--text);
}
.password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Error text below input */
.input-error-text {
  display: none;
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  padding-left: 16px;
}
.input-group.has-error .input-error-text {
  display: block;
}

/* ── Primary Button ───────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  position: relative;
  overflow: hidden;
  transition:
    background var(--t-fast),
    box-shadow var(--t-fast),
    transform var(--t-fast);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: scale(0.99);
  box-shadow: none;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Spinner inside button */
.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.loading .btn-text {
  display: none;
}
.btn-primary.loading .btn-spinner {
  display: block;
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  transform: scale(0);
  animation: ripple-anim 0.6s linear forwards;
  pointer-events: none;
}

/* ── Form Footer ──────────────────────────────────────────── */
.form-footer {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
}
.link-btn:hover {
  text-decoration: underline;
}

/* ── Account Created Success Screen ──────────────────────── */
.account-success {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 8px 0;
}
.account-success.visible {
  display: flex;
  animation: fadeUp var(--t-slow) both;
}

.success-icon-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.success-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.account-number-box {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--primary);
  text-align: center;
}

.account-note {
  font-size: 13px;
  color: var(--text-muted);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: toastIn var(--t-base) ease-out;
  cursor: pointer;
}
.toast.success {
  background: #065f46;
}
.toast.error {
  background: #991b1b;
}
.toast.info {
  background: #1e40af;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  animation: toastProgress 3.5s linear forwards;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(110%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(110%);
  }
}
.toast.removing {
  animation: toastOut var(--t-base) ease-in forwards;
}

@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* shake — triggered by JS for form errors */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}
.shake {
  animation: shake 400ms ease-out;
}

/* pulse-once — used on balance after update */
@keyframes pulseOnce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}
.pulse-once {
  animation: pulseOnce 300ms ease-out;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .brand-panel {
    width: 40%;
    padding: 48px 36px;
  }
}

@media (max-width: 700px) {
  .auth-container {
    flex-direction: column;
  }
  .brand-panel {
    display: none;
  }
  .mobile-logo {
    display: flex;
  }
  .form-panel {
    padding: 40px 24px;
  }

  .toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }
  .toast {
    min-width: unset;
    max-width: unset;
    width: 100%;
  }
}

/* ── Accessibility: reduced motion ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
