/* Stili generali */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #000;
  overflow: hidden;
  padding-top: 70px; 
}

/* --- BARRA DI NAVIGAZIONE --- */
.top-nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-sizing: border-box;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.app-title {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
}
.nav-links {
  display: flex;
  gap: 25px;
}
.nav-link {
  color: #ccc;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
}
.nav-link.active {
  color: #fff;
  background-color: transparent;
  border-bottom-color: #3498DB;
}
.nav-right-section {
  display: flex;
  align-items: center;
  gap: 15px;
}
.search-container {
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-input {
  padding: 10px 16px;
  font-size: 16px;
  border: none;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  width: 250px;
}

.search-button,
.explore-button, 
.review-button,
.quiz-nav-button {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 24px;
  background-color: #3498DB; 
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap; 
}

.search-button {
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 20px;
}

.search-button:hover,
.explore-button:hover,
.review-button:hover,
.quiz-nav-button:hover {
  background-color: #2980B9; 
}

#languageSelect {
  padding: 8px;
  font-size: 16px;
  border-radius: 12px;
  border: none;
  background-color: #fff;
  color: #000;
}

/* Stili per Autenticazione */
.auth-section {
    display: flex;
    align-items: center;
}
.auth-button {
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 20px;
    border: none;
    background-color: #3498DB;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}
.auth-button:hover {
    background-color: #2980B9;
}
#user-status {
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}
#user-email {
    font-weight: 500;
}
#logoutButton {
    background-color: #e74c3c;
}
#logoutButton:hover {
    background-color: #c0392b;
}

/* Stili Originali */
.cards-container { height: calc(100vh - 70px); overflow-y: scroll; scroll-snap-type: y mandatory; background-color: #000; }
.card { position: relative; height: calc(100vh - 70px); scroll-snap-align: start; background-color: #000; }
.card-slideshow { position: absolute; width: 100%; height: 100%; top: 0; left: 0; overflow: hidden; }
.card-image-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(20px) brightness(0.6); transform: scale(1.1); }
.card-image-fg { position: relative; width: 100%; height: 100%; z-index: 1; }
.is-landscape .card-image-bg { display: none; }
.is-landscape .card-image-fg { object-fit: cover; }
.is-portrait .card-image-bg { display: block; }
.is-portrait .card-image-fg { object-fit: contain; }
.card-content { position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; padding: 20px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.8) 20%, rgba(0, 0, 0, 0.95)); color: #fff; transition: max-height 0.3s ease; max-height: 40%; overflow: hidden; display: flex; flex-direction: column; }
.card-content.expanded { max-height: 80%; overflow-y: auto; }
.card-title { margin: 0 0 12px 0; font-size: 24px; font-weight: 700; flex-shrink: 0;  }
.card-text { margin: 0; line-height: 1.6; font-size: 16px; opacity: 0.9; cursor: pointer; overflow-wrap: break-word; word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.event-text { font-style: italic; border-left: 3px solid #3498DB; padding-left: 10px; margin-bottom: 15px; }
.card-content.expanded .card-text { display: block; -webkit-line-clamp: unset; }
.card-actions { flex-shrink: 0; padding-top: 16px; }
.no-toggle { cursor: default; }
.wiki-link, .save-button { display: inline-block; margin-right: 10px; padding: 12px 24px; font-size: 16px; border: none; border-radius: 24px; background-color: #3498DB; color: white; font-weight: 500; transition: background-color 0.2s; text-decoration: none; }
.wiki-link:hover, .save-button:hover { background-color: #2980B9; }
.expand-button { position: absolute; top: 20px; right: 20px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.loading { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 18px; z-index: 1000; }
.error-message { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background-color: rgba(220, 53, 69, 0.9); color: white; padding: 10px 20px; border-radius: 8px; text-align: center; z-index: 2100; }
#modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); z-index: 2000; display: none; align-items: center; justify-content: center; }
#modalContent { width: 90%; max-width: 800px; position: relative; }
#modalClose { position: absolute; top: 10px; right: 10px; background: #3498DB; border: none; border-radius: 50%; color: white; font-size: 20px; width: 40px; height: 40px; cursor: pointer; z-index: 2100; }
.quiz-question { color: #fff; font-size: 20px; margin-bottom: 20px; }
.quiz-extract { color: #fff; font-size: 16px; margin-bottom: 20px; word-wrap: break-word; overflow-wrap: break-word; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { padding: 10px 20px; font-size: 16px; border: 2px solid #3498DB; border-radius: 20px; background-color: transparent; color: #fff; cursor: pointer; transition: background-color 0.2s; }
.quiz-option:hover { background-color: #3498DB; }
.quiz-feedback { margin-top: 20px; font-size: 18px; color: #fff; }
.quiz-input { width: 100%; padding: 10px 16px; font-size: 16px; border: 2px solid #3498DB; border-radius: 24px; background: transparent; color: #fff; margin-bottom: 10px; box-sizing: border-box; }
.quiz-submit-button { padding: 10px 20px; font-size: 16px; border: none; border-radius: 24px; background-color: #3498DB; color: white; cursor: pointer; transition: background-color 0.2s; }
.quiz-submit-button:hover { background-color: #2980B9; }
.quiz-navigation { margin-top: 20px; }
#reviewContainer { display: none; height: calc(100vh - 70px); overflow-y: auto; background-color: #000; padding: 20px; box-sizing: border-box; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 20px; align-items: start; }
.review-card { background-color: #111; border-radius: 8px; overflow: hidden; cursor: pointer; transition: transform 0.2s; position: relative; }
.review-card:hover { transform: scale(1.02); }
.review-card-image { width: 100%; height: 150px; object-fit: cover; }
.review-card-title { margin: 10px; font-size: 18px; font-weight: bold; color: #fff; text-align: center; }
.remove-button { position: absolute; top: 5px; right: 5px; padding: 0; width: 30px; height: 30px; font-size: 20px; line-height: 30px; text-align: center; border: none; border-radius: 50%; background-color: #3498DB; color: white; cursor: pointer; transition: background-color 0.2s; z-index: 10; }
.remove-button:hover { background-color: #2980B9; }
#backToCardsFromReviewButton { margin-top: 20px; padding: 12px 24px; font-size: 16px; border: none; border-radius: 24px; background-color: #3498DB; color: white; cursor: pointer; transition: background-color 0.2s; }
#backToCardsFromReviewButton:hover { background-color: #2980B9; }
.related-container { margin-top: 20px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.related-card { background-color: #111; border-radius: 4px; overflow: hidden; cursor: pointer; text-align: center; }
.related-card img { width: 100%; height: 80px; object-fit: cover; }
.related-card-title { font-size: 14px; padding: 4px; color: #fff; }
.review-card-category { display: block; margin-top: 10px; background-color: rgba(0, 0, 0, 0.5); color: white; padding: 2px 5px; border-radius: 5px; font-size: 12px; text-align: center; }
.review-category-card { background-color: #111; border-radius: 8px; padding: 10px; color: #fff; text-align: center; cursor: pointer; transition: transform 0.2s; }
.review-category-card:hover { transform: scale(1.05); }
.review-category-card img { width: 100%; height: 150px; object-fit: cover; border-radius: 4px; margin-bottom: 5px; }
.review-category-card h2 { margin: 5px 0 0; font-size: 24px; }
.review-category-card p { margin: 5px 0 0; font-size: 16px; }
#categoryModal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); z-index: 2100; display: none; align-items: center; justify-content: center; }
#categoryModalContent { background: #111; color: #fff; padding: 20px; border-radius: 10px; max-width: 400px; width: 90%; text-align: center; }
#categoryModalContent button { margin: 5px; padding: 8px 12px; cursor: pointer; border: none; border-radius: 24px; background-color: #3498DB; color: white; transition: background-color 0.2s; }
#categoryModalContent button:hover { background-color: #2980B9; }
#newCategoryDiv { margin-top: 10px; display: none; }
.donate-button { padding: 10px 20px; font-size: 16px; border: none; border-radius: 20px; background-color: #2ecc71; color: white; cursor: pointer; transition: background-color 0.2s; font-weight: 500; white-space: nowrap; }
.donate-button:hover { background-color: #27ae60; }
#donate-link { text-decoration: none; }

/* STILI PER MODAL DI LOGIN */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 3000; display: none; align-items: center; justify-content: center; }
.auth-modal-content { background: #1c1c1c; padding: 30px 40px; border-radius: 12px; width: 90%; max-width: 400px; position: relative; text-align: center; border: 1px solid rgba(255, 255, 255, 0.1); animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.auth-modal-content h2 { margin-top: 0; margin-bottom: 25px; color: #fff; }
.auth-modal-content input { width: 100%; padding: 12px 16px; font-size: 16px; border: 1px solid #444; border-radius: 8px; background: #222; color: #fff; margin-bottom: 15px; box-sizing: border-box; }
.auth-modal-actions { display: flex; gap: 15px; justify-content: center; margin-top: 10px; }
.auth-modal-close { position: absolute; top: 10px; right: 15px; background: none; border: none; color: #888; font-size: 28px; cursor: pointer; line-height: 1; padding: 0; }
.auth-modal-close:hover { color: #fff; }

.nav-menu-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* =============================================== */
/* --- REGOLE PER MENU RESPONSIVE (HAMBURGER) --- */
/* =============================================== */

.hamburger-button {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 1010;
}

@media (max-width: 992px) { /* Breakpoint leggermente più largo per accomodare tutto */
    .hamburger-button {
        display: block;
    }

    .nav-menu-container {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-menu-container.open {
        display: flex;
    }

    .nav-links, .nav-right-section {
        flex-direction: column;
        gap: 20px;
        width: 90%;
        align-items: stretch; /* Allunga gli elementi per riempire lo spazio */
    }
    .nav-links {
        margin-bottom: 20px;
    }

    .search-container {
        width: 100%;
    }
    .search-input {
        width: 100%;
    }
    
    #languageSelect, #donate-link {
        display: block;
        width: 100%;
    }
    #languageSelect, .donate-button {
        width: 100%;
        text-align: center;
    }

    .auth-section, #user-status {
        flex-direction: column;
        gap: 15px;
        align-items: stretch; /* Allunga anche i pulsanti di login */
    }
}