@charset "UTF-8";

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

/* --------------------------------------------------------------------------
   Body
   -------------------------------------------------------------------------- */
html, body {
  height: 100%;
  overflow: hidden;
}

body.login-page {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0F172A;
  color: #F1F5F9;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Sfondo decorativo (gradiente radiale + griglia di punti)
   -------------------------------------------------------------------------- */
body.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 85%, rgba(16, 185, 129, 0.13) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 85% 15%, rgba(59, 130, 246, 0.09) 0%, transparent 55%),
    radial-gradient(ellipse 40% 35% at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 65%);
  z-index: 0;
  pointer-events: none;
}

body.login-page::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 30px 30px;
  z-index: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Layout principale (split-screen su desktop, colonna su mobile)
   -------------------------------------------------------------------------- */
.login-page-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Variante centrata (usata nella pagina di logout) */
.login-page-wrapper--centered {
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   PANNELLO SINISTRO — Branding
   Visibile solo su desktop (≥ 1024px)
   -------------------------------------------------------------------------- */
.login-branding {
  display: none; /* nascosto su mobile */
  flex: 1 1 0;
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #0F172A 0%, #1E293B 60%, #0D1F2D 100%);
}

/* Gradiente decorativo interno */
.login-branding::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 25% 75%, rgba(16, 185, 129, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 75% 25%, rgba(59, 130, 246, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

/* Griglia punti pannello branding */
.login-branding::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.login-branding__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 3rem 2.5rem;
  text-align: center;
  gap: 1.75rem;
}

/* Immagine branding (logo/illustrazione dominio) */
.login-branding__image {
  max-width: 320px;
  width: 75%;
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(16, 185, 129, 0.2));
  border-radius: 0.75rem;
}

/* Testo branding */
.login-branding__text h2 {
  font-size: 1.625rem;
  font-weight: 700;
  color: #F9FAFB;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.login-branding__text p {
  font-size: 0.875rem;
  color: #64748B;
  line-height: 1.65;
}

/* Badge funzionalità */
.login-branding__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.75rem;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 50rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6EE7B7;
  white-space: nowrap;
}

.login-badge i {
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   PANNELLO DESTRO — Form
   -------------------------------------------------------------------------- */
.login-panel {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background-color: #111827;
  position: relative;
  z-index: 1;
  overflow-y: auto;
}

.login-panel--full {
  flex: 0 0 100%;
}

/* --------------------------------------------------------------------------
   CARD DI LOGIN
   -------------------------------------------------------------------------- */
.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  background: rgba(31, 41, 55, 0.9);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 1.25rem;
  padding: 2.25rem 2rem;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(16, 185, 129, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Variante card logout */
.login-card--logout {
  max-width: 380px;
}

/* --------------------------------------------------------------------------
   Avatar / Logo
   -------------------------------------------------------------------------- */
.login-card__logo {
  margin-bottom: 1.375rem;
}

.login-card__avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
  border: 2px solid rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #10B981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

/* Avatar verde (stato connesso) */
.login-card__avatar--success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.12) 100%);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.3);
}

/* --------------------------------------------------------------------------
   Intestazione card
   -------------------------------------------------------------------------- */
.login-card__header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-card__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: #F9FAFB;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.375rem;
}

.login-card__subtitle {
  font-size: 0.8125rem;
  color: #6B7280;
  line-height: 1.55;
}

.login-card__page-heading {
  font-size: 1rem;
  font-weight: 600;
  color: #D1D5DB;
  margin-bottom: 0.75rem;
  text-align: center;
}

.login-card__description {
  font-size: 0.8125rem;
  color: #9CA3AF;
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.login-card__logout-image {
  max-width: 120px;
  height: auto;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   FORM
   -------------------------------------------------------------------------- */
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Campo (label + input) */
.login-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* Riga label + link "password dimenticata" */
.login-form__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Label */
.login-form__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #9CA3AF;
  line-height: 1;
}

/* Wrapper input con icona */
.login-form__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Icona sinistra */
.login-form__icon {
  position: absolute;
  left: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4B5563;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
  transition: color 0.2s ease;
}

/* Input */
.login-form__input {
  width: 100%;
  background-color: rgba(55, 65, 81, 0.7);
  border: 1px solid rgba(75, 85, 99, 0.7);
  border-radius: 0.625rem;
  color: #F9FAFB;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.625rem 2.75rem 0.625rem 2.75rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  -webkit-appearance: none;
}

.login-form__input::placeholder {
  color: #4B5563;
}

.login-form__input:focus {
  background-color: rgba(55, 65, 81, 0.95);
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Focus: icona diventa verde */
.login-form__input:focus ~ .login-form__icon,
.login-form__input-wrap:focus-within .login-form__icon {
  color: #10B981;
}

/* Bottone toggle password (destra) */
.login-form__toggle-pw {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #4B5563;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: color 0.2s ease;
  z-index: 1;
}
.login-form__toggle-pw:hover { color: #9CA3AF; }

/* Link "Password dimenticata" */
.login-form__forgot {
  font-size: 0.75rem;
  color: #6B7280;
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.login-form__forgot:hover { color: #10B981; }

/* Checkbox "Ricordami" */
.login-form__remember {
  display: flex;
  align-items: center;
}

.login-form__check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: #9CA3AF;
  user-select: none;
}

.login-form__checkbox {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(75, 85, 99, 0.8);
  background-color: rgba(55, 65, 81, 0.7);
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #10B981;
  transition: border-color 0.2s ease;
}
.login-form__checkbox:focus {
  outline: 2px solid rgba(16, 185, 129, 0.4);
  outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   Bottone Submit (Login)
   -------------------------------------------------------------------------- */
.login-form__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 2.875rem;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border: none;
  border-radius: 0.625rem;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  margin-top: 0.25rem;
  -webkit-appearance: none;
  text-decoration: none;
}

.login-form__submit:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
  color: #fff;
}

.login-form__submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.login-form__submit i {
  font-size: 1.125rem;
}

/* Variante rossa (Logout) */
.login-form__submit--danger {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.login-form__submit--danger:hover {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  color: #fff;
}
.login-form__submit--danger:active {
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* Link "Torna alla dashboard" (logout) */
.login-form__back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: #6B7280;
  text-decoration: none;
  padding: 0.375rem;
  border-radius: 0.375rem;
  transition: color 0.2s ease;
  text-align: center;
}
.login-form__back-link:hover { color: #10B981; }
.login-form__back-link i { font-size: 0.875rem; }

/* --------------------------------------------------------------------------
   Messaggi di errore/successo Joomla (system messages)
   -------------------------------------------------------------------------- */
.login-card .alert,
.login-card .message,
.login-card .system-message {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  text-align: left;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.login-card .alert-error,
.login-card .alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
}

.login-card .alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6EE7B7;
}

.login-card .alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #FCD34D;
}

.login-card .alert-info {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93C5FD;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

/* Mobile (< 480px): padding ridotto */
@media (max-width: 479px) {
  .login-panel {
    padding: 1.5rem 1rem;
    align-items: flex-start;
    padding-top: 2.5rem;
  }
  .login-card {
    padding: 1.75rem 1.375rem;
    border-radius: 1rem;
  }
  .login-card__title { font-size: 1.25rem; }
}

/* Tablet (≥ 640px): card leggermente più larga */
@media (min-width: 640px) {
  .login-card { max-width: 420px; }
}

/* Desktop (≥ 1024px): layout split-screen */
@media (min-width: 1024px) {
  .login-branding {
    display: flex;
    flex: 1 1 0;
    min-height: 100vh;
  }

  .login-panel {
    flex: 0 0 480px;
    max-width: 480px;
    min-height: 100vh;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    background-color: #111827;
    backdrop-filter: none;
    padding: 2.5rem 3rem;
  }

  .login-panel--full {
    flex: 0 0 100%;
    max-width: 100%;
    border-left: none;
  }

  .login-card {
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    max-width: 380px;
  }

  .login-card--logout {
    max-width: 360px;
  }
}

/* Large desktop (≥ 1280px): pannello form più largo */
@media (min-width: 1280px) {
  .login-panel {
    flex: 0 0 520px;
    max-width: 520px;
    padding: 2.5rem 3.5rem;
  }
}

/* --------------------------------------------------------------------------
   Accessibilità: focus visibile
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid #10B981;
  outline-offset: 2px;
}

/* Selezione testo */
::selection {
  background-color: rgba(16, 185, 129, 0.25);
  color: #F9FAFB;
}
