/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

body.mala-body {
  margin: 0;
  padding: 16px;
  min-height: 100vh;
  background: #000 url("/sfondo.png") center center no-repeat;
  background-size: cover;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #00ff00;
}
/* Dashboard pages are tall — start from top instead of vertically centered */
body.mala-body:has(.mala-dashboard) {
  align-items: flex-start;
}

/* ===== SPLASH ===== */
.mala-overlay {
  width: 100%;
  max-width: 900px;
  padding: 16px;
  text-align: center;
}
.mala-logo {
  max-width: 800px;
  width: 70vw;
  height: auto;
  margin-bottom: 28px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.mala-progress {
  width: 60vw;
  max-width: 520px;
  min-width: 220px;
  height: 10px;
  background: rgba(0, 16, 0, 0.9);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto;
  box-shadow: 0 0 15px #00ff00;
}
.mala-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #00aa00);
  animation: mala-load 2.5s ease-in-out forwards;
}
@keyframes mala-load {
  0%   { width: 0%; }
  80%  { width: 95%; }
  100% { width: 100%; }
}
.mala-text {
  margin-top: 14px;
  font-size: 14px;
  letter-spacing: 1px;
  text-shadow: 0 0 5px #00ff00;
}

/* ===== CARD ===== */
.mala-card {
  width: 100%;
  max-width: 400px;
  background: rgba(0, 10, 0, 0.88);
  border: 1px solid #00ff00;
  border-radius: 12px;
  padding: 36px 28px;
  box-shadow: 0 0 40px rgba(0,255,0,0.15);
  text-align: center;
}
.mala-card .mala-logo {
  width: 180px;
  max-width: 55vw;
  margin-bottom: 20px;
}
.mala-card h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 8px;
  text-shadow: 0 0 8px #00ff00;
}
.mala-card p {
  font-size: 13px;
  color: #00aa00;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ===== FORM ===== */
.mala-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mala-input {
  background: rgba(0, 20, 0, 0.8);
  border: 1px solid #00aa00;
  border-radius: 6px;
  color: #00ff00;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.mala-input::placeholder { color: #006600; }
.mala-input:focus {
  border-color: #00ff00;
  box-shadow: 0 0 10px rgba(0,255,0,0.3);
}
.mala-btn {
  background: linear-gradient(135deg, #004400, #007700);
  border: 1px solid #00ff00;
  border-radius: 6px;
  color: #00ff00;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 13px;
  text-transform: uppercase;
  transition: background 0.2s, box-shadow 0.2s;
  width: 100%;
}
.mala-btn:hover {
  background: linear-gradient(135deg, #006600, #00aa00);
  box-shadow: 0 0 16px rgba(0,255,0,0.4);
}
.mala-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mala-link {
  color: #00cc00;
  font-size: 13px;
  text-decoration: none;
}
.mala-link:hover { text-decoration: underline; color: #00ff00; }

/* ===== MESSAGGI ===== */
.mala-msg {
  border-radius: 6px;
  font-size: 13px;
  padding: 10px 14px;
  display: none;
  text-align: left;
}
.mala-msg.show { display: block; }
.mala-msg.success {
  background: rgba(0,80,0,0.4);
  border: 1px solid #00ff00;
  color: #00ff00;
}
.mala-msg.error {
  background: rgba(80,0,0,0.4);
  border: 1px solid #ff4444;
  color: #ff4444;
}

/* ===== DASHBOARD ===== */
.mala-dashboard {
  width: 100%;
  max-width: 1100px;
  padding: 24px 16px;
  margin: 0 auto;
}
.mala-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 16px;
}
.mala-topbar .mala-logo {
  width: 220px;
  margin: 0;
}
.mala-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.mala-welcome {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 0 8px #00ff00;
}
.mala-logout {
  background: transparent;
  border: 1px solid #ff4444;
  border-radius: 6px;
  color: #ff4444;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 9px 22px;
  text-transform: uppercase;
  transition: background 0.2s;
}
.mala-logout:hover { background: rgba(255,0,0,0.15); }
.mala-back-btn {
  background: transparent;
  border: 1px solid #00aa00;
  border-radius: 6px;
  color: #00aa00;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 9px 22px;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.mala-back-btn:hover {
  background: rgba(0, 255, 0, 0.08);
  border-color: #00ff00;
  color: #00ff00;
}
.mala-page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #00ff00;
  text-shadow: 0 0 10px rgba(0,255,0,0.5);
  margin: 0 0 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 200, 0, 0.3);
}
.mala-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.mala-schedina {
  background: rgba(0, 10, 0, 0.85);
  border: 1px solid #00aa00;
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.mala-schedina:hover {
  border-color: #00ff00;
  box-shadow: 0 0 20px rgba(0,255,0,0.2);
}
.mala-schedina h3 {
  color: #00ff00;
  font-size: 15px;
  letter-spacing: 1px;
  margin: 0 0 10px;
  text-shadow: 0 0 6px #00ff00;
  text-transform: uppercase;
}
.mala-schedina p {
  color: #00aa00;
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* ===== MOBILE ===== */
@media (max-width: 480px) {
  .mala-card { padding: 24px 16px; }
  .mala-card .mala-logo { width: 140px; }
  .mala-logo { width: 80vw; max-width: 360px; }
  .mala-progress { width: 80vw; }
  .mala-text { font-size: 12px; }
  /* Topbar mobile: nascondi benvenuto, bottoni compatti per stare su una riga */
  .mala-welcome { display: none; }
  .mala-topbar { flex-wrap: nowrap; }
  .mala-topbar .mala-logo { width: 120px; }
  .mala-back-btn, .mala-logout { padding: 5px 10px; font-size: 11px; letter-spacing: 0; }
}
@media (min-width: 1400px) {
  .mala-logo { max-width: 640px; }
  .mala-progress { max-width: 640px; }
}
