/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    min-width: 100%;
    position: relative;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Prevenire overflow su tutti gli elementi */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Prevenire riduzione dimensioni dopo zoom su mobile */
@media screen and (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100% !important;
        -moz-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    body {
        -webkit-text-size-adjust: 100% !important;
        -moz-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    /* Forza dimensioni minime per contenuti principali */
    .container,
    section,
    header,
    .header-content {
        min-width: 100% !important;
        width: 100% !important;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    overflow-x: hidden;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-image {
    position: relative;
}

.profile-image img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: transform 0.3s ease;
}

.profile-image img:hover {
    transform: scale(1.1);
}

.profile-info h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
    font-weight: 300;
}

nav {
    display: flex;
    gap: 30px;
}

nav a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
}

nav a:hover {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* Chat navigation link special styling */
.chat-nav-link {
    position: relative;
    background: linear-gradient(45deg, #9C27B0, #673AB7) !important;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px !important;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
    transition: all 0.3s ease;
    overflow: hidden;
}

.chat-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.chat-nav-link:hover::before {
    left: 100%;
}

.chat-nav-link:hover {
    background: linear-gradient(45deg, #673AB7, #9C27B0) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.5);
}

.chat-nav-link i.fa-cloud {
    font-size: 1.1rem;
    animation: float 3s ease-in-out infinite;
}

.chat-nav-link span {
    font-weight: 600;
    font-size: 1rem;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #2c3e50;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    }
}

/* Responsive adjustments for chat nav link */
@media (max-width: 768px) {
    .chat-nav-link {
        padding: 10px 15px !important;
        font-size: 0.9rem;
    }
    
    .chat-nav-link i.fa-cloud {
        font-size: 1rem;
    }
    
    .nav-badge {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
}

/* Sezioni */
section {
    padding: 80px 0;
    position: relative;
}

section:nth-child(even) {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

h2 {
    text-align: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border-radius: 2px;
}

/* About Section */
.about-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.about-content p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: justify;
}

/* Carousel */
.carousel-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.carousel {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    overflow-x: auto; /* Abilita lo scroll orizzontale */
    scroll-snap-type: x mandatory; /* Abilita lo snap orizzontale */
    -webkit-overflow-scrolling: touch; /* Scrolling fluido su iOS */
    scrollbar-width: none; /* Nasconde la scrollbar su Firefox */
}

.carousel::-webkit-scrollbar {
    display: none; /* Nasconde la scrollbar su Chrome/Safari */
}

.book-card {
    min-width: 300px;
    width: 300px; /* Larghezza fissa di base */
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Non permettere che si restringano nel carousel */
    scroll-snap-align: center; /* Aggancia ogni card al centro */
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.book-card img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.book-card:hover img {
    transform: scale(1.05);
}

.book-image-container {
    position: relative;
    width: 100%;
    height: 400px;
    cursor: pointer;
    overflow: hidden;
}

.book-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.book-image-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.book-image-hint i {
    font-size: 0.9rem;
}

.book-image-container:hover .book-image-hint {
    opacity: 1;
}

.book-image-container:hover img {
    transform: scale(1.05);
}

.book-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.book-info h3 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.4;
    height: 3.92rem; /* 2 righe: 1.4rem * 1.4 * 2 = 3.92rem */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.book-year {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
}

.book-genre {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
}

.book-description {
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
    flex-grow: 1;
    margin-bottom: 15px;
}

.book-link {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
    align-self: flex-start;
    text-align: center;
}

.book-link:hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.book-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.prefazione-btn {
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    border: none;
    cursor: pointer;
}

.prefazione-btn:hover {
    background: linear-gradient(45deg, #764ba2, #667eea) !important;
}

.preface-header {
    padding: 30px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.preface-title {
    font-size: 2rem;
    color: white;
    margin-bottom: 10px;
    font-weight: 700;
}

.preface-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preface-content {
    padding: 30px 40px;
}

.preface-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.preface-text p {
    margin-bottom: 20px;
}

/* Transmission specific styles */
#transmissions {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.transmission-card {
    min-width: 300px;
    width: 300px; /* Larghezza fissa di base */
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Non permettere che si restringano nel carousel */
    scroll-snap-align: center; /* Aggancia ogni card al centro */
}

.transmission-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.transmission-card img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.transmission-card:hover img {
    transform: scale(1.05);
}

.transmission-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.transmission-info h3 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.transmission-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.transmission-year {
    background: linear-gradient(45deg, #9C27B0, #673AB7);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
}

.transmission-genre {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
}

.transmission-description {
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
    flex-grow: 1;
    margin-bottom: 15px;
}

.transmission-link {
    display: inline-block;
    margin-top: auto;
    padding: 10px 20px;
    background: linear-gradient(45deg, #9C27B0, #673AB7);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.9rem;
    align-self: flex-start;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(156, 39, 176, 0.3);
}

.transmission-link:hover {
    background: linear-gradient(45deg, #673AB7, #9C27B0);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(156, 39, 176, 0.4);
}

.transmission-link i {
    margin-right: 8px;
}

/* Blog Styles */
#blog {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.blog-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* Blog Carousel Styles */
.blog-carousel-container {
    position: relative;
    margin: 40px 0;
    overflow: hidden;
}

.blog-carousel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    transition: transform 0.5s ease;
    min-height: 500px;
}

.blog-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #2c3e50;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.blog-carousel-btn:hover {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.blog-carousel-btn.prev {
    left: -25px;
}

.blog-carousel-btn.next {
    right: -25px;
}

.blog-carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.blog-carousel-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #2c3e50;
    transform: translateY(-50%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.blog-carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.blog-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.blog-indicator.active {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    transform: scale(1.2);
}

.blog-indicator:hover {
    background: rgba(255, 255, 255, 0.6);
}

.blog-indicator.active:hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
}

/* Responsive blog carousel */
@media (max-width: 1200px) {
    .blog-carousel {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .blog-carousel {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, 1fr);
        gap: 15px;
    }
    
    .blog-carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .blog-carousel-btn.prev {
        left: -20px;
    }
    
    .blog-carousel-btn.next {
        right: -20px;
    }
}

.blog-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
}

.blog-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.blog-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-content {
    padding: 25px;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.blog-category {
    background: linear-gradient(45deg, #9C27B0, #673AB7);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
    font-size: 0.8rem;
}

.blog-date {
    color: #7f8c8d;
}

.blog-title {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.blog-preview {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.blog-tag {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.blog-read-more {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.blog-read-more:hover {
    color: #45a049;
}

/* Contact Form Styles */
.contact-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-bottom: 50px;
}

.contact-text h3 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.contact-text p {
    color: #555;
    line-height: 1.6;
    font-size: 1.1rem;
}

.contact-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.submit-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
}

.submit-btn:hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.social-section {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.social-section h3 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .contact-info {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-filters {
        gap: 10px;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

/* Article Modal Styles */
.article-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.article-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.article-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.article-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.article-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.article-hero {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.article-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 30px;
    color: white;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.article-category {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
}

.article-date {
    color: rgba(255, 255, 255, 0.9);
}

.article-title {
    font-size: 2rem;
    color: white;
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.article-content {
    padding: 40px;
    line-height: 1.8;
    color: #333;
    font-size: 1.1rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
    padding: 20px 40px 0;
}

.article-tag {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.article-text {
    margin-bottom: 30px;
}

.article-text p {
    margin-bottom: 20px;
}

.article-text h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin: 30px 0 15px 0;
    font-weight: 600;
}

.article-text h4 {
    color: #34495e;
    font-size: 1.3rem;
    margin: 25px 0 10px 0;
    font-weight: 600;
}

.article-text ul, .article-text ol {
    margin: 15px 0;
    padding-left: 30px;
}

.article-text li {
    margin-bottom: 8px;
}

.article-text blockquote {
    border-left: 4px solid #4CAF50;
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #555;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 0 10px 10px 0;
}

.article-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 30px 40px;
    background: #f8f9fa;
    border-top: 1px solid #ecf0f1;
}

.article-action-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-action-btn:hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.article-action-btn.secondary {
    background: linear-gradient(45deg, #9C27B0, #673AB7);
}

.article-action-btn.secondary:hover {
    background: linear-gradient(45deg, #673AB7, #9C27B0);
}

/* Responsive for article modal */
@media (max-width: 768px) {
    .article-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .article-tags {
        padding: 15px 20px 0;
    }
    
    .article-actions {
        padding: 20px;
        flex-direction: column;
    }
    
    .article-hero {
        height: 200px;
    }
}

/* Chat Modal Styles */
.chat-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.chat-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.chat-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header h3 i {
    color: #4CAF50;
}

.chat-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.chat-close:hover {
    background: #ecf0f1;
    color: #e74c3c;
}

.chat-body {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    display: flex;
    margin-bottom: 15px;
    animation: messageSlide 0.3s ease;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.system {
    justify-content: flex-start;
}

.chat-message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 20px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.user .message-content {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border-bottom-right-radius: 5px;
}

.system .message-content {
    background: linear-gradient(45deg, #ecf0f1, #bdc3c7);
    color: #2c3e50;
    border-bottom-left-radius: 5px;
}

.assistant .message-content {
    background: linear-gradient(45deg, #9C27B0, #673AB7);
    color: white;
    border-bottom-left-radius: 5px;
}

.message-content i {
    font-size: 1.2rem;
    margin-top: 2px;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

.chat-input-container {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#chatInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #ecf0f1;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#chatInput:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

#sendButton {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendButton:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

#sendButton:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.chat-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.action-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #2c3e50;
    border: 1px solid #bdc3c7;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #7f8c8d;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #7f8c8d;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .chat-body {
        height: 400px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .chat-actions {
        flex-direction: column;
    }
    
    .action-btn {
        justify-content: center;
    }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.carousel-btn:hover {
    background: rgba(76, 175, 80, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #4CAF50;
    transform: scale(1.2);
}

/* Contact Section */
.contact-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.contact-content p {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 40px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #2c3e50;
    padding: 20px;
    border-radius: 15px;
    transition: all 0.3s ease;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.social-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.social-link i {
    font-size: 2rem;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.social-link:hover i {
    transform: scale(1.2);
}

.social-link span {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Colori specifici per i social */
.social-link.email:hover { background: linear-gradient(45deg, #ea4335, #fbbc05); color: white; }
.social-link.twitter:hover { background: linear-gradient(45deg, #1da1f2, #0d8bd9); color: white; }
.social-link.instagram:hover { background: linear-gradient(45deg, #e4405f, #fd1d1d, #fcb045); color: white; }
.social-link.linkedin:hover { background: linear-gradient(45deg, #0077b5, #005885); color: white; }
.social-link.facebook:hover { background: linear-gradient(45deg, #1877f2, #0d65d9); color: white; }

/* Footer */
footer {
    background: rgba(44, 62, 80, 0.95);
    color: white;
    text-align: center;
    padding: 30px 0;
    backdrop-filter: blur(10px);
}

footer a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #45a049;
}

/* Responsive */
@media (max-width: 768px) {
    html {
        overflow-x: hidden !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        position: relative;
        -webkit-text-size-adjust: 100% !important;
        -moz-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        position: relative;
        -webkit-text-size-adjust: 100% !important;
        -moz-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    * {
        max-width: 100%;
    }
    
    .container {
        padding: 0 15px;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    section {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    header {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 15px 15px;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .profile-section {
        flex-direction: column;
        text-align: center;
        width: 100%;
        justify-content: center;
        align-items: center;
    }
    
    .profile-info {
        width: 100%;
        text-align: center;
    }
    
    .profile-info h1 {
        font-size: 1.8rem;
        text-align: center;
    }
    
    .subtitle {
        font-size: 0.95rem;
        text-align: center;
    }
    
    nav {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    nav a {
        padding: 8px 12px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    h2 {
        font-size: 1.8rem;
        text-align: center;
        width: 100%;
        padding: 0 15px;
    }
    
    h2::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    section {
        padding: 40px 0;
    }
    
    .about-content {
        padding: 20px;
        text-align: justify;
    }
    
    .about-content p {
        text-align: justify;
        line-height: 1.8;
    }
    
    .book-card {
        min-width: 280px !important;
        width: 280px;
        flex-shrink: 0;
        margin: 0;
    }
    
    .transmission-card {
        min-width: 280px !important;
        width: 280px;
        flex-shrink: 0;
        margin: 0;
    }
    
    .social-links {
        gap: 15px;
        justify-content: center;
    }
    
    .social-link {
        min-width: 90px;
        padding: 12px;
    }
    
    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .prev {
        left: 5px;
    }
    
    .next {
        right: 5px;
    }
    
    .carousel-container {
        margin: 0;
        width: 100%;
        padding: 0;
        max-width: 100vw;
        overflow: hidden;
        position: relative;
        border-radius: 0;
        box-shadow: none;
    }
    
    .carousel {
        padding: 0;
        gap: 0;
    }

    .book-card,
    .transmission-card {
        width: 100%;
        min-width: 100%;
        scroll-snap-align: center; /* Assicura lo snap anche su mobile */
    }
    
    .book-info {
        padding: 25px 20px;
    }

    .transmission-info {
        padding: 25px 20px;
    }
    
    .blog-carousel-container {
        width: 100%;
        padding: 0 10px;
        max-width: 100%;
        overflow: hidden; /* Mantieni overflow hidden sul container */
        position: relative;
    }
    
    .blog-carousel {
        width: auto; /* Lascia che il carousel sia più largo del container */
        max-width: none !important; /* Rimuovi max-width per permettere il movimento */
        overflow: visible; /* Permetti che gli elementi siano visibili durante il movimento */
    }
    
    /* Eccezione per gli elementi del blog-carousel */
    .blog-carousel > * {
        max-width: none !important;
    }
    
    .book-card {
        min-width: 280px; /* Mantieni la larghezza minima per il carousel */
        max-width: none; /* Rimuovi max-width per permettere il carousel */
        flex-shrink: 0; /* Non permettere che si restringano */
    }
    
    .transmission-card {
        min-width: 280px; /* Mantieni la larghezza minima per il carousel */
        max-width: none; /* Rimuovi max-width per permettere il carousel */
        flex-shrink: 0; /* Non permettere che si restringano */
    }
    
    .blog-card {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .contact-content {
        width: 100%;
        padding: 0;
    }
    
    .contact-info {
        width: 100%;
        padding: 0 10px;
    }
    
    .contact-text {
        text-align: center;
        padding: 0 10px;
    }
    
    .contact-text h3 {
        text-align: center;
    }
    
    .contact-text p {
        text-align: center;
    }
    
    .contact-content {
        padding: 20px 15px;
    }
    
    .contact-form {
        padding: 20px 15px;
    }
    
    .blog-filters {
        gap: 8px;
        padding: 0 10px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .social-section {
        padding: 20px 15px;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
    }
    
    .social-section h3 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    footer {
        padding: 20px 15px;
        text-align: center;
    }
    
    footer .container {
        text-align: center;
    }
    
    .carousel-indicators {
        justify-content: center;
        padding: 0 10px;
    }
    
    .blog-carousel-indicators {
        justify-content: center;
        padding: 0 10px;
    }
    
    .article-modal,
    .chat-modal,
    #prefaceModal {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .article-modal-content,
    .chat-modal-content {
        max-width: 95vw;
        width: 95%;
    }
    
    /* Prevenire scroll orizzontale su tutti gli elementi */
    nav {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    nav::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
}

@media (max-width: 480px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        position: relative;
        -webkit-text-size-adjust: 100% !important;
        -moz-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
    
    * {
        max-width: 100%;
    }

    /* Eccezioni per i carousel - devono poter essere più larghi del container */
    .carousel,
    .carousel > *,
    .blog-carousel,
    .blog-carousel > * {
        max-width: none !important;
    }
    
    .container {
        padding: 0 12px;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    section {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .header-content {
        padding: 12px 12px;
    }
    
    .profile-image img {
        width: 60px;
        height: 60px;
    }
    
    .profile-info h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    nav {
        gap: 8px;
    }
    
    nav a {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    section {
        padding: 30px 0;
    }
    
    h2 {
        font-size: 1.5rem;
        padding: 0 10px;
        text-align: center;
        width: 100%;
    }
    
    h2::after {
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
    }
    
    .about-content {
        padding: 15px;
    }
    
    .about-content p {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    .book-card {
        min-width: 280px !important; /* Forza una larghezza minima ragionevole */
        width: 280px; /* Imposta una larghezza fissa */
        max-width: 90vw !important; /* Non più larga dello schermo */
        flex-shrink: 0; /* Non permettere che si restringano */
        margin: 0;
    }
    
    .transmission-card {
        min-width: 280px !important; /* Forza una larghezza minima ragionevole */
        width: 280px; /* Imposta una larghezza fissa */
        max-width: 90vw !important; /* Non più larga dello schermo */
        flex-shrink: 0; /* Non permettere che si restringano */
    }
    
    /* Eccezione per gli elementi del carousel su schermi piccoli */
    .carousel > *,
    .blog-carousel > * {
        max-width: none !important;
    }
    
    .book-info {
        padding: 15px;
    }
    
    .book-description {
        font-size: 0.9rem;
    }
    
    .social-links {
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .social-link {
        min-width: 70px;
        padding: 10px;
        font-size: 0.8rem;
    }
    
    .social-link i {
        font-size: 1.2rem;
    }
    
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .prev {
        left: 2px;
    }
    
    .next {
        right: 2px;
    }
    
    .blog-filters {
        gap: 5px;
        padding: 0 5px;
    }
    
    .filter-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .contact-form {
        padding: 15px 10px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .submit-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .social-section {
        padding: 15px 10px;
    }
    
    .social-section h3 {
        font-size: 1.3rem;
    }
    
    footer {
        padding: 15px 10px;
        font-size: 0.85rem;
    }
    
    .carousel-indicators {
        gap: 5px;
    }
    
    .blog-carousel-indicators {
        gap: 5px;
    }
    
    header {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .header-content {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .article-modal,
    .chat-modal,
    #prefaceModal {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .article-modal-content,
    .chat-modal-content {
        max-width: 95vw;
        width: 95%;
    }
    
    nav {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
