/* Reset e Variabili Globali */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #8b5cf6;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --lighter: #ffffff;
    --gray: #64748b;
    --gray-light: #cbd5e1;
    
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 8px 25px rgba(0,0,0,0.15);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.2);
    --shadow-xl: 0 25px 60px rgba(0,0,0,0.3);
    
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 30px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark);
    background: var(--lighter);
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    color: var(--lighter);
}

.loading-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-circle {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary);
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: var(--gradient-1);
    width: 0%;
    animation: loading 2s ease-in-out forwards;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header - FIXED */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled {
    background: rgba(255,255,255,0.98);
    box-shadow: var(--shadow-md);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.nav-brand {
    z-index: 1001;
}

.logo-magnetic {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.cta-button {
    background: var(--gradient-1);
    color: white !important;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

.button-hover-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-2);
    border-radius: var(--border-radius);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-link.cta-button:hover .button-hover-effect {
    opacity: 1;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
    background: none;
    border: none;
}

.hamburger span {
    width: 25px;
    height: 2px;
    background: var(--dark);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Hero Section - FIXED */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: var(--darker);
    color: var(--lighter);
    overflow: hidden;
    padding-top: 80px; /* Spazio per header fisso */
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

.gradient-orbit {
    position: absolute;
    border-radius: 50%;
    background: var(--gradient-1);
    filter: blur(60px);
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.gradient-orbit:nth-child(1) {
    width: 500px;
    height: 500px;
    top: -250px;
    right: -250px;
    animation-delay: 0s;
}

.gradient-orbit:nth-child(2) {
    width: 400px;
    height: 400px;
    bottom: -200px;
    left: -200px;
    animation-delay: 2s;
    background: var(--gradient-2);
}

.gradient-orbit:nth-child(3) {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 4s;
    background: var(--gradient-3);
}

.hero .container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.title-line {
    display: block;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.word {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.6s ease;
}

.word.highlight {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--gray-light);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 600px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

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

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 500px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-light);
    line-height: 1.4;
}

.hero-visual {
    position: relative;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-card {
    position: absolute;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: float 3s ease-in-out infinite;
    width: 160px;
}

.floating-card i {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.floating-card h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.floating-card p {
    font-size: 0.8rem;
    color: var(--gray-light);
    margin: 0;
    line-height: 1.4;
}

.card-1 {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.card-2 {
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    animation-delay: 1s;
}

.card-3 {
    bottom: 20%;
    left: 20%;
    animation-delay: 2s;
}

/* Expertise Section */
.expertise {
    padding: 100px 0;
    background: var(--lighter);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--dark);
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

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

.expertise-category {
    background: var(--light);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    border-left: 4px solid var(--primary);
    transition: transform 0.3s ease;
}

.expertise-category:hover {
    transform: translateY(-5px);
}

.expertise-category h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.tech-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tech-list li {
    padding: 0.5rem 0;
    color: var(--gray);
    position: relative;
    padding-left: 1rem;
    line-height: 1.5;
}

.tech-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Services Section */
.services {
    padding: 100px 0;
    background: var(--light);
}

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

.service-card {
    background: var(--lighter);
    padding: 3rem 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-1);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.service-icon i {
    font-size: 2rem;
    color: white;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark);
    text-align: center;
}

.service-card p {
    color: var(--gray);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-align: center;
}

.service-features {
    list-style: none;
    margin: 0 0 2rem 0;
    padding: 0;
}

.service-features li {
    padding: 0.5rem 0;
    color: var(--gray);
    position: relative;
    padding-left: 1.5rem;
    text-align: left;
}

.service-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.service-cta {
    border-top: 1px solid var(--gray-light);
    padding-top: 1.5rem;
    text-align: center;
}

.service-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.service-link:hover {
    gap: 1rem;
    color: var(--primary-dark);
}

/* Technologies Section */
.technologies {
    padding: 100px 0;
    background: var(--lighter);
}

.tech-stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stack-category {
    background: var(--light);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.stack-category h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
    text-align: center;
}

.tech-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.tech-item {
    background: var(--gradient-1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tech-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Contact Section */
.contact {
    padding: 100px 0;
    background: var(--light);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-content {
    padding-right: 2rem;
}

.contact-subtitle {
    font-size: 1.25rem;
    color: var(--gray);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contact-icon {
    width: 50px;
    height: 50px;
    background: var(--gradient-1);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-icon i {
    font-size: 1.25rem;
    color: white;
}

.contact-details h4 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.contact-details span {
    color: var(--gray);
}

.contact-form {
    background: var(--lighter);
    padding: 3rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.form-group {
    position: relative;
    margin-bottom: 2rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 1rem 0;
    border: none;
    border-bottom: 2px solid var(--gray-light);
    background: transparent;
    font-size: 1rem;
    transition: all 0.3s ease;
    resize: vertical;
    font-family: inherit;
}

.form-group select {
    cursor: pointer;
}

.form-group label {
    position: absolute;
    top: 1rem;
    left: 0;
    color: var(--gray);
    transition: all 0.3s ease;
    pointer-events: none;
    background: var(--lighter);
    padding: 0 0.25rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.form-group input:focus + label,
.form-group textarea:focus + label,
.form-group select:focus + label,
.form-group input:valid + label,
.form-group textarea:valid + label,
.form-group select:valid + label {
    top: -0.5rem;
    font-size: 0.875rem;
    color: var(--primary);
}

.form-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: width 0.3s ease;
}

.form-group input:focus ~ .form-line,
.form-group textarea:focus ~ .form-line,
.form-group select:focus ~ .form-line {
    width: 100%;
}

.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem;
    width: 100%;
}

/* Footer */
.footer {
    background: var(--darker);
    color: var(--lighter);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-brand img {
    border-radius: var(--border-radius);
}

.footer-brand h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-brand p {
    color: var(--gray-light);
    margin: 0;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lighter);
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 2rem;
    text-align: center;
    color: var(--gray-light);
    font-size: 0.875rem;
}

/* Scroll to Top */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 968px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
        margin: 0 auto;
    }
    
    .hero-visual {
        height: 300px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        background: var(--lighter);
        width: 100%;
        height: 100vh;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-lg);
        padding: 6rem 2rem 2rem;
        gap: 1.5rem;
        margin: 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    .hero {
        padding-top: 70px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 300px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .expertise-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
    
    .contact-form {
        padding: 2rem 1.5rem;
    }
    
    .floating-card {
        position: relative;
        margin: 1rem;
        width: 140px;
    }
    
    .card-1, .card-2, .card-3 {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        margin: 1rem;
    }
    
    .hero-visual {
        flex-direction: column;
        height: auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
}