/* Custom CSS */
body {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: white;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Ensure all containers respect viewport width */
* {
    box-sizing: border-box;
}

/* Container constraints */
.max-w-6xl {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .max-w-6xl {
        max-width: 640px;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 768px) {
    .max-w-6xl {
        max-width: 768px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1024px) {
    .max-w-6xl {
        max-width: 1024px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .max-w-6xl {
        max-width: 1280px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Scroll Progress Bar */
#scrollProgress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Glass Effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced Glass Effect for Navbar */
nav.glass-effect {
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* Navbar when scrolled */
nav.glass-effect.scrolled {
    background: rgba(15, 15, 35, 0.98);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #06b6d4, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow Effect */
.glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Floating Animation */
.floating {
    animation: float 6s ease-in-out infinite;
}

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

/* Typing Effect */
.typing-effect {
    border-right: 2px solid #06b6d4;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { border-color: transparent; }
    51%, 100% { border-color: #06b6d4; }
}

/* Skill Bar Animation */
.skill-bar {
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    height: 100%;
    border-radius: 9999px;
    transition: width 2s ease-in-out;
}

/* Tech Badge */
.tech-badge {
    background: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(6, 182, 212, 0.3);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 0.125rem;
}

.tech-badge:hover {
    background: rgba(6, 182, 212, 0.3);
    transform: translateY(-2px);
}

/* Service Card */
.service-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(6, 182, 212, 0.5);
}

/* 3D Card Effect */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    height: 100%;
}

.card-3d:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

/* Experience Timeline */
.experience-timeline {
    position: relative;
    padding-left: 1rem;
}

.experience-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #3b82f6, #06b6d4);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -0.25rem;
    top: 0.5rem;
    width: 0.5rem;
    height: 0.5rem;
    background: #06b6d4;
    border-radius: 50%;
    border: 2px solid #1a1a2e;
}

.timeline-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateX(10px);
    border-color: rgba(6, 182, 212, 0.5);
}

/* Contact Info Items */
.contact-info-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.contact-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Mobile Menu Styles */
.mobile-menu-item {
    display: flex;
    align-items: center;
    color: white;
    font-size: 1.125rem;
    font-weight: 500;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 3rem;
}

.mobile-menu-item:hover {
    color: #06b6d4;
    transform: translateX(10px);
}

.mobile-menu-item:last-child {
    border-bottom: none;
}

/* Mobile Menu Animation */
#mobile-menu.active {
    transform: translateX(0);
}

/* Mobile Menu Button Styles */
#mobile-menu-btn {
    display: block !important;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    z-index: 60;
    min-width: 2.5rem;
    min-height: 2.5rem;
    position: relative;
    visibility: visible !important;
    opacity: 1 !important;
}

#mobile-menu-btn:hover {
    background: rgba(6, 182, 212, 0.1);
}

#mobile-menu-btn:focus {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* Ensure mobile menu button is visible on mobile */
@media (max-width: 1023px) {
    #mobile-menu-btn {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 60 !important;
        pointer-events: auto !important;
    }
    
    /* Hide desktop menu on mobile */
    .hidden.lg\\:flex {
        display: none !important;
    }
    
    /* Ensure navigation has proper z-index */
    nav.glass-effect {
        z-index: 50 !important;
    }
    
    /* Force mobile menu button to be visible */
    button.lg\\:hidden {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Hide mobile menu button on desktop */
@media (min-width: 1024px) {
    #mobile-menu-btn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* Mobile menu overlay styles */
#mobile-menu {
    z-index: 9999 !important;
    background: rgba(15, 15, 35, 0.99) !important;
    backdrop-filter: blur(30px);
}

/* Mobile Menu Header */
#mobile-menu .flex.justify-between {
    background: rgba(15, 15, 35, 0.98);
    border-bottom: 1px solid rgba(6, 182, 212, 0.4);
}

/* Mobile Menu Items Container */
#mobile-menu .flex-1 {
    background: rgba(15, 15, 35, 0.95);
}

/* Mobile Menu Footer */
#mobile-menu .p-6 {
    background: rgba(15, 15, 35, 0.98);
    border-top: 1px solid rgba(6, 182, 212, 0.4);
}

#mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

#mobile-menu-close:hover {
    background: rgba(6, 182, 212, 0.1);
}

/* Three.js Background - ora copre tutta la pagina */
#threejs-background {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -1 !important;
    pointer-events: none !important;
    background: transparent !important;
}

/* Mobile-First Responsive Design */
@media (max-width: 640px) {
    /* Small mobile optimizations */
    .tech-badge {
        font-size: 0.625rem;
        padding: 0.125rem 0.5rem;
    }
    
    .contact-info-item {
        flex-direction: column;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .contact-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    /* Improve touch targets */
    button, a {
        min-height: 2.75rem;
        min-width: 2.75rem;
    }
    
    /* Reduce animations on mobile for performance */
    .floating {
        animation: float 8s ease-in-out infinite;
    }
    
    .card-3d:hover {
        transform: none;
    }
    
    .service-card:hover {
        transform: translateY(-5px);
    }
    
    /* Prevent horizontal overflow on mobile */
    body, html {
        overflow-x: hidden;
        width: 100vw;
        max-width: 100vw;
    }
    
    /* Ensure all sections fit within viewport */
    section {
        width: 100%;
        max-width: 100vw;
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-x: hidden;
    }
    
    /* Fix navigation width */
    nav {
        width: 100%;
        max-width: 100vw;
        left: 0;
        right: 0;
    }
    
    /* Fix container widths */
    .max-w-6xl, .container {
        width: 100%;
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Fix grid layouts */
    .grid {
        width: 100%;
        max-width: 100%;
    }
    
    /* Fix flex containers */
    .flex {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .experience-timeline {
        padding-left: 0.5rem;
    }
    
    .timeline-item {
        padding-left: 0.75rem;
    }
    
    .timeline-item::before {
        left: -0.125rem;
        width: 0.25rem;
        height: 0.25rem;
    }
    
    /* Improve mobile navigation */
    nav {
        padding: 0.5rem 0;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Better mobile spacing */
    section {
        padding: 2rem 1rem;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Mobile-optimized buttons */
    .btn-mobile {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: 0.5rem;
    }
    
    /* Fix any potential overflow issues */
    .glass-effect {
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure text doesn't overflow */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix hero section */
    #home {
        width: 100%;
        max-width: 100vw;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Fix hero content */
    #home .text-center {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
}

@media (min-width: 769px) {
    /* Desktop enhancements */
    .tech-badge {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .experience-timeline {
        padding-left: 2rem;
    }
    
    .timeline-item {
        padding-left: 2rem;
    }
    
    .timeline-item::before {
        left: -0.5rem;
        width: 1rem;
        height: 1rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #0891b2);
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce blur effects on mobile for better performance */
    .glass-effect {
        backdrop-filter: blur(5px);
    }
    
    /* Optimize animations */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Disable hover effects on touch devices */
    @media (hover: none) {
        .card-3d:hover,
        .service-card:hover,
        .tech-badge:hover {
            transform: none;
        }
    }
}

/* Additional mobile overflow prevention */
@media (max-width: 768px) {
    /* Force all elements to respect viewport */
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* Fix any potential width issues */
    .w-full {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Fix padding issues */
    .px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Fix margin issues */
    .mx-auto {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    /* Ensure text doesn't cause overflow */
    h1, h2, h3, h4, h5, h6, p, span, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Fix any absolute positioned elements */
    .absolute, .fixed {
        max-width: 100vw;
    }
    
    /* Fix canvas background */
    #threejs-background {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
    }
}

/* Ensure no horizontal scroll on any device */
html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Fix any potential issues with large text */
@media (max-width: 640px) {
    .text-8xl {
        font-size: 3rem !important;
    }
    
    .text-6xl {
        font-size: 2.5rem !important;
    }
    
    .text-5xl {
        font-size: 2rem !important;
    }
    
    .text-4xl {
        font-size: 1.75rem !important;
    }
} 