/* --- RESET BASE MIGLIORATO --- */
/* Applica solo ai principali elementi di layout */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- CORPO DEL DOCUMENTO --- */
body {
  font-family: 'Roboto', sans-serif;
  background: #f8f9fa;
  color: #212529;
  line-height: 1.6;
  padding: 20px;
}

/* --- CONTENITORE CENTRALE --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
}

/* === HEADER SENZA SFONDO === */
.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 10px;
  position: relative;
  background: #f8f9fa;
}

.logo img {
  height: 109px;
  width: auto;
}

/* Menu di navigazione */
.main-nav {
  display: flex;
  gap: 25px;
  font-weight: 500;
}

.nav-link {
  color: #212529;
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #6200ea;
}

/* Bottone hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.menu-toggle span {
  width: 28px;
  height: 3px;
  background: #212529;
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* --- MEDIA QUERY: MOBILE --- */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 5px);
    left: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 12px;
    z-index: 100;
  }

  .main-nav.active {
    display: flex;
  }

  .logo img {
    height: 109px;
  }
}

/* --- BOX PAROLA DEL GIORNO (index, quiz, traduci) --- */
.card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #dee2e6;
  margin: 30px 0;
  animation: fadeIn 0.4s ease-out;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(98, 0, 234, 0.15);
}

/* --- TITOLO PRINCIPALE --- */
.main-title {
  text-align: center;
  font-size: 1.8rem;
  color: #87898c;
  margin: 20px 0 30px;
  font-weight: 500;
  line-height: 1.4;
}

@media (max-width: 600px) {
  .main-title {
    font-size: 1.6rem;
    padding: 0 10px;
  }
}

.card h2 {
  margin: 0 0 12px 0;
  font-size: 3.9rem;
  color: #6200ea;
  text-align: center;
}

.card .category {
  font-size: 0.95rem;
  color: #0056b3;
  font-weight: 500;
  text-align: center;
  margin-bottom: 16px;
  display: inline-block;
  background: #e3f2fd;
  padding: 6px 12px;
  border-radius: 20px;
}

.card .definition {
  margin: 16px 0;
  line-height: 1.6;
}

.card .definition strong {
  color: #212529;
}

.card .definition span {
  color: #495057;
}

.card .example {
  margin: 16px 0;
  line-height: 1.6;
}

.card .example em {
  display: block;
  background: #f8f9fa;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid #6200ea;
  font-style: normal;
  color: #495057;
  margin-top: 8px;
}

/* --- BOTTONE "NUOVA PAROLA" --- */
#newWordBtn {
  display: block;
  width: 100%;
  background: #6200ea;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(98, 0, 234, 0.3);
}

#newWordBtn:hover {
  background: #5000b8;
  transform: translateY(-2px);
}

/* Animazione entrata */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* --- BLOCCO CONDIVISIONE --- */
.share-group {
  margin: 40px 0 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #dee2e6;
  font-size: 0.95rem;
  line-height: 1.5;
}

.share-group p {
  margin: 0 0 15px 0;
  color: #495057;
  font-style: italic;
}

.share-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.share-links a {
  color: #6200ea;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border: 2px solid #6200ea;
  border-radius: 30px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.share-links a:hover {
  background: #6200ea;
  color: white;
  transform: translateY(-2px);
}

/* Responsive: su mobile i pulsanti si impilano */
@media (max-width: 600px) {
  .share-links {
    gap: 10px;
  }
  
  .share-links a {
    padding: 7px 12px;
    font-size: 0.85rem;
  }
}

/* --- GRIGLIA PER TUTTE LE CATEGORIE --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.category-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #dee2e6;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(98, 0, 234, 0.15);
  border-color: #6200ea;
}

.category-card .emoji {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.category-card .name {
  font-weight: 500;
  display: block;
  margin: 10px 0;
}

.category-card .count {
  font-size: 0.9em;
  color: #6c757d;
}

/* --- GRIGLIA PER PAGINE CATEGORIA --- */
.dictionary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.dictionary-item {
  background: white;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dictionary-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

.dictionary-item h3 {
  margin: 0 0 10px 0;
  font-size: 1.4rem;
  color: #6200ea;
  font-weight: 600;
}

.dictionary-item .category {
  font-size: 0.9rem;
  color: #0056b3;
  font-weight: 500;
  margin-bottom: 12px;
  display: inline-block;
  background: #e3f2fd;
  padding: 4px 10px;
  border-radius: 20px;
}

.dictionary-item p {
  margin: 10px 0;
  line-height: 1.5;
}

.dictionary-item em {
  color: #495057;
  background: #f8f9fa;
  padding: 8px 12px;
  border-radius: 8px;
  font-style: normal;
  display: inline-block;
  margin-top: 10px;
  border-left: 3px solid #6200ea;
}

/* --- NOTA BOOMERPOP --- */
.note {
  font-size: 0.9em;
  color: #6c757d;
  text-align: center;
  margin: 30px 0;
  font-style: italic;
  padding: 15px;
  background: #fff3cd;
  border-radius: 8px;
  border-left: 4px solid #ffc107;
  line-height: 1.5;
}

/* --- PULSANTE --- */
.btn {
  display: inline-block;
  background: #6200ea;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  margin: 20px 0;
  box-shadow: 0 4px 6px rgba(98, 0, 234, 0.3);
  transition: background 0.2s ease;
}

.btn:hover {
  background: #5000b8;
}

/* --- FOOTER --- */
footer {
  text-align: center;
  margin-top: 50px;
  color: #6c757d;
  font-size: 0.9rem;
}

footer a {
  color: #6200ea;
  text-decoration: none;
  margin: 0 5px;
}

footer a:hover {
  text-decoration: underline;
}

/* --- RESPONSIVE AGGIUNTIVO --- */
@media (max-width: 600px) {
  .grid, .dictionary-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .card h2 {
    font-size: 1.8rem;
  }
}
#cookie-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 15px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  font-size: 0.9rem;
  line-height: 1.5;
}

#cookie-banner.show {
  display: block;
}

#cookie-preferences-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #6200ea;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  font-size: 1.5rem;
  transition: transform 0.2s ease;
}

#cookie-preferences-btn:hover {
  transform: rotate(45deg);
}

#preferences-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1001;
  align-items: center;
  justify-content: center;
}

#preferences-modal .modal-content {
  background: white;
  padding: 20px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header h2 {
  margin: 0 0 5px 0;
  color: #6200ea;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.cookie-buttons {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cookie-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 0.9rem;
}

.cookie-btn.secondary {
  background: #6c757d;
  color: white;
}

.cookie-btn {
  background: #6200ea;
  color: white;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #6200ea;
}

input:checked + .slider:before {
  transform: translateX(26px);
}
/* --- CAMPO DI INPUT PERSONALIZZATO --- */
input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.1rem;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  background: white;
  color: #212529;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  margin: 10px 0 15px;
}

input[type="text"]:focus {
  outline: none;
  border-color: #6200ea;
  box-shadow: 0 0 0 3px rgba(98, 0, 234, 0.1);
}

input[type="text"]::placeholder {
  color: #6c757d;
  opacity: 0.7;
}