/*
 * stAInsalute - Foglio di Stile Migliorato
 * Author: Valentino Grossi
 * Version: 3.0
 */

/* 1. IMPOSTAZIONI GLOBALI E VARIABILI CSS */
:root {
    --primary-color: #3B82F6;
    --primary-dark: #1E40AF;
    --secondary-color: #7C3AED;
    --tertiary-color: #059669;
    --text-dark: #1F2937;
    --text-light: #4B5563;
    --text-white: #FFFFFF;
    --bg-light: #F9FAFB;
    --bg-white: #FFFFFF;
    --border-color: #E5E7EB;

    --success-color: #059669;
    --warning-color: #D97706;
    --error-color: #DC2626;

    --linkedin-color: #0077B5;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --header-height: 80px;
    --border-radius: 12px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-speed: 0.3s;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: var(--font-family);
    line-height: 1.7;
    color: var(--text-light);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 2. TIPOGRAFIA */
h1, h2, h3, h4 {
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h4 { font-size: 1.1rem; font-weight: 700; }
p { margin-bottom: 1rem; }
a { color: var(--primary-color); text-decoration: none; }
blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-dark);
}

/* 3. BOTTONI E ELEMENTI INTERATTIVI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 12px 28px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-white);
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--text-white);
    border-color: var(--text-white);
}
.btn-secondary:hover {
    background: var(--text-white);
    color: var(--primary-dark);
}

.btn-secondary-dark {
    background: transparent;
    color: var(--text-dark);
    border-color: var(--border-color);
}
.btn-secondary-dark:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-linkedin {
    background: var(--linkedin-color);
    color: var(--text-white);
    font-size: 1.1rem;
    padding: 16px 32px;
}
.btn-linkedin:hover {
    background: #005E94;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 4. HEADER E NAVIGAZIONE */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: all var(--transition-speed) ease;
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand {
    color: inherit;
    text-decoration: none;
}
.brand-logo {
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 1.5rem;
}
.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-light);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-light);
    font-weight: 600;
    padding: 0.5rem;
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-speed) ease;
}
.nav-link:hover::after { width: 100%; }

.nav-link-cta {
    background-color: var(--primary-color);
    color: var(--text-white);
    padding: 8px 16px;
    border-radius: 8px;
    transition: background-color var(--transition-speed) ease;
}
.nav-link-cta:hover { background-color: var(--primary-dark); }
.nav-link-cta::after { display: none; }

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-dark);
}

/* 5. SEZIONI PRINCIPALI */

/* Sezione Hero */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
    color: var(--text-white);
    text-align: center;
    padding: 10rem 0 5rem;
    overflow: hidden;
}
.hero-background {
    position: absolute;
    inset: 0;
    background-image: url('https://images.pexels.com/photos/5473300/pexels-photo-5473300.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    opacity: 0.15;
    transform: scale(1.1);
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero-title .highlight { color: #A5B4FC; }
.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    opacity: 0.9;
}
.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

/* Header di Sezione Generico */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}
.section-header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Sezione Dashboard */
.dashboard-section {
    padding: 5rem 0;
    background-color: var(--bg-light);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.dashboard-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all var(--transition-speed) ease;
    border: 1px solid var(--border-color);
}
.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}
.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.card-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}
.card-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    min-height: 40px;
}
.card-note {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Sezione Progetti */
.projects-section {
    padding: 5rem 0;
    background-color: var(--bg-white);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 3rem;
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.filter-group label {
    font-weight: 600;
    color: var(--text-dark);
}
.filter-group select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition-speed) ease;
}
.filter-group select:hover,
.filter-group select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}
.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.project-title { font-size: 1.3rem; margin: 0; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.tag.status-operativo { background: #D1FAE5; color: var(--success-color); }
.tag.status-pilotaconcluso { background: #FEF3C7; color: var(--warning-color); }
.tag.status-insviluppo { background: #DBEAFE; color: var(--primary-color); }
.tag.scope { background: #EDE9FE; color: var(--secondary-color); }

.project-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    flex-grow: 1;
}
.project-detail h4 {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.organizations { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.org-tag {
    background: var(--bg-light);
    color: var(--text-light);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
}
.project-source {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.8rem;
    font-style: italic;
}

/* Sezione Best Practices */
.best-practices-section {
    padding: 5rem 0;
    background-color: var(--bg-light);
}
.best-practices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}
.practice-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}
.practice-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}
.practice-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.practice-flag { font-size: 3rem; }
.practice-title { font-size: 1.3rem; margin: 0; }
.practice-description {
    padding: 0 1.5rem 1.5rem;
    font-size: 0.95rem;
}
.practice-metrics {
    background: var(--bg-light);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.metric-value {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}
.practice-source {
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
    font-style: italic;
    background-color: #f1f5f9;
}

/* Sezione Startups */
.startups-section {
    padding: 5rem 0;
    background-color: var(--bg-white);
}
.startups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
}
.startup-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all var(--transition-speed) ease;
}
.startup-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--tertiary-color);
}
.startup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.startup-header h3 {
    margin: 0;
    color: var(--tertiary-color);
}
.startup-stage {
    background-color: var(--tertiary-color);
    color: var(--text-white);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    white-space: nowrap;
}
.startup-description {
    font-size: 0.95rem;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}
.startup-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
.startup-details-item {
    display: flex;
    gap: 0.5rem;
}
.startup-details-item i {
    color: var(--tertiary-color);
    width: 20px;
}
.startups-cta {
    text-align: center;
    margin-top: 4rem;
    padding: 2.5rem;
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
}

/* Sezione About */
.about-section {
    padding: 5rem 0;
    background-color: var(--bg-light);
}
.about-container {
    background-color: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 4rem;
    box-shadow: var(--shadow-sm);
}
.about-author {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    align-items: center;
}
.author-image {
    width: 100%;
    max-width: 300px;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    border: 5px solid var(--text-white);
    transition: transform var(--transition-speed) ease;
}
.author-image:hover {
    transform: scale(1.05);
}
.author-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

/* Sezione Newsletter CTA */
.newsletter-cta-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
}
.newsletter-cta-section .section-header p,
.newsletter-cta-section .section-header h2 {
    color: var(--text-white);
}
.newsletter-note {
    margin-top: 1rem;
    opacity: 0.8;
}

/* 6. FOOTER */
.footer {
    background: var(--text-dark);
    color: #D1D5DB;
    padding: 4rem 0 2rem;
}
.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}
.footer-title {
    color: var(--text-white);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a {
    color: #9CA3AF;
    transition: color var(--transition-speed) ease;
}
.footer-links a:hover { color: var(--text-white); }
.footer-social { display: flex; gap: 1.5rem; margin-top: 1.5rem; }
.footer-social a { color: #9CA3AF; font-size: 1.5rem; transition: color var(--transition-speed) ease; }
.footer-social a:hover { color: var(--primary-color); }
.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 2rem;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.9rem;
}

/* 7. ELEMENTI UTILITY */
.loading-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 4rem;
    font-size: 1.2rem;
    color: var(--text-light);
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--text-white);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-speed) ease;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover { 
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* 8. RESPONSIVE DESIGN */
@media (max-width: 992px) {
    .about-author {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .author-image { margin: 0 auto 2rem; }
    .author-links { justify-content: center; }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer-social { justify-content: center; }
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background-color: var(--bg-white);
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        transform: translateX(100%);
        transition: transform var(--transition-speed) ease-in-out;
    }
    .nav-menu.active { transform: translateX(0); }
    .nav-link { font-size: 1.2rem; }

    .best-practices-grid, .dashboard-grid, .startups-grid {
        grid-template-columns: 1fr;
    }
    .about-container { padding: 2rem; }
    
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-buttons { flex-direction: column; width: 100%; }
    .btn { width: 100%; }
}

/* Stampa */
@media print {
    .navbar, .back-to-top, .nav-toggle { display: none; }
    body { color: black; }
    a { color: black; text-decoration: underline; }
}
