/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00d4ff;
    --secondary-color: #0a84ff;
    --accent-color: #00ffaa;
    --dark-bg: #0a0e27;
    --card-bg: rgba(17, 25, 50, 0.75);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #b0c4de;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #00d4ff 0%, #0a84ff 100%);
    --shadow-sm: 0 2px 8px rgba(0, 212, 255, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 212, 255, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 212, 255, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url('../images/dogana_acqua.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px) brightness(0.85);
    animation: backgroundPulse 15s ease-in-out infinite;
}

.bg-animation::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top, rgba(10, 132, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, rgba(10, 14, 39, 0.05) 0%, rgba(26, 31, 58, 0.05) 100%);
}

.bg-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.08) 0%, transparent 30%),
        radial-gradient(circle at 80% 50%, rgba(10, 132, 255, 0.08) 0%, transparent 30%);
    animation: backgroundRotate 30s linear infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes backgroundRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* ===== MODERN HEADER ===== */
.header {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
}

.logo-header-single {
    width: 200px;
    height: auto;
    margin-bottom: 30px;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 40px rgba(255, 255, 255, 0.4));
    animation: logoFloat 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.logo-header-single:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 30px rgba(0, 212, 255, 0.8)) drop-shadow(0 0 50px rgba(255, 255, 255, 0.6));
}

.logos-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.logo-header {
    width: 180px;
    height: auto;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.logo-header:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.4);
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 3px;
    background: var(--gradient-2);
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

.main-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 3px;
    margin-bottom: 15px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite;
}

.title-accent {
    color: var(--primary-color);
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.8);
    -webkit-text-fill-color: var(--primary-color);
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 1px;
}

/* ===== NAVIGATION TABS ===== */
.navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: wrap;
    padding: 0 20px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    color: var(--dark-bg);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-tab::before {
    display: none;
}

.nav-tab:hover,
.nav-tab.active {
    color: var(--dark-bg);
    transform: scale(1.05);
    filter: drop-shadow(0 6px 30px rgba(0, 212, 255, 0.8)) drop-shadow(0 0 50px rgba(255, 255, 255, 0.6));
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-tab:hover .nav-icon,
.nav-tab.active .nav-icon {
    filter: none;
}

.nav-text {
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

/* ===== SECTION & CARDS GRID ===== */
.section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 40px 20px 80px;
    max-width: 1600px;
    margin: 0 auto;
}

.section a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* ===== MODERN CARDS ===== */
figure {
    position: relative;
    height: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

figure::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-2);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

figure:hover::before {
    opacity: 0.15;
}

figure:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

img.res {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: all 0.4s ease;
    position: relative;
    z-index: 0;
}

figure:hover img.res {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.title {
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    position: relative;
    z-index: 2;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 40px;
}

.logos-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.logo-footer {
    width: 120px;
    height: auto;
    background: none;
    mix-blend-mode: screen;
    filter: 
        drop-shadow(0 0 15px rgba(255, 255, 255, 1))
        drop-shadow(0 0 30px rgba(255, 255, 255, 0.8))
        drop-shadow(0 6px 30px rgba(0, 212, 255, 0.9))
        drop-shadow(0 0 50px rgba(0, 212, 255, 0.6));
    transition: all 0.3s ease;
}

.logo-footer:hover {
    transform: scale(1.05);
}

.logo-cnit {
    width: 300px;
}

/* ===== UTILITY CLASSES ===== */
.hide {
    display: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
    .section {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .header {
        padding: 40px 20px 30px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-tab {
        width: 100%;
        justify-content: center;
    }
    
    .section {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 30px 15px 60px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .nav-tab {
        padding: 14px 24px;
    }
    
    .logo-header-single {
        width: 140px;
    }
    
    .logos-header {
        gap: 20px;
    }
    
    .logo-header {
        width: 100px;
    }
    
    .logos-footer {
        gap: 15px;
    }
    
    .logo-footer {
        width: 70px;
    }
    
    .logo-cnit {
        width: 100px;
    }
}

/* ===== SCROLL ANIMATIONS ===== */
@media (prefers-reduced-motion: no-preference) {
    figure {
        animation: fadeInUp 0.6s ease-out backwards;
    }
    
    figure:nth-child(1) { animation-delay: 0.1s; }
    figure:nth-child(2) { animation-delay: 0.15s; }
    figure:nth-child(3) { animation-delay: 0.2s; }
    figure:nth-child(4) { animation-delay: 0.25s; }
    figure:nth-child(5) { animation-delay: 0.3s; }
    figure:nth-child(6) { animation-delay: 0.35s; }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 6px;
    border: 2px solid var(--dark-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}