/* =============================================
   KAMU SACCO - Authentication Page Styles
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --white: #ffffff;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 12px;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1d4ed8 100%);
  z-index: -1;
}

body::after {
  content: '';
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  border-radius: 50%;
  z-index: -1;
  animation: float 8s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(40px) scale(1.05); }
}

/* Floating circles */
.bg-circles {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.bg-circles span {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  animation: rise linear infinite;
}

.bg-circles span:nth-child(1) { width: 80px; height: 80px; left: 10%; animation-duration: 12s; animation-delay: 0s; }
.bg-circles span:nth-child(2) { width: 40px; height: 40px; left: 25%; animation-duration: 8s; animation-delay: 2s; }
.bg-circles span:nth-child(3) { width: 120px; height: 120px; left: 50%; animation-duration: 15s; animation-delay: 4s; }
.bg-circles span:nth-child(4) { width: 60px; height: 60px; left: 70%; animation-duration: 10s; animation-delay: 1s; }
.bg-circles span:nth-child(5) { width: 100px; height: 100px; left: 85%; animation-duration: 14s; animation-delay: 3s; }

@keyframes rise {
  0% { bottom: -150px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.5; }
  100% { bottom: 110%; opacity: 0; }
}

/* Auth wrapper */
.auth-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 12px;
  position: relative;
  z-index: 1;
}

/* Auth card */
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

/* Brand header */
.auth-brand {
  background:
    radial-gradient(circle at center, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 45%, rgba(0,0,0,0.15) 70%, transparent 90%),
    linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
  padding: 14px 24px 20px;
  text-align: center;
  color: white;
}

.auth-brand .logo {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1243 / 709;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2px;
}
.auth-brand .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(1.12) saturate(1.35) contrast(1.08);
}

.auth-tagline {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.4px;
  margin-top: -8px;
  margin-bottom: 8px;
}

.auth-brand h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.auth-brand p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
}

/* Auth form */
.auth-form-wrap {
  padding: 20px 22px 22px;
}

.auth-form-wrap h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-form-wrap .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Form groups */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
}

.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-wrap input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-wrap .toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  transition: color 0.2s;
}

.input-wrap .toggle-password:hover { color: var(--primary); }

/* Remember me / forgot */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
}

.remember-me input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Login button */
.btn-login {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  letter-spacing: 0.5px;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* Loading spinner on button */
.btn-login .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Error alert */
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  color: #991b1b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 12px;
  display: none;
  align-items: center;
  gap: 8px;
}

.alert-error.show { display: flex; }

/* Demo credentials hint */
.demo-hint {
  margin-top: 12px;
  padding: 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  font-size: 11px;
  color: #0369a1;
}

.demo-hint strong { display: block; margin-bottom: 4px; font-size: 11px; }
.demo-hint table { width: 100%; border-collapse: collapse; }
.demo-hint td { padding: 1px 4px; }
.demo-hint td:first-child { font-weight: 600; color: #0f172a; }

/* Footer */
.auth-footer {
  text-align: center;
  padding: 10px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* Input error state */
.input-wrap input.error {
  border-color: var(--danger);
  background: #fff5f5;
}

/* Responsive */
@media (max-width: 480px) {
  body { padding: 8px; }
  .auth-wrapper { padding: 8px; }
  .auth-brand { padding: 10px 16px 14px; }
  .auth-brand .logo { max-width: 220px; }
  .auth-form-wrap { padding: 14px 14px 16px; }
  .auth-card { max-height: calc(100vh - 20px); }
}
