/* public/css/main.css */

:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-soft: #0f172a;
  --surface: #121a2b;
  --surface-strong: #18233a;
  --surface-border: #1f2c44;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --text: #e9edf5;
  --muted: #9fb0cc;
  --muted-strong: #c1cce0;
  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --accent-warm: #f59e0b;
  --input-bg: #0e1627;
  --input-border: #24324d;
  --radius: 14px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-soft: #edf1f7;
  --surface: #ffffff;
  --surface-strong: #f9fbff;
  --surface-border: #dfe6ef;
  --shadow: 0 12px 30px rgba(19, 32, 62, 0.12);
  --text: #0f172a;
  --muted: #50607a;
  --muted-strong: #2b3547;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent-warm: #f59e0b;
  --input-bg: #ffffff;
  --input-border: #cfd8e6;
  --radius: 14px;
}

:root.theme-transition body,
:root.theme-transition header,
:root.theme-transition section,
:root.theme-transition .card,
:root.theme-transition .floating-nav,
:root.theme-transition .floating-nav a,
:root.theme-transition .top-nav a,
:root.theme-transition .primary,
:root.theme-transition .ghost,
:root.theme-transition button,
:root.theme-transition input,
:root.theme-transition textarea,
:root.theme-transition select,
:root.theme-transition .autocomplete,
:root.theme-transition .autocomplete input,
:root.theme-transition .autocomplete-list,
:root.theme-transition .combo-toggle {
  transition: background-color 0.28s ease, border-color 0.28s ease, color 0.28s ease, box-shadow 0.28s ease, outline-color 0.28s ease;
}

:root.theme-transition input::placeholder,
:root.theme-transition textarea::placeholder {
  transition: color 0.28s ease;
}

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

body {
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

header {
  padding: 1.5rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--surface-border);
}

h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

main {
  padding: 1.75rem 1.5rem calc(1.5rem + 4.25rem);
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

section {
  background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.4rem;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
}

fieldset {
  border: 1px solid var(--surface-border);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 1rem;
  background: var(--bg-soft);
}

legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--text);
}

span[for],
label {
  font-weight: 500;
}

/* evita focus su click etichetta */
label.field {
  pointer-events: none;
}
label.field input,
label.field textarea,
label.field select,
label.field .autocomplete {
  pointer-events: auto;
}
.field .inline-check {
  pointer-events: auto;
  cursor: pointer;
}
.inline-check span {
  cursor: pointer;
}

.inline-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.inline-check input[type="checkbox"] {
  margin: 0;
  align-self: center;
}

p {
  margin: 0.2rem 0 0.8rem;
  color: var(--muted);
}

h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.profile-compact {
  transition: opacity 0.18s ease;
}

.profile-compact.profile-loading {
  opacity: 0;
}

.profile-compact .grid {
  gap: 0.45rem 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.profile-compact .field {
  margin-bottom: 0.25rem;
}

.profile-compact .field p {
  margin: 0.08rem 0 0.2rem;
}

.profile-header {
  gap: 0.9rem;
  align-items: center;
}

.profile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.1rem;
  margin-top: 0.2rem;
}

.profile-meta .meta-item {
  display: none;
  align-items: center;
}

.profile-meta .meta-item.with-sep::before {
  content: '•';
  margin: 0 0.35rem;
  color: var(--muted);
}

.profile-meta .meta-item.visible {
  display: inline-flex;
}

.profile-name-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80px;
  gap: 0.1rem;
  align-self: center;
}

.profile-actions {
  align-self: center;
}

/* Home: evita flash guest quando nav-state è già noto come logged-in */
html[data-nav-state='logged-in'] #home-guest {
  display: none !important;
}
html[data-nav-state='logged-in'] #home-user {
  display: block !important;
}
html[data-nav-state='logged-in'] .header-auth-actions {
  display: none !important;
}

.rates-btn {
  margin-top: 0.55rem;
  padding: 0.24rem 0.6rem;
  min-height: 28px;
  font-size: 0.86rem;
  box-shadow: none;
  border-color: var(--surface-border);
  color: var(--text);
}

.profile-compact .field-wide {
  grid-column: 1 / -1;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.rates-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.1rem;
}

.rates-table th,
.rates-table td {
  padding: 0.35rem 0.4rem;
}

.rates-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 1px solid var(--surface-border);
}

.rates-table tr + tr td {
  border-top: 1px solid var(--surface-border);
}

.rates-table td:last-child {
  text-align: right;
  font-weight: 700;
}

.text-right {
  text-align: right;
}

.collapsible {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.28s ease, opacity 0.24s ease, transform 0.26s ease;
}

.collapsible.open {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 1.25rem 1rem calc(5rem + 1rem);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 20;
  overflow-y: auto;
}

.modal[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal[aria-hidden="true"] .modal-dialog {
  transform: translateY(14px) scale(0.92);
  opacity: 0;
}

.modal[aria-hidden="false"] {
  display: grid;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal.open {
  display: grid;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-dialog {
  width: min(680px, 100%);
  transform: translateY(14px) scale(0.92);
  transition: transform 0.26s ease, opacity 0.26s ease;
  opacity: 0;
  max-height: 90vh;
  overflow: auto;
}

.modal-dialog.modal-compact {
  width: min(480px, 100%);
}

.modal[aria-hidden="false"] .modal-dialog,
.modal.open .modal-dialog {
  transform: translateY(0) scale(1.04);
  opacity: 1;
}

.modal[aria-hidden="true"] .modal-dialog {
  transform: translateY(14px) scale(0.92);
  opacity: 0;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
}

.modal > .modal-backdrop {
  background: transparent;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.24s ease;
}

.modal[aria-hidden="false"] > .modal-backdrop,
.modal.open > .modal-backdrop {
  opacity: 1;
}

.modal > .modal-dialog {
  position: relative;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  cursor: pointer;
}

/* campi di input di base */

input,
textarea,
select {
  width: 100%;
  margin-top: 0.25rem;
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.75rem;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: color-mix(in srgb, var(--surface-strong) 75%, var(--input-bg) 25%);
  border-color: color-mix(in srgb, var(--surface-border) 90%, transparent);
  color: var(--muted);
  cursor: not-allowed;
}

/* select più minimal */
select {
  padding: 0.5rem 0.65rem;
  border-radius: calc(var(--radius) - 8px);
  border-color: var(--surface-border);
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-strong) 6%);
  box-shadow: none;
}

select:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 24%, transparent);
}

/* Select a scelta singola, coerenti con "Ensemble richiesto" */
.select-clean,
.select-clean-input {
  appearance: none;
  padding: 0.65rem 2.5rem 0.65rem 0.85rem;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-strong) 8%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.5 6l3.5 3.5L11.5 6' stroke='%236c7085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 16px;
}

.select-clean-input {
  padding-right: 1rem;
  background-image: none;
  cursor: pointer;
}

.select-clean:focus,
.select-clean-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 24%, transparent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin: 0 0.35rem 0 0;
  padding: 0;
}

/* bottoni */

button {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  border-radius: calc(var(--radius) - 6px);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  min-height: 42px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.ghost,
label.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--surface-border);
  border-radius: calc(var(--radius) - 6px);
  min-height: 42px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.ghost:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.ghost:active,
label.ghost:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.ghost-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.ghost-primary:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.ghost-success {
  color: #16a34a;
  border-color: #22c55e;
}

.ghost-success:hover {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.25);
}

.ghost-danger {
  color: #ef4444;
  border-color: #ef4444;
}

.ghost-danger:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25);
}

.btn-full {
  width: 100%;
}

.btn-compact {
  padding: 0.45rem 1rem;
}

.danger {
  background: #ef4444;
  color: #fff;
  border: 1px solid #ef4444;
}

.danger:hover {
  background: #dc2626;
}
/* testo di servizio */

small {
  color: var(--muted);
  font-size: 0.82rem;
}

/* lista risultati ricerca */

#search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  padding: 0;
  margin: 0.75rem 0 0;
}

/* Label in stile testo sopra i campi */

.field-label {
  display: inline-block;
  font-weight: 500;
  margin-bottom: 0.1rem;
}

/* ──────────────────────────────────────── */
/*   CAMPI STRUMENTI / VOCI CON X          */
/* ──────────────────────────────────────── */

.instrument-field {
  position: relative;
  margin-top: 0.5rem; /* spazio tra "In cerca di un gruppo stabile" e "Strumenti / voci" */
}

/* wrapper input + X */
.combo {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.combo input {
  flex: 1;
  padding-right: 2rem; /* spazio per la X */
  margin-top: 0;       /* 👈 annulla i margini verticali globali */
  margin-bottom: 0;    /* 👈 annulla i margini verticali globali */
}

/* bottone X a destra, centrato verticalmente */
.combo-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;        /* il JS lo mette a "flex" quando c'è testo */
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
  appearance: none;
}

/* niente sfondo/outline al passaggio o al focus */
.combo-toggle:hover,
.combo-toggle:focus,
.combo-toggle:active {
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

/* ──────────────────────────────────────── */
/*   THEME SWITCH                          */
/* ──────────────────────────────────────── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  font-weight: 600;
  padding: 0;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.theme-fab {
  position: fixed;
  bottom: 1.1rem;
  right: 1.1rem;
  z-index: 30;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

@media (max-width: 720px) {
  .theme-fab {
    bottom: 1.1rem;
    right: 1.1rem;
  }
}

.btn-create-post {
  margin-bottom: 0;
}

.home-actions {
  width: 100%;
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.home-actions button {
  height: 48px;
  min-width: 0;
}

.home-actions .btn-filter,
.home-actions .btn-show-all {
  flex: 0 0 auto;
  min-width: 110px;
  padding-inline: 0.9rem;
}

.home-actions .btn-create-post {
  flex: 1 1 auto;
  padding-inline: 1.4rem;
}

.home-actions .btn-show-all {
  margin-left: auto;
}

.home-actions .btn-show-all.active {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.16);
}

@media (max-width: 640px) {
  .home-actions {
    flex-direction: column;
    gap: 0.6rem;
  }
  .home-actions .btn-show-all {
    margin-left: 0;
  }
}

/* ──────────────────────────────────────── */
/*   AUTOCOMPLETE CITTA'                   */
/* ──────────────────────────────────────── */

.autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.12rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: calc(var(--radius) - 6px);
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
  z-index: 10;
}

.autocomplete-item {
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.25;
}

.autocomplete-item:hover,
.autocomplete-item:focus {
  background: var(--surface-border);
}

.autocomplete-item small {
  color: var(--muted);
}

/* Nascondi banner emulator warning */
.firebase-emulator-warning {
  display: none !important;
}

/* utility: contenitore dei messaggi del form */
#musician-form-message {
  margin-top: 0.5rem;
  min-height: 1.2rem;
  font-size: 0.9rem;
}
