/* Compact Bene.it-Style Design System */
:root {
    --primary-color: #0c3e56;
    --primary-light: #165b7d;
    --secondary-color: #f9a11b;
    --secondary-dark: #cc8416;
    --accent-blue: #007bff;

    --text-main: #1a1a1a;
    --text-muted: #475569;
    /* Darkened from #64748b for better contrast */
    --text-light: #ffffff;

    --bg-main: #ffffff;
    --bg-alt: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.9);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-xl: 36px;

    --section-padding: 120px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 15px;
    /* Reduced from default 16px (~25% visual compacting combined with padding) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-main);
    scroll-behavior: smooth;
    overflow-x: hidden;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Header & Nav */
header {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition-base);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
}

.logo img {
    height: 75px;
    /* Increased from 60px for better visibility */
    width: auto;
    transition: var(--transition-base);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: #334155;
    /* Darker than muted for primary navigation */
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-fast);
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: var(--transition-fast);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-base);
    cursor: pointer;
    border: none;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary-color);
    color: var(--text-light);
    box-shadow: 0 4px 14px 0 rgba(249, 161, 27, 0.3);
}

.btn-primary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 161, 27, 0.4);
}

.btn-secondary {
    background: var(--primary-color);
    color: var(--text-light);
    box-shadow: 0 4px 14px 0 rgba(12, 62, 86, 0.3);
}

.btn-secondary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(12, 62, 86, 0.4);
}

.nav-cta {
    font-size: 0.9rem;
    padding: 10px 20px;
}

.footer-btn {
    font-size: 0.8rem;
    padding: 8px 16px;
    margin-top: 10px;
    border-radius: var(--radius-sm);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(12, 62, 86, 0.8) 0%, rgba(12, 62, 86, 0.5) 100%),
        url('https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&q=80&w=1920') center/cover no-repeat fixed;
    color: var(--text-light);
    padding: calc(var(--section-padding) * 1.2) 0 var(--section-padding);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
}

/* Partners Section */
.partners {
    padding: 30px 0;
    background: var(--bg-main);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.partners-label {
    text-align: center;
    font-size: 0.9rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 32px;
    font-weight: 700;
}

.partners-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    flex-wrap: wrap;
    opacity: 0.9;
    filter: grayscale(50%);
    transition: var(--transition-base);
}

.partners:hover .partners-grid {
    opacity: 1;
    filter: grayscale(0);
}

.partner-logo {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.partners-subtext {
    text-align: center;
    font-size: 1rem;
    color: var(--text-main);
    margin-top: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-content h1 {
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    line-height: 1;
    margin-bottom: 24px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.hero-content p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin: 0 auto 40px;
    opacity: 0.95;
    font-weight: 400;
    max-width: 600px;
}

.hero-btns {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Services */
.services {
    padding: var(--section-padding) 0;
    background-color: var(--bg-main);
}

.section-title {
    text-align: center;
    font-size: clamp(2.5rem, 5vw, 3.2rem);
    margin-bottom: 80px;
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
}

.service-card {
    background: var(--bg-main);
    padding: 48px 32px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.service-card i {
    font-size: 2.2rem;
    color: var(--secondary-color);
    margin-bottom: 24px;
    background: rgba(249, 161, 27, 0.08);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.service-card h3 {
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 700;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* About Section / Chi Siamo */
.trust-about {
    padding: var(--section-padding) 0;
    background-color: var(--bg-alt);
}

.about-flex {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    align-items: center;
    gap: 100px;
}

@media (max-width: 992px) {
    .about-flex {
        grid-template-columns: 1fr;
        gap: 64px;
    }
}

.about-image {
    position: relative;
    max-width: 50%;
    margin: 0 auto;
}

.about-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    /* Made it square for a cleaner look when smaller */
    object-fit: cover;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: block;
}

.about-text h2 {
    font-size: clamp(2rem, 3.5vw, 2.5rem);
    margin-bottom: 24px;
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.about-text strong {
    color: var(--primary-color);
}

.about-text .egs-link {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1.5px solid var(--secondary-color);
    padding-bottom: 1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.about-text .egs-link:hover {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

/* Aglea Salus Section */
.aglea-section {
    padding: 80px 0;
    background-color: var(--bg-main);
}

.aglea-card {
    display: flex;
    align-items: center;
    gap: 48px;
    background: var(--bg-alt);
    border-radius: var(--radius-xl);
    padding: 48px 56px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.04);
    max-width: 860px;
    margin: 0 auto;
    transition: var(--transition-base);
}

.aglea-card:hover {
    box-shadow: var(--shadow-lg);
}

.aglea-logo-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.aglea-logo {
    max-width: 140px;
    height: auto;
    display: block;
}

.aglea-content {
    flex: 1;
}

.aglea-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.aglea-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0;
}

.aglea-content strong {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .aglea-card {
        flex-direction: column;
        text-align: center;
        padding: 40px 28px;
        gap: 28px;
    }

    .aglea-logo {
        max-width: 120px;
    }

    .aglea-title {
        font-size: 1.15rem;
    }
}

/* Reviews Section */
.reviews {
    padding: var(--section-padding) 0;
    background: var(--bg-alt);
}

.reviews-header {
    text-align: center;
    margin-bottom: 60px;
}

.google-rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: -20px;
}

.rating-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.google-rating .stars {
    color: var(--secondary-color);
    font-size: 1.25rem;
}

.rating-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-bottom: 48px;
}

.review-card {
    background: var(--bg-main);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.review-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.review-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.review-author {
    font-weight: 700;
    color: var(--primary-color);
}

.review-stars {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.review-card p {
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.7;
}

.reviews-cta {
    text-align: center;
}

/* Quote Widget Section */
.quote-widget-section {
    padding: var(--section-padding) 0;
}

.widget-wrapper {
    background: transparent;
    padding: 0;
    /* Let the widget use all available space */
    border-radius: var(--radius-xl);
    width: 100%;
}

@media (max-width: 768px) {
    .widget-wrapper {
        padding: 0;
    }
}

/* Booking Section */
.booking-section {
    padding: var(--section-padding) 0;
}

.booking-section iframe,
#quotatore_iframe {
    width: 100% !important;
    min-height: 850px !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    border-radius: var(--radius-md);
    background: #ffffff;
    /* Ensure it's visible even if transparent */
    max-width: 100%;
    /* Forziamo a non superare lo schermo */
    box-sizing: border-box;
    /* padding e bordi inclusi nel width */
    display: block;
}

/* Ottimizzazione specifica del calendario per Mobile */
@media screen and (max-width: 768px) {
    .booking-section {
        padding: 40px 10px;
        /* Riduciamo il padding laterale della sezione */
    }

    .widget-wrapper {
        width: 100%;
        margin: 0;
        padding: 0;
        -webkit-overflow-scrolling: touch;
        /* scrolling fluido su iOS */
    }

    .booking-section iframe,
    #quotatore_iframe {
        min-height: 700px !important;
        /* Manteniamo un'altezza media per mostrare le ore */
        height: 700px !important;
        border-radius: var(--radius-sm);
        border: none !important;
        /* Evitiamo bordi extra se non necessari su mobile */
        width: 100% !important;
        max-width: 100vw !important;
        /* Non superare MAI la Viewport */
        margin-left: 0;
        margin-right: 0;
    }
}

/* Lead Gen Form */
.lead-gen {
    padding: var(--section-padding) 0;
    background: var(--white);
}

.form-container {
    background: var(--bg-alt);
    padding: 80px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 992px) {
    .form-container {
        grid-template-columns: 1fr;
        padding: 48px;
        gap: 48px;
    }
}

.form-text h2 {
    font-size: clamp(2rem, 3.5vw, 2.4rem);
    color: var(--primary-color);
    margin-bottom: 16px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.form-text p {
    font-size: 1rem;
    color: var(--text-muted);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 16px 24px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    transition: var(--transition-fast);
    color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(249, 161, 27, 0.1);
}

.w-100 {
    width: 100%;
}

/* FAQ */
.faq {
    padding: 80px 0;
    background: var(--bg-alt);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.faq-item {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.faq-item h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 700;
}

.faq-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Footer & Legal */
footer {
    background-color: #0c1c24;
    color: var(--text-light);
    padding: var(--section-padding) 0 64px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 60px;
    margin-bottom: 60px;
}

.footer-info h3,
.footer-links h3,
.footer-social h3 {
    margin-bottom: 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
    position: relative;
    padding-bottom: 12px;
}

.footer-info h3::after,
.footer-links h3::after,
.footer-social h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--secondary-color);
    border-radius: 2px;
}

.footer-info p {
    margin-bottom: 12px;
    opacity: 0.8;
    font-size: 0.95rem;
}

.footer-links p {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition-fast);
    opacity: 0.8;
}

.footer-links a:hover {
    color: var(--secondary-color);
    opacity: 1;
}

.social-icons {
    display: flex;
    gap: 20px;
}

.social-icons a {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-base);
    text-decoration: none;
}

.social-icons i {
    font-size: 1.25rem;
    color: var(--white);
}

.social-icons a:hover {
    background: var(--secondary-color);
    transform: translateY(-4px);
}

.legal-notice {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.legal-notice p {
    font-size: 0.85rem;
    opacity: 0.6;
    line-height: 1.6;
}

.footer-bottom {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.5;
}

.footer-bottom a {
    color: inherit;
    text-decoration: underline;
}

.footer-egs {
    margin-top: 10px;
    opacity: 0.65;
}

.footer-egs a {
    color: inherit;
    text-decoration: underline;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeInUp 0.8s ease-out both;
}

.hero-content {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.service-card:nth-child(1) {
    animation-delay: 0.1s;
}

.service-card:nth-child(2) {
    animation-delay: 0.2s;
}

.service-card:nth-child(3) {
    animation-delay: 0.3s;
}

.service-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 24px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-main);
        flex-direction: column;
        padding: 40px;
        gap: 24px;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .hero {
        padding: 120px 0 80px;
    }

    .hero-btns {
        flex-direction: column;
    }

    .btn-secondary {
        margin-left: 0;
    }
}

/* Back to Top button */
.back-to-top {
    position: fixed;
    bottom: 90px;
    right: 25px;
    background-color: var(--primary-color);
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-5px);
}

/* AI Chat Floating Button & Window */
#ai-chat-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 10000;
    font-family: inherit;
}

#ai-chat-toggle {
    width: 55px;
    height: 55px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#ai-chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    background-color: var(--secondary-color);
}

#ai-chat-toggle.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
}

#ai-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#ai-chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

#ai-chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
}

#ai-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#ai-chat-close:hover {
    opacity: 1;
}

#ai-chat-iframe {
    flex: 1;
    border: none;
    width: 100%;
}

/* Mobile Optimizations for AI Chat */
@media (max-width: 480px) {
    #ai-chat-window {
        width: calc(100% - 40px);
        height: 70vh;
        bottom: 80px;
    }
}

/* --- Cookie Banner --- */
#cookieBanner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-md);
    z-index: 10000;
    border: 1px solid var(--bg-alt);
    animation: fadeInUp 0.5s ease-out;
}

.cookie-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.cookie-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.cookie-content a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
}