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

:root {
  --red: #C62828;
  --red-hover: #B71C1C;
  --red-light: rgba(198, 40, 40, 0.07);
  --red-glow: rgba(198, 40, 40, 0.12);
  --surface: #FFFFFF;
  --border: #E2E4E9;
  --text: #1A1A2E;
  --text-secondary: #5A5B6A;
  --text-muted: #9394A1;
  --input-bg: #F8F9FB;
  --shadow-card: 0 8px 40px rgba(0,0,0,0.08);
}

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(155deg, #FFFFFF 0%, #F5F5F7 30%, #ECEDF1 60%, #E4E0E2 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* === LAYOUT === */
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 72px;
  width: 100%;
  max-width: 1200px;
  padding: 24px;
}

/* Logo — ~45% horizontal */
.login-brand {
  flex: 0 0 45%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand img {
  width: 100%;
  max-width: 520px;
  height: auto;
}

/* Card */
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  box-shadow: var(--shadow-card);
}

.login-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.login-card .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Error */
.login-error {
  background: var(--red-light);
  border: 1px solid rgba(198, 40, 40, 0.18);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
}

.login-error.visible { display: flex; }

/* Fields */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.field-input-wrap { position: relative; }

.field input {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder { color: var(--text-muted); }

.field input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
  background: #fff;
}

.field-toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color 0.15s;
}

.field-toggle-pw:hover { color: var(--text); }

/* Button */
.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--red);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  background: var(--red-hover);
  box-shadow: 0 4px 16px rgba(198, 40, 40, 0.25);
}

.btn-login:active { transform: scale(0.99); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-login .spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn-login.loading .spinner { display: block; }
.btn-login.loading .btn-text { display: none; }

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

/* === FOOTER === */
.login-footer {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-footer-copy {
  font-size: 11px;
  color: var(--text-muted);
}

/* === RESPONSIVE === */
@media (max-width: 860px) {
  .login-container {
    flex-direction: column;
    gap: 32px;
  }
  .login-brand {
    flex: none;
    width: 100%;
  }
  .login-brand img { max-width: 300px; }
}

@media (max-width: 400px) {
  .login-brand img { max-width: 240px; }
  .login-card { padding: 24px 20px; border-radius: 12px; }
}
