:root {
  --bg:       #0a0c10;
  --bg2:      #111318;
  --bg3:      #181c24;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.12);
  --text:     #e8eaf0;
  --muted:    #7a8099;
  --accent:   #4f7cff;
  --accent2:  #7b5ea7;
  --green:    #27c98f;
  --amber:    #f5a623;
  --red:      #f05252;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* ── BACKGROUND PATTERN ── */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(79, 124, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(123, 94, 167, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(39, 201, 143, 0.05) 0%, transparent 50%);
  z-index: -1;
}

.bg-pattern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* ── LOGIN CONTAINER ── */
.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  z-index: 1;
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ── LOGO SECTION ── */
.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.logo-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-align: center;
}

.logo-text span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── WELCOME SECTION ── */
.welcome-section {
  text-align: center;
  margin-bottom: 32px;
}

.welcome-section h1 {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.welcome-section p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── FORM STYLES ── */
.login-form {
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: all 0.15s ease;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.1);
}

.form-group input::placeholder {
  color: var(--muted);
}

/* ── FORM OPTIONS ── */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 13px;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

.forgot-link {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

.forgot-link:hover {
  color: #3d6ae8;
}

/* ── LOGIN BUTTON ── */
.login-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(79, 124, 255, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-text, .btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── DEMO SECTION ── */
.demo-section {
  margin-bottom: 24px;
}

.demo-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demo-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-card {
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.demo-card:hover {
  border-color: var(--accent);
  background: rgba(79, 124, 255, 0.05);
}

.demo-role {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.demo-creds {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
}

.backend-status {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  border: 1px solid var(--border);
}

.backend-status.online {
  border-color: var(--green);
  background: rgba(39, 201, 143, 0.05);
}

.backend-status.offline {
  border-color: var(--red);
  background: rgba(240, 82, 82, 0.05);
}

.status-indicator {
  font-size: 10px;
}

.status-text {
  color: var(--muted);
  font-weight: 500;
}

/* ── FOOTER ── */
.login-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.login-footer p {
  font-size: 12px;
  color: var(--muted);
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 300px;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

#toast.success {
  border-color: var(--green);
  background: rgba(39, 201, 143, 0.1);
}

#toast.error {
  border-color: var(--red);
  background: rgba(240, 82, 82, 0.1);
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .login-container {
    padding: 16px;
  }
  
  .login-card {
    padding: 32px 24px;
  }
  
  .welcome-section h1 {
    font-size: 24px;
  }
  
  .demo-cards {
    grid-template-columns: 1fr;
  }
}

/* OTP step extras */
.otp-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.resend-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.resend-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.resend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
