﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #030305;
  --card: rgba(16, 16, 20, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: rgba(0, 0, 0, 0.35);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --error: #f43f5e;
}

html, body { 
  height: 100%; 
  width: 100%;
  overflow: hidden; 
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Background effects */
.background-effects {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.mesh-layer {
  position: absolute;
  inset: -50%;
  background-image: 
    radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.14) 0%, transparent 45%),
    radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.08) 0%, transparent 35%),
    radial-gradient(ellipse at 20% 80%, rgba(14, 165, 233, 0.1) 0%, transparent 45%);
  animation: meshFlow 22s ease-in-out infinite alternate;
  transform-origin: center;
}

.background-effects::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

@keyframes meshFlow {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(12deg) scale(1.08); }
}

#bgCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Wrapper */
.login-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card */
.card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border);
  border-top: 1px solid rgba(255,255,255,0.15);
  border-left: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 
    0 0 0 1px rgba(0,0,0,0.5),
    0 24px 48px -12px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.08);
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card.shake { 
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; 
}

@keyframes shake {
  10%, 90% { transform: translateX(-4px); }
  20%, 80% { transform: translateX(6px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* Header */
.card-header {
  display: flex; 
  flex-direction: column; 
  align-items: center;
  text-align: center; 
  margin-bottom: 32px;
}

.logo {
  width: 52px; 
  height: 52px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(168, 85, 247, 0.18));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  display: flex; 
  align-items: center; 
  justify-content: center;
  margin-bottom: 18px; 
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.logo svg { 
  width: 26px; 
  height: 26px; 
}

.title {
  font-size: 22px; 
  font-weight: 700; 
  letter-spacing: -0.4px;
  margin-bottom: 6px;
  background: linear-gradient(to right, #fff, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle { 
  font-size: 14px; 
  color: var(--text-muted); 
}

/* Fields */
.field { 
  margin-bottom: 20px; 
  display: flex; 
  flex-direction: column; 
}

.field label {
  font-size: 12px; 
  font-weight: 600; 
  letter-spacing: 0.3px;
  text-transform: uppercase; 
  color: var(--text-muted);
  margin-bottom: 8px; 
  transition: color 0.2s;
}

.field:focus-within label { 
  color: var(--text); 
}

.field input {
  height: 46px; 
  background: var(--input-bg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; 
  padding: 0 16px;
  color: var(--text); 
  font-size: 14.5px; 
  outline: none;
  transition: all 0.25s ease; 
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
}

.field input:focus {
  background: rgba(0,0,0,0.55);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.2), 
    0 0 0 3px rgba(99, 102, 241, 0.18);
}

.field input::placeholder { 
  color: #475569; 
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px #09090b inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Error message */
.error-msg {
  display: flex; 
  align-items: center; 
  gap: 8px;
  color: var(--error); 
  font-size: 13px; 
  font-weight: 500;
  height: 0; 
  margin-bottom: 0; 
  overflow: hidden;
  opacity: 0; 
  transform: translateY(-4px); 
  transition: all 0.3s;
}

.error-msg.show { 
  opacity: 1; 
  transform: translateY(0); 
  height: auto; 
  min-height: 20px; 
  margin-bottom: 16px; 
}

.error-msg svg { 
  width: 16px; 
  height: 16px; 
  flex-shrink: 0; 
}

/* Submit button */
.btn-submit {
  width: 100%; 
  height: 48px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff; 
  border: none; 
  border-radius: 10px;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 14.5px; 
  font-weight: 600; 
  cursor: pointer;
  position: relative; 
  overflow: hidden; 
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-submit:hover { 
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45); 
  transform: translateY(-1px); 
}

.btn-submit:active { 
  transform: scale(0.98); 
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3); 
}

.btn-submit:disabled { 
  opacity: 0.7; 
  cursor: not-allowed; 
  transform: none; 
}

.btn-submit.success { 
  background: linear-gradient(135deg, #10b981, #059669); 
}

.btn-loader { 
  position: absolute; 
  inset: 0; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  opacity: 0; 
}

.btn-submit.loading .btn-text { 
  opacity: 0; 
}

.btn-submit.loading .btn-loader { 
  opacity: 1; 
}

.spinner {
  width: 18px; 
  height: 18px; 
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; 
  border-radius: 50%; 
  animation: spin 0.8s linear infinite;
}

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