/* Aggiungi queste regole in fondo al file style.css */

/* Header per pagina notizie */
.page-title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 2rem;
  color: #1e293b;
}

/* Contenitore principale */
.container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar (già definita ma assicuriamoci) */
.sidebar {
  background: linear-gradient(90deg, #fdf033 0%, #03c6fc 100%);
  color: #000;
  width: 220px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  transition: transform 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

/* Contenuto principale */
main {
  flex: 1;
  margin-left: 220px;
  padding: 2rem;
  width: calc(100% - 220px);
  background: #f5f5f5;
}

/* Barra di ricerca */
.searchbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.searchbar input,
.searchbar select {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 1rem;
  flex: 1;
  min-width: 200px;
}

/* Cards delle notizie */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;   /* necessario per far funzionare lo z-index */
  z-index: 4000;        /* maggiore di 1000 */

}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Metadati card */
.meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.by {
  font-size: 0.875rem;
}

.category {
  display: inline-block;
  background: #e0f2fe;
  color: #1d4ed8;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: #1e293b;
  line-height: 1.4;
}

.excerpt {
  color: #64748b;
  margin-bottom: 1.5rem;
  flex: 1;
}

.readmore {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: flex-start;
  text-decoration: none;
}

.readmore:hover {
  background: #1d4ed8;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-size: 1.5rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.modal-meta {
  color: #94a3b8;
  margin-bottom: 1rem;
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: #e2e8f0;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #94a3b8;
  grid-column: 1 / -1;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(37, 99, 235, 0.2);
  border-radius: 50%;
  border-top-color: #2563eb;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #94a3b8;
  background: white;
  border-radius: 12px;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #94a3b8;
  font-size: 0.875rem;
  margin-top: 2rem;
  margin-left: 220px;
  width: calc(100% - 220px);
}

/* Mobile styles */
@media (max-width: 768px) {
  header, main, footer {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .container {
    flex-direction: column;
  }

  .searchbar {
    flex-direction: column;
  }

  .searchbar input, .searchbar select {
    width: 100%;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .modal {
    margin: 1rem;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
}

