/* ===== VARIABILI CSS ===== */
:root {
    --primary-purple: #8b5cf6;
    --primary-magenta: #ec4899;
    --primary-cyan: #06b6d4;
    --primary-teal: #10b981;
    --dark-purple: #4c1d95;
    --dark-cyan: #0e7490;
    --white: #ffffff;
    --gray-100: #f3f4f6;
    --gray-800: #1f2937;
    --shadow: rgba(139, 92, 246, 0.3);
    
    /* Sfondi solidi - compatibili ovunque */
    --bg-primary: rgba(30, 41, 59, 0.95);
    --bg-secondary: rgba(51, 65, 85, 0.9);
    --bg-tertiary: rgba(17, 24, 39, 0.95);
    --bg-header: rgba(15, 23, 42, 0.9);
    
    /* Text shadows ottimizzati */
    --text-shadow-strong: 2px 2px 4px rgba(0, 0, 0, 0.8);
    --text-shadow-medium: 1px 1px 3px rgba(0, 0, 0, 0.7);
    --text-shadow-light: 1px 1px 2px rgba(0, 0, 0, 0.5);
    
    /* Border universali */
    --border-light: 2px solid rgba(255, 255, 255, 0.6);
    --border-medium: 3px solid rgba(255, 255, 255, 0.7);
    --border-strong: 3px solid rgba(255, 255, 255, 0.8);
}

/* ===== RESET E BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, 
        var(--primary-magenta) 0%, 
        var(--primary-purple) 25%, 
        var(--dark-purple) 50%, 
        var(--dark-cyan) 75%, 
        var(--primary-cyan) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fallback pattern per dispositivi che non supportano fixed background */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
        background-size: 100% 200vh;
    }
}

/* ===== LOADING SCREEN ===== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== HEADER E NAVIGATION ===== */
.header {
    background: var(--bg-header);
    border-bottom: var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 1rem 2rem;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 1rem;
}

.logo {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-cyan);
    text-shadow: var(--text-shadow-strong);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-shadow: var(--text-shadow-medium);
    position: relative;
}

.nav-links a:hover,
.nav-links a:focus {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    color: var(--primary-cyan);
}

.nav-links a:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 140px);
}

/* ===== CONTAINERS UNIVERSALI ===== */
.container {
    background: var(--bg-primary);
    border: var(--border-light);
    border-radius: 20px;
    padding: 3rem;
    margin: 2rem 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.container:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.8);
}

.glass-container {
    background: var(--bg-secondary);
    border: var(--border-medium);
    border-radius: 20px;
    padding: 3rem;
    margin: 2rem 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.glass-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.9);
}

/* ===== SEZIONI SPECIALI ===== */
.about-section {
    background: var(--bg-tertiary);
    border: var(--border-strong);
    border-radius: 16px;
    padding: 2.5rem;
    margin: 2rem 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

.about-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.05), 
        rgba(236, 72, 153, 0.05));
    border-radius: 14px;
    pointer-events: none;
    z-index: 1;
}

.about-section > * {
    position: relative;
    z-index: 2;
}

.text-container {
    background: var(--bg-secondary);
    border: var(--border-medium);
    border-radius: 16px;
    padding: 2.5rem;
    margin: 2rem 0;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

/* ===== TYPOGRAPHY UNIVERSALE ===== */
h1 {
    color: var(--white);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: var(--text-shadow-strong);
    line-height: 1.2;
}

h2 {
    color: var(--white);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    text-shadow: var(--text-shadow-strong);
    line-height: 1.3;
}

h3 {
    color: var(--white);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-weight: 600;
    text-shadow: var(--text-shadow-medium);
    line-height: 1.4;
}

p {
    color: rgba(255, 255, 255, 0.96);
    line-height: 1.7;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-shadow: var(--text-shadow-medium);
    font-weight: 400;
}

.welcome {
    text-align: center;
    color: rgba(255, 255, 255, 0.96);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.7;
    text-shadow: var(--text-shadow-medium);
    font-weight: 400;
}

ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    color: rgba(255, 255, 255, 0.94);
    margin-bottom: 0.5rem;
    line-height: 1.7;
    text-shadow: var(--text-shadow-medium);
    font-weight: 400;
}

/* ===== BUTTONS UNIVERSALI ===== */
.btn {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-cyan));
    color: var(--white);
    text-decoration: none;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    text-shadow: var(--text-shadow-light);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary-magenta), var(--primary-teal));
    transition: left 0.3s ease;
    z-index: -1;
}

.btn:hover::before {
    left: 0;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.6);
}

.btn:active {
    transform: translateY(-1px);
}

.btn:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.buttons {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-tertiary);
    border-top: var(--border-light);
    text-align: center;
    padding: 2.5rem;
    margin-top: 3rem;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}

.footer p {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: var(--text-shadow-medium);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 768px) {
    :root {
        --text-shadow-strong: 2px 2px 6px rgba(0, 0, 0, 0.9);
        --text-shadow-medium: 1px 1px 4px rgba(0, 0, 0, 0.8);
    }
    
    .header {
        padding: 1rem;
    }
    
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
        justify-content: center;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .container,
    .glass-container,
    .about-section,
    .text-container {
        padding: 2rem;
        margin: 1.5rem 0;
    }
    
    .logo {
        font-size: 1.6rem;
    }
    
    h1 {
        font-size: 2.2rem;
        margin-bottom: 1.5rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    p, .welcome {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .footer {
        padding: 2rem 1rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    :root {
        --text-shadow-strong: 2px 2px 8px rgba(0, 0, 0, 0.95);
        --text-shadow-medium: 1px 1px 5px rgba(0, 0, 0, 0.85);
        --bg-primary: rgba(15, 23, 42, 0.98);
        --bg-secondary: rgba(30, 41, 59, 0.95);
        --bg-tertiary: rgba(7, 15, 25, 0.98);
    }
    
    .header {
        padding: 0.8rem;
    }
    
    .navbar {
        gap: 0.8rem;
    }
    
    .nav-links {
        gap: 0.5rem;
    }
    
    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .container,
    .glass-container,
    .about-section,
    .text-container {
        padding: 1.5rem;
        margin: 1rem 0;
        border-radius: 16px;
        border-width: 3px;
    }
    
    .logo {
        font-size: 1.4rem;
    }
    
    h1 {
        font-size: 1.9rem;
        margin-bottom: 1rem;
        line-height: 1.1;
    }
    
    h2 {
        font-size: 1.4rem;
        line-height: 1.2;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    p, .welcome, li {
        font-size: 0.95rem;
        line-height: 1.6;
        font-weight: 500;
    }
    
    .btn {
        display: block;
        width: 100%;
        max-width: 280px;
        margin: 0.5rem auto;
        padding: 16px 20px;
        font-size: 1rem;
        font-weight: 700;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
        margin-top: 1.5rem;
    }
    
    .footer {
        padding: 1.5rem 0.8rem;
    }
    
    .footer p {
        font-size: 0.85rem;
    }
}

/* Dispositivi molto piccoli */
@media (max-width: 320px) {
    .container,
    .glass-container,
    .about-section,
    .text-container {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    p, .welcome, li {
        font-size: 0.9rem;
    }
}

/* ===== ACCESSIBILITÀ ===== */

/* Riduzione movimento */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contrasto */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: rgba(0, 0, 0, 0.95);
        --bg-secondary: rgba(15, 23, 42, 0.95);
        --bg-tertiary: rgba(0, 0, 0, 0.98);
        --border-light: 3px solid rgba(255, 255, 255, 0.9);
        --border-medium: 4px solid rgba(255, 255, 255, 0.95);
        --border-strong: 4px solid var(--white);
        --text-shadow-strong: 2px 2px 8px rgba(0, 0, 0, 1);
        --text-shadow-medium: 1px 1px 6px rgba(0, 0, 0, 1);
    }
    
    p, li, .welcome {
        color: var(--white);
    }
}

/* Tema scuro preferito */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: rgba(15, 23, 42, 0.98);
        --bg-secondary: rgba(30, 41, 59, 0.95);
        --bg-tertiary: rgba(7, 15, 25, 0.98);
    }
}

/* Hover supportato */
@media (hover: hover) and (pointer: fine) {
    .container:hover,
    .glass-container:hover {
        transform: translateY(-5px);
    }
    
    .btn:hover {
        transform: translateY(-3px);
    }
}

/* Touch device - disabilita hover effects */
@media (hover: none) and (pointer: coarse) {
    .container:hover,
    .glass-container:hover,
    .btn:hover {
        transform: none;
    }
    
    .nav-links a:hover {
        transform: none;
    }
}