/* Stili per la pagina Hub delle Storie */

:root {
  --primary-color: #00aaff;
  --secondary-color: #ff00ff;
  --dark-bg: #050816;
  --light-text: #f0f0f0;
  /* MODIFICA: Opacità card storia aumentata drasticamente */
  --card-bg: rgba(16, 22, 47, 0.85); 
  --card-border: rgba(255, 255, 255, 0.1);
}

.hub-body {
    background-color: var(--dark-bg);
    color: var(--light-text);
}

.hub-content-wrapper {
    padding-top: 2rem;
}

.hub-title-section {
    text-align: center;
    padding: 3rem 0;
    animation: fadeInScaleUp 0.8s ease-out;
}

.hub-title-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    margin-bottom: 1rem;
}

.hub-title-section p {
    font-size: 1.2rem;
    color: #aeb9e1;
    max-width: 700px;
    margin: 0 auto;
}

/* --- STILI PER LA BARRA DEI FILTRI CON OPACITÀ AUMENTATA --- */
.hub-filters-container {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
    align-items: center;
    flex-wrap: wrap;
    /* MODIFICA: Opacità contenitore filtri aumentata */
    background-color: rgba(13, 18, 38, 0.95); 
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.hub-filter-group {
    position: relative;
    display: flex;
    align-items: center;
    /* MODIFICA: Opacità gruppo filtro aumentata */
    background-color: rgba(5, 8, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.4s ease;
    flex: 1 1 300px; /* Base flessibile per la responsività */
}

.hub-filter-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.3);
}

.hub-filter-group i {
    padding: 0 1.2rem;
    color: #aeb9e1;
    font-size: 1.1rem;
}

.hub-filter-group input, .hub-filter-group select {
    width: 100%;
    padding: 1rem 1rem 1rem 0;
    background-color: transparent;
    border: none;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
}

.hub-filter-group input::placeholder {
    color: #aeb9e1;
    opacity: 0.8;
}

.hub-filter-group input:focus, .hub-filter-group select:focus {
    outline: none;
}

.hub-filter-group select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23aeb9e1' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    padding-right: 3rem;
    cursor: pointer;
}

.hub-filter-group select option {
    background-color: var(--dark-bg);
    color: #fff;
}
/* --- FINE STILI NUOVI --- */


.genre-section {
    margin-bottom: 4rem;
    animation: fadeInScaleUp 0.5s ease-out backwards;
}

.genre-section h2 {
    font-size: 2.2rem;
    color: #fff;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.8rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.genre-section h2 .fas {
    margin-right: 10px;
    color: var(--primary-color);
}

.genre-description {
    color: #aeb9e1;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.hub-stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

@media (min-width: 992px) {
    .hub-stories-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}


.hub-story-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid var(--card-border);
    animation: slideUpFadeIn 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    opacity: 0;
    animation-delay: calc(var(--delay-index, 0) * 80ms);
}

.hub-story-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 170, 255, 0.3);
}

.hub-card-image-container {
    height: 220px;
    overflow: hidden;
    background-color: #1a1f36; /* Colore di sfondo mentre carica l'immagine */
}

.hub-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hub-story-card:hover .hub-card-img {
    transform: scale(1.1);
}

.hub-card-content {
    padding: 1.5rem;
}

.hub-card-content h3 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-card-content p {
    font-size: 0.9rem;
    color: #aeb9e1;
}

/* Stili per storie nascoste e bottone "Mostra di più" */
.hidden-story {
    display: none;
}

.show-more-container {
    text-align: center;
    margin-top: 2rem;
}

/* Modal Preview Stili */
.modal-preview-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(5, 8, 22, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0s 0.4s;
}

.modal-preview-overlay.active {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.modal-preview-content {
    background: linear-gradient(145deg, #1a1f36, #0d1226);
    padding: 2.5rem 3rem;
    border-radius: 15px;
    border: 1px solid var(--primary-color);
    width: 90%;
    max-width: 700px;
    position: relative;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
    box-shadow: 0 10px 40px rgba(0, 170, 255, 0.2);
}

.modal-preview-overlay.active .modal-preview-content {
    transform: translateY(0) scale(1);
}

.modal-preview-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
}

.modal-preview-close:hover {
    color: white;
    transform: rotate(90deg);
}

#modal-story-title {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--primary-color);
}

.story-preview-text {
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 15px;
    margin-bottom: 2rem;
    color: #ccc;
    line-height: 1.7;
    font-size: 1.1rem;
    text-align: justify;
}

/* Spinner per il caricamento */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

#modal-content-loader {
    text-align: center;
}

/* Stile per la scrollbar del modal */
.story-preview-text::-webkit-scrollbar {
    width: 8px;
}
.story-preview-text::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}
.story-preview-text::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#modal-read-story-btn {
    display: block;
    width: 100%;
    text-align: center;
}

@keyframes fadeInScaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hub-card-content p {
    font-size: 0.9rem;
    color: #aeb9e1;
}

.author-link {
    color: #aeb9e1;
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}
.author-link::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    background-color: var(--primary-color);
    bottom: -2px;
    left: 0;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.author-link:hover {
    color: #fff;
}
.author-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* *** STILI: Stili per l'autore e l'avatar nella card *** */
.author-info {
    display: flex;
    align-items: center;
    margin-top: 12px;
    gap: 10px; /* Spazio tra avatar e testo */
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
    background-color: #1a1f36; /* Sfondo per avatar che non caricano */
}

.author-info p {
    margin: 0; /* Rimuove il margine di default del paragrafo */
    font-size: 0.9rem;
    color: #aeb9e1;
    line-height: 1; /* Assicura un allineamento corretto */
}
