@import url(variables.css);

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

body {
  font-family: Arial, sans-serif;
  background: linear-gradient(220deg, var(--background-color), var(--background-color2), var(--background-color3), var(--background-color4));
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  line-height: 1.5;
  flex: 1;
  padding-top: clamp(70px, 14vw, 100px);
}

main {
  flex: 1;
  padding: 3vw;
  margin-bottom: 25px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
}

/* ===== NAVBAR TOP ===== */

.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(40, 20, 50, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2vw 4vw;
  color: white;
  border-radius: 0 0 35px 35px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
}

.user-info {
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
}

.user-info a {
  color: #fff;
  text-decoration: none;
}

.user-info a:hover {
  text-decoration: underline;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  min-width: 140px;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  z-index: 2000;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
}

.dropdown-menu a:hover {
  background-color: #f5f5f5;
}

.bottom-navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: auto;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding: 8px 4px 4px;
}

.nav-item {
  flex: 1;
  text-decoration: none;
  color: #aaa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0;
  border-radius: 0;
  margin: 0;
  transition: color 0.2s;
  background: none;
  border: none;
}

.nav-item:hover {
  background: none;
  transform: none;
  color: var(--color-1);
}

.nav-item.active {
  color: var(--color-1);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

html.dark .nav-item {
  color: #666;
}

html.dark .nav-item.active {
  color: var(--color-1);
}

html.dark .nav-item:hover {
  color: var(--color-1);
}

@media (prefers-color-scheme: dark) {
  .bottom-navbar {
    background: rgba(40, 20, 50, 0.88);
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  .nav-item {
    color: #666;
  }

  .nav-item.active,
  .nav-item:hover {
    color: var(--color-1);
  }
}

.logo {
  display: flex;
  height: clamp(20px, 12vw, 50px);
}

.menu-btn {
  font-size: clamp(2rem, 8vw, 4rem);
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

/* ===== BARRA RICERCA ===== */

#search-bar {
  width: 100%;
  margin: 5px 0 10px;
  border: 1px solid #ccc;
  border-radius: 12px;
  font-size: clamp(1.2rem, 4vw, 2rem);
}

/* ===== CARD GENERICA LEGA =====
   Nota: le proprietà specifiche di .lega-card e .lega-nome
   sono gestite in lega.css per evitare duplicazioni.
   Qui rimangono solo gli stili globali della card-link. */

.lega-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.lega-card-link:hover .lega-card {
  transform: scale(1.02);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Testi descrizione */
.lega-descrizione {
  margin: 15px 0;
  color: #555;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
}

.lega-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em;
}

.lega-partecipanti {
  background: var(--color-1);
  color: white;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: clamp(0.9rem, 3.5vw, 1.2rem);
  font-weight: bold;
}

/* ===== FORM ===== */

form {
  max-width: 100%;
  margin: auto;
  background: #f9f9f9;
  padding: clamp(15px, 4vw, 30px);
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
  font-size: clamp(1rem, 3.5vw, 1.4rem);
}

input,
select,
textarea {
  width: 100%;
  padding: 1em;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 12px;
  font-size: clamp(1rem, 3.5vw, 1.4rem);
}

.new-league-btn:hover {
  background: #555;
}

#legheScelte {
  margin-top: 10px;
  padding: 10px;
  background: #eee;
  border-radius: 8px;
}

#creditiTotali {
  font-weight: bold;
}

/* ===== BOTTONI FILTRO ===== */

.filter-buttons {
  display: flex;
  justify-content: space-between;
  margin: 20px 0 15px;
  gap: 0.7rem;
}

.filter-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  padding: 0.2em;
  border-radius: 20px;
  border: none;
  background: var(--color-2);
  color: #ffffff;
  font-weight: bold;
  transition: all 0.2s;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.filter-btn svg {
  width: clamp(1.5em, 6vw, 2.5em);
  height: clamp(1.5em, 6vw, 2.5em);
}

.filter-btn:not(:disabled).active,
.filter-btn:not(:disabled):hover {
  background: var(--color-1);
  color: #000000;
}

.filter-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.new-league-btn {
  display: block;
  width: 100%;
  margin: 10px auto 10px auto;
  padding: 1em 2em;
  border-radius: 25px;
  border: none;
  background: var(--color-2);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
}

.new-league-btn:hover {
  background: var(--color-1);
}

.new-league-btn:disabled {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ===== TITOLI ===== */

#lega-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

#lega-subtitle {
  text-align: center;
  font-size: 1.2rem;
  color: #555;
  margin-bottom: 1.5rem;
}

/* ===== CONTENITORE PRINCIPALE ===== */

.tot-container {
  width: 100%;
  background: var(--container);
  border-radius: 20px;
  padding: 12px 12px 1px;
  box-sizing: border-box;
  margin-top: 5px;
}

/* ===== WRAPPER SQUADRA + LEGHE ===== */

.squadra-wrapper {
  border-radius: 20px;
  background: var(--squadra-wrapper);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  margin-bottom: 15px;
}

.leghe-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--leghe-toggle);
  cursor: pointer;
  user-select: none;
  padding-bottom: 0.3rem;
  margin-top: 5px;
}

.leghe-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.leghe-toggle.open svg {
  transform: rotate(180deg);
}

/* FIX: era "display: flex none" — valore CSS non valido */
.leghe-container {
  display: none;
  flex-direction: column;
  gap: 20px;
}

/* Quando aperto via JS, aggiungere la classe .open al .leghe-container
   oppure impostare display:flex via JS */
.leghe-container.open {
  display: flex;
}

/* ===== BANNER SOCIAL ===== */

.social-footer {
  background: #555;
  color: #fff;
  text-align: center;
  padding: 12px;
  font-size: 14px;
}

.social-footer a {
  color: #ffd700;
  text-decoration: none;
  margin: 0 10px;
}

.centered {
  text-align: center;
  color: white;
  /*margin: 15px;*/
}



#scroll-top-btn {
  position: fixed;
  bottom: 85px;
  right: 16px;
  z-index: 500;
  background: var(--color-2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}


.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  flex: 1;
  padding-right: 2.8em;
  margin-top: 0;
}

.pw-toggle {
  position: absolute;
  right: 0.7em;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1em;
  color: #aaa;
  padding: 0;
  display: flex;
  align-items: center;
  line-height: 1;
  min-height: unset;
  min-width: unset;
}

.pw-toggle:hover {
  color: var(--color-1);
  background: none;
}

.skeleton {
  background: #e0e0e0;
  border-radius: 4px;
  display: inline-block;
  animation: sk-pulse 1.4s ease-in-out infinite;
}

@keyframes sk-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: transparent;
  color: #888;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  margin-bottom: 1px;
}

.info-btn::before {
  content: '?';
}

.info-btn:hover {
  color: #fff;
  background: #888;
  border-color: #888;
}

/* Popup */
.info-popup {
  position: absolute;
  z-index: 9999;
  background: #222;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 260px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.flex-for-info {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}


.menu-btn {
  background: var(--color-2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}