/* ===== Serate — foglio di stile ===== */
/* Palette calda e tranquilla: crema, caramello, verde salvia. */

:root {
  --bg: #f6f1ea;
  --bg-2: #efe7dc;
  --surface: #fffdfa;
  --surface-2: #faf5ee;
  --ink: #3d372f;
  --muted: #938a7d;
  --line: #e7ddd0;
  --accent: #b6835a;      /* caramello */
  --accent-deep: #96633c;
  --rose: #c58a86;        /* rosa polvere (serie) */
  --sage: #94a986;        /* salvia (concerti) */
  --gold: #d8a44b;
  --danger: #c26a5c;
  --shadow: 0 10px 30px -12px rgba(90, 70, 45, 0.28);
  --shadow-sm: 0 4px 14px -8px rgba(90, 70, 45, 0.3);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, #fdf6ec 0%, rgba(253, 246, 236, 0) 60%),
    radial-gradient(900px 500px at -10% 10%, #f3eae0 0%, rgba(243, 234, 224, 0) 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }

button { font-family: inherit; cursor: pointer; }

input, textarea, select {
  font-family: inherit;
  font-size: 16px; /* evita lo zoom automatico su iPhone */
  color: var(--ink);
}

.hidden { display: none !important; }

/* ---------- Bottoni ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-deep); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent;
  color: var(--accent-deep);
  box-shadow: none;
  border: 1.5px solid var(--line);
}
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 16px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: none; border: 1.5px solid #e9cfc9; }
.btn.danger:hover { background: #fbeeeb; }

/* ---------- Schermata di accesso ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px;
  border: 1px solid var(--line);
}
.brand {
  text-align: center;
  margin-bottom: 26px;
}
.brand .logo { font-size: 40px; line-height: 1; }
.brand h1 { font-size: 34px; margin-top: 8px; color: var(--ink); }
.brand p { color: var(--muted); margin: 6px 0 0; font-size: 15px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  background: #fff;
}
.field textarea { resize: vertical; min-height: 74px; }

.auth-toggle { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-toggle a { color: var(--accent-deep); font-weight: 600; text-decoration: none; cursor: pointer; }

.msg { font-size: 14px; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.msg.error { background: #fbeeeb; color: #a4483a; }

/* ---------- Struttura app ---------- */
.app { max-width: 1040px; margin: 0 auto; padding: 0 18px 90px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 4px 10px;
}
.topbar .title { display: flex; align-items: center; gap: 10px; }
.topbar .title .logo { font-size: 26px; }
.topbar .title h1 { font-size: 24px; }
.usermenu { position: relative; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(135deg, var(--rose), var(--accent));
  box-shadow: var(--shadow-sm);
}
.dropdown {
  position: absolute; right: 0; top: 52px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 10px; min-width: 200px; z-index: 40;
}
.dropdown .who { padding: 6px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.dropdown .who strong { display: block; }
.dropdown .who span { font-size: 13px; color: var(--muted); }
.dropdown button { width: 100%; text-align: left; background: none; border: none; padding: 9px 10px; border-radius: 8px; color: var(--ink); font-size: 14px; }
.dropdown button:hover { background: var(--surface-2); }

/* ---------- Tab (Serie / Concerti) ---------- */
.tabs {
  display: flex; gap: 8px;
  background: var(--bg-2);
  padding: 6px; border-radius: 999px;
  width: fit-content; margin: 8px auto 26px;
  box-shadow: inset 0 1px 3px rgba(90,70,45,0.08);
}
.tabs button {
  border: none; background: transparent; color: var(--muted);
  padding: 10px 22px; border-radius: 999px; font-weight: 600; font-size: 15px;
  transition: all 0.18s ease;
}
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Barra sezione ---------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--muted); border-radius: 999px; padding: 7px 15px;
  font-size: 13.5px; font-weight: 600; transition: all 0.15s ease;
}
.chip.active { border-color: transparent; background: var(--ink); color: #fff; }

/* ---------- Griglia serie ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.poster {
  aspect-ratio: 2 / 3; width: 100%; object-fit: cover; background: var(--bg-2);
  display: block;
}
.poster.placeholder {
  display: grid; place-items: center; font-size: 40px;
  background: linear-gradient(135deg, var(--surface-2), var(--bg-2));
  color: var(--accent);
}
.card .body { padding: 10px 12px 12px; }
.card .body h3 { font-size: 15px; line-height: 1.25; }
.card .body .meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; letter-spacing: 0.02em;
}
.badge.want { background: #f1e7f0; color: #8c5f86; }
.badge.watching { background: #f6ecdf; color: var(--accent-deep); }
.badge.completed { background: #e8efe2; color: #5f7a4e; }
.stars { color: var(--gold); font-size: 13px; letter-spacing: 1px; }
.stars .off { color: #e4d8c6; }

/* ---------- Lista concerti ---------- */
.concert-list { display: flex; flex-direction: column; gap: 14px; }
.concert {
  display: flex; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.concert:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.concert .thumb {
  width: 74px; height: 74px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sage), #b7c7a8);
  display: grid; place-items: center; font-size: 30px; color: #fff;
}
.concert .info { flex: 1; min-width: 0; }
.concert .info h3 { font-size: 18px; }
.concert .info .where { color: var(--muted); font-size: 14px; margin-top: 2px; }
.concert .info .when { color: var(--accent-deep); font-size: 13px; font-weight: 600; margin-top: 4px; }

/* ---------- Stato vuoto ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty .big { font-size: 52px; margin-bottom: 10px; }
.empty h3 { font-size: 20px; color: var(--ink); margin-bottom: 6px; }

/* ---------- Modale ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(61, 55, 47, 0.42);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 18px; z-index: 100;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; animation: pop 0.2s ease;
}
.modal.wide { max-width: 560px; }
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 22px; }
.modal-head .x { background: none; border: none; font-size: 24px; color: var(--muted); line-height: 1; padding: 4px; }

/* Ricerca serie */
.search-results { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; max-height: 320px; overflow-y: auto; }
.result {
  display: flex; gap: 12px; align-items: center; padding: 8px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  cursor: pointer; transition: background 0.12s ease;
}
.result:hover { background: #fff; border-color: var(--accent); }
.result img, .result .noimg {
  width: 46px; height: 66px; border-radius: 7px; object-fit: cover; flex-shrink: 0;
  background: var(--bg-2); display: grid; place-items: center; color: var(--accent);
}
.result .r-info h4 { font-family: var(--sans); font-size: 15px; font-weight: 600; margin: 0; }
.result .r-info span { font-size: 13px; color: var(--muted); }

/* Selettore stato + stelle nel form */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-row button {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 14px;
}
.pill-row button.active { border-color: transparent; color: #fff; }
.pill-row button.active[data-v="want"] { background: #8c5f86; }
.pill-row button.active[data-v="watching"] { background: var(--accent); }
.pill-row button.active[data-v="completed"] { background: #5f7a4e; }

.rate { display: flex; gap: 4px; font-size: 30px; color: #e4d8c6; }
.rate span { cursor: pointer; transition: transform 0.1s ease; }
.rate span:hover { transform: scale(1.15); }
.rate span.on { color: var(--gold); }

.detail-poster {
  width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.summary { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 4px 0 16px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow); z-index: 200; animation: pop 0.2s ease;
}

/* Pulsante flottante "aggiungi" su mobile */
@media (max-width: 560px) {
  .brand h1 { font-size: 30px; }
  .topbar .title h1 { font-size: 21px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
}
