/* ====== RESET BASE ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.16), transparent 55%),
    #f3f4f6;
  color: #0f172a;
  display: flex;
  flex-direction: column;
}

/* ====== HEADER ====== */

.header {
  padding: 0.9rem 1.4rem;
  background: linear-gradient(135deg, #0f766e, #0ea5e9);
  color: #ecfeff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.header-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-title h1::before {
  content: "\f21e";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1.2rem;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
}

.header-title p {
  margin-top: 0.15rem;
  font-size: 0.92rem;
  opacity: 0.9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

/* NAV */

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  color: #e0f2fe;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.18);
}

.nav-link i {
  font-size: 0.85rem;
}

.nav-link:hover {
  background: rgba(15, 23, 42, 0.26);
}

.nav-link.active {
  background: #ecfeff;
  color: #0f766e;
  border-color: rgba(59, 130, 246, 0.4);
}

/* USER BOX HEADER */

.header-user-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#header-user-info {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  color: #f0fdf4;
  border: 1px solid rgba(209, 250, 229, 0.7);
  font-size: 0.82rem;
}

#header-user-info::before {
  content: "\f007";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

/* ====== LAYOUT PRINCIPALE ====== */

.container {
  max-width: 1100px;
  margin: 1.3rem auto;
  padding: 0 1.3rem 1.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.3rem;
}

/* Layout specifico per la pagina di login/registrazione */
body[data-page="auth"] .container {
  max-width: 480px;
  grid-template-columns: 1fr;
}


/* CLASSI PER CARD */

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  padding: 1.1rem 1rem 1.1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.4);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.13), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card h2,
.card h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.card h2::before {
  content: "\f0f0";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.95rem;
  color: #0f766e;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
}

.card:nth-of-type(2) h2::before {
  content: "\f2f6";
}

[data-page="diary"] .card h2::before {
  content: "\f483";
}

[data-page="snapshots"] .card h2::before {
  content: "\f201";
}

.card h3 {
  font-size: 0.95rem;
  margin-top: 0.7rem;
  color: #0f172a;
}

/* CARD FULL WIDTH SE SERVE */

.card-full {
  grid-column: 1 / -1;
}

/* ====== FORM ====== */

.form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.3rem;
}

label {
  font-size: 0.85rem;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

input,
textarea {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  border-radius: 12px;
  resize: vertical;
  min-height: 80px;
}

input:focus,
textarea:focus {
  border-color: #0ea5e9;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* ====== BUTTONS ====== */

button {
  margin-top: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #14b8a6);
  color: #ecfeff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 10px 25px rgba(14, 165, 233, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button::before {
  content: "\f061";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.8rem;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(14, 165, 233, 0.6);
  filter: brightness(1.03);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.55);
}

/* Pulsante rosso piccolo (logout) */
.small-button {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 6px 15px rgba(239, 68, 68, 0.5);
}

.small-button::before {
  content: "\f2f5";
}

/* ====== TESTI DI SUPPORTO ====== */

.hint {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.3rem;
}

/* ====== LISTE (SINTOMI / SNAPSHOT) ====== */

.list {
  margin-top: 0.4rem;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.6rem;
  background: rgba(248, 250, 252, 0.95);
  max-height: 300px;
  overflow-y: auto;
}

.entry-item,
.snapshot-item {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.45rem 0.1rem;
  font-size: 0.88rem;
}

.entry-item:last-child,
.snapshot-item:last-child {
  border-bottom: none;
}

.entry-item strong,
.snapshot-item strong {
  color: #0f172a;
}

.entry-item span.hint {
  font-size: 0.78rem;
}

/* ====== FOOTER ====== */

.footer {
  margin-top: auto;
  padding: 0.7rem 1.4rem;
  font-size: 0.78rem;
  color: #6b7280;
  text-align: center;
  border-top: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(10px);
}

.footer a {
  color: #0f766e;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ====== TOAST (popup registrazione/altre notifiche) ====== */

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  min-width: 220px;
  max-width: 320px;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: #059669;
  color: #ecfeff;
  font-size: 0.85rem;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  z-index: 50;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-icon {
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.toast-text {
  flex: 1;
}

.toast-close {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
}

/* Errore */
.toast.error {
  background: #b91c1c;
}

/* ====== UTILITY ====== */

.hidden {
  display: none !important;
}

/* ====== RESPONSIVE ====== */

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.6rem;
  }

  .nav-links {
    flex-wrap: wrap;
  }

  /* Tutte le pagine: una colonna sola su schermi piccoli */
  .container {
    padding-inline: 0.9rem;
    grid-template-columns: 1fr;
  }

  .card {
    padding-inline: 0.9rem;
  }

  body[data-page="diary"] .card-full,
  body[data-page="snapshots"] .card-full {
    padding-block: 0.9rem;
  }


  .list {
    max-height: 250px;
  }
}

