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

/* ── Layout root ──────────────────────────────────────────── */
body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #c9d1d9;
}

/* ════════════════════════════════════════════════════════════
   LATO SINISTRO — video
   ════════════════════════════════════════════════════════════ */
.left-panel {
  position: relative;
  flex: 1 1 60%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.video-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(6, 8, 15, 0.72) 0%,
    rgba(10, 14, 26, 0.60) 50%,
    rgba(6, 8, 15, 0.75) 100%
  );
  z-index: 1;
}

.left-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 3rem;
  max-width: 560px;
}

.left-logo {
  margin-bottom: 2rem;
}

.left-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(201, 209, 217, 0.15));
}

.left-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  color: #f0f6fc;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 1.1rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.left-sub {
  font-size: 0.95rem;
  color: rgba(201, 209, 217, 0.72);
  line-height: 1.65;
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

/* ════════════════════════════════════════════════════════════
   LATO DESTRO — form
   ════════════════════════════════════════════════════════════ */
.right-panel {
  flex: 0 0 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1117;
  border-left: 1px solid rgba(48, 54, 61, 0.8);
  padding: 2rem;
  overflow-y: auto;
}

.login-box {
  width: 100%;
  max-width: 340px;
}

/* Header */
.login-header {
  margin-bottom: 2rem;
}

.login-wordmark {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #484f58;
  margin-bottom: 1.6rem;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.login-header p {
  font-size: 0.82rem;
  color: #6e7681;
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.28);
  color: #ff7b72;
}

.alert-info {
  background: rgba(56, 139, 253, 0.1);
  border: 1px solid rgba(56, 139, 253, 0.25);
  color: #79c0ff;
}

/* Campi */
.field {
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6e7681;
  margin-bottom: 0.4rem;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #484f58;
  pointer-events: none;
  transition: color 0.2s;
}

.input-wrap:focus-within .input-icon {
  color: #388bfd;
}

.field input {
  width: 100%;
  padding: 0.7rem 2.6rem 0.7rem 2.4rem;
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-text-fill-color: #e6edf3;
}

.field input:focus {
  border-color: #388bfd;
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.16);
}

.field input::placeholder {
  color: #3d444d;
}

/* Fix autofill */
.field input:-webkit-autofill,
.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #0d1117 inset !important;
  -webkit-text-fill-color: #e6edf3 !important;
  caret-color: #e6edf3;
}

/* Toggle password */
.pwd-toggle {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #484f58;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  line-height: 1;
}

.pwd-toggle:hover {
  color: #8b949e;
}

/* Pulsante */
.btn-login {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.75rem;
  background: #3B4871;
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: 0.01em;
}

.btn-login:hover {
  background: #4a5a8a;
  box-shadow: 0 4px 16px rgba(59, 72, 113, 0.5);
}

.btn-login:active {
  transform: scale(0.988);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Footer testo */
.login-footer {
  margin-top: 1.75rem;
  font-size: 0.72rem;
  color: #3d444d;
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

/* Tablet: riduce pannello video */
@media (max-width: 900px) {
  .left-panel {
    flex: 1 1 50%;
  }

  .right-panel {
    flex: 0 0 360px;
  }
}

/* Mobile: nasconde il video, full-screen form */
@media (max-width: 640px) {
  body {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .left-panel {
    display: none;
  }

  .right-panel {
    flex: 1;
    border-left: none;
    border-top: 1px solid rgba(48, 54, 61, 0.8);
    padding: 3rem 1.5rem 2rem;
    min-height: 100vh;
  }

  .login-box {
    max-width: 100%;
  }
}
