/* Mobile styles - only applied for screens under 768px */
@media (max-width: 767px) {
  /* Base styles */
  body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  }

  /* Mobile-specific header styles */
  header {
    background-color: transparent;
    color: inherit;
    padding: 0;
    text-align: inherit;
    height: auto;
    min-height: 60px;
    width: 100%;
    display: flex;
    align-items: center;
    background-image: url('../images/banner-logo.jpg');
    background-size: cover; /* Changed from contain to cover */
    background-position: center;
    background-repeat: no-repeat;
    position: relative; /* Added position for better control */
    overflow: hidden; /* Ensures no overflow */
  }

  /* Ensure header container takes full width */
  .header-container {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  nav {
    /* Mobile-specific nav styles */
    display: block;
    flex-direction: initial;
    align-items: initial;
  }

  nav a {
    color: inherit;
    padding: inherit;
  }

  nav a:hover {
    background-color: transparent;
  }

  .main-content {
    padding: 15px;
  }

  footer {
    text-align: center;
    padding: 10px 0;
    background-color: #333;
    color: #fff;
  }

  /* Specific mobile styles */
  .logo img {
    height: 40px;
  }
  
  .mobile-menu-toggle {
    display: block;
    z-index: 1001;
    position: relative;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
  }
  
  .hamburger, 
  .hamburger::before, 
  .hamburger::after {
    display: block;
    width: 24px;
    height: 3px;
    background-color: #333 !important;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 2px;
  }
  
  .hamburger::before,
  .hamburger::after {
    content: '';
    position: absolute;
    left: 0;
  }
  
  .hamburger::before {
    top: -8px;
  }
  
  .hamburger::after {
    bottom: -8px;
  }
  
  .main-nav .nav-list {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--white);
    flex-direction: column;
    padding: 5rem 2rem;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
  }
  
  .main-nav.active .nav-list {
    right: 0;
  }
  
  .main-nav.active .hamburger {
    background-color: transparent;
  }
  
  .main-nav.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
  }
  
  .main-nav.active .hamburger::after {
    bottom: 0;
    transform: rotate(-45deg);
  }
  
  /* Animazione hamburger quando attivo */
  .main-nav.active .mobile-menu-toggle .hamburger {
    background-color: transparent;
  }
  
  .main-nav.active .mobile-menu-toggle .hamburger::before {
    transform: rotate(45deg);
    top: 0;
  }
  
  .main-nav.active .mobile-menu-toggle .hamburger::after {
    transform: rotate(-45deg);
    bottom: 0;
  }
  
  /* Hero Section */
  .hero {
    padding: 4rem 0;
  }
  
  .hero h1 {
    font-size: 2.2rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  /* General Sections */
  .features,
  .services-preview,
  .testimonials {
    padding: 3rem 0;
  }
  
  .section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
  }
  
  /* Grids */
  .features-grid,
  .services-grid,
  .testimonials-slider,
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Feature Cards */
  .feature-card {
    padding: 1.5rem;
  }
  
  /* Service Cards */
  .service-card img {
    height: 180px;
  }
  
  /* Footer */
  footer {
    padding: 3rem 0 1.5rem;
  }
  
  .footer-column {
    text-align: center;
  }
  
  .footer-column h4::after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .social-links {
    justify-content: center;
  }

  /* Mobile styles for new About Page */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
  }
  
  .about-grid.reversed {
    direction: ltr;
  }
  
  .about-grid .about-text {
    padding: 1.5rem;
    margin-top: 0;
    order: 1;
  }
  
  .about-grid .about-image {
    order: 2;
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .about-grid.reversed .about-text {
    order: 1;
  }
  
  .about-grid.reversed .about-image {
    order: 2;
  }
  


  /* Mobile styles for Contact Page */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .contact-form-container {
    order: 2;
  }

  .contact-info-container {
    order: 1;
  }

  .contact-form .form-row {
    flex-direction: column;
    gap: 1rem;
  }

  .contact-form .form-group {
    width: 100%;
  }

  .contact-info-item {
    padding: 1rem;
  }

  .contact-map {
    height: 250px;
  }

  /* Form input fields - better touch targets */
  .contact-form input,
  .contact-form textarea,
  .contact-form select,
  .contact-form button {
    padding: 12px;
    font-size: 16px; /* Better size for mobile inputs */
  }

  /* Contact info icons alignment */
  .contact-info-item i {
    margin-right: 10px;
    font-size: 1.2rem;
  }



  /* Fixed image handling for Chi siamo page */
  .about-image {
    max-width: 100%;
    overflow: hidden;
    margin: 0 auto;
  }
  
  .about-image img {
    width: 100%;
    max-width: 500px;
    height: auto;
    object-fit: contain;
    border-radius: 5px;
    display: block;
    margin: 0 auto;
  }
  
  .about-grid .about-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
  }
  
  /* Improved image handling for all sections */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* About page images */
  .about-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 5px;
  }
  
  /* Service page images */
  .service-card img,
  .service-detail-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
  }
  
  /* Team member images */
  .team-member-image img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    border-radius: 50%;
  }
  
  /* Gallery images */
  .gallery-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
  }

  /* Hide the desktop logo on mobile devices */
  .desktop-only-logo {
    display: none;
  }

  /* Mobile styles for Service Page */
  .services-container {
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
  }
  
  .service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    width: 100%;
  }
  
  .service-card {
    width: 100%;
    margin: 0;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  .service-card h3 {
    font-size: 1.4rem;
    margin: 0.8rem 0;
  }
  
  .service-card p {
    font-size: 0.95rem;
    line-height: 1.4;
  }
  
  .service-detail-container {
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .service-detail-content {
    padding: 1.5rem;
  }
  
  .service-detail-image {
    margin-bottom: 1rem;
    width: 100%;
  }
  
  .service-features {
    padding: 0;
  }
  
  .service-feature-item {
    padding: 0.8rem;
    margin-bottom: 0.8rem;
  }
  
  /* Service page navigation */
  .service-navigation {
    padding: 1rem 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px;
    padding: 0 15px;
  }
  
  .service-navigation a {
    display: inline-block;
    padding: 0.6rem 1rem;
    margin-right: 0.5rem;
    font-size: 0.9rem;
  }

  /* Enhanced Mobile styles for Service Page */
  .services-section {
    overflow-x: hidden;
    width: 100%;
  }
  
  .services-container {
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .services-header {
    padding: 0 15px;
    box-sizing: border-box;
    width: 100%;
  }
  
  .service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
  }
  
  /* Force service cards to stay within viewport */
  .service-card {
    width: 100%;
    margin: 0;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    overflow: hidden;
  }
  
  /* Service detail page containment */
  .service-detail {
    overflow-x: hidden;
    width: 100%;
  }
  
  .service-detail-container {
    padding: 0 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  .service-detail-content {
    padding: 1.5rem;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Fix for any potentially overflowing content */
  .service-description,
  .service-features {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Ensure all content stays inside the viewport */
  .container,
  .page-container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Adding container fixes to prevent white space covering cards */
  div.container {
    margin: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 15px;
    overflow: visible;
    box-sizing: border-box;
  }
  
  /* Fix for service cards display */
  .services-preview .container {
    padding: 0 15px;
  }
  
  /* Fix for card containers to prevent cutting and overflow */
  .feature-card, 
  .service-card,
  .testimonial-card {
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    margin-left: auto;
    margin-right: auto;
  }
  
  /* Ensure service grid has proper spacing */
  .services-grid {
    margin: 0 0 2rem 0;
    width: 100%;
  }

  /* MINIMO SPAZIO AI LATI - EQUILIBRATO */
  .contact-info {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .contact-info .container {
    padding: 0 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Contact Cards Mobile - MINIMO SPAZIO AI LATI */
  .contact-details-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 2rem 0 0 0 !important;
    max-width: 100% !important;
    padding: 0 !important;
    width: 100% !important;
  }
  
  .contact-card {
    flex-direction: column;
    text-align: center;
    padding: 2rem 1rem;
    margin: 0 auto !important;
    max-width: calc(100% - 1rem) !important;
    width: calc(100% - 1rem) !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
  }
  
  .contact-icon {
    margin-bottom: 1.5rem;
    margin-right: 0;
    font-size: 3rem;
  }
  
  .contact-card-content {
    width: 100%;
    text-align: center;
  }
  
  .contact-card-content h3 {
    text-align: center;
    margin-bottom: 1rem;
  }
  
  .contact-card-content p {
    text-align: center;
    margin-bottom: 0.5rem;
  }
  
  .contact-note {
    text-align: center;
    font-style: italic;
  }
  
  .schedule {
    text-align: center;
  }
  
  .schedule p {
    text-align: center;
  }

  /* Footer logo styles */
  .footer-logo img {
    max-width: 150px;
  }
}

.fixed-logo-container {
  display: none; /* Hidden by default on desktop */
}

@media (max-width: 767px) {
  /* Show the fixed logo on mobile devices ONLY for homepage */
  body.home-page .fixed-logo-container {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* Behind content */
    pointer-events: none; /* Allow interactions with content below */
  }
  
  .fixed-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; /* Slightly larger */
    height: 90%; /* Slightly larger */
    background-image: url('../images/logo.jpg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 1; /* Increased from 0.04 to make it more visible */
  }

  main, footer, section {
    position: relative;
    z-index: 1;
  }
  
  /* Remove the original background approach for mobile */
  .logo-bg-wrapper {
    background-image: none !important;
  }
  
  .logo-bg-wrapper::before {
    display: none;
  }
  
  /* Ensure the hero text is still readable */
  .logo-bg-wrapper .hero::before {
    background-color: rgba(0, 0, 0, 0.7); /* Darker overlay for better contrast */
  }
}

/* Previeni scroll quando menu è aperto */
body.no-scroll {
  overflow: hidden;
  height: 100vh;
}

/* Rimuovi padding container per sezione contatti */
.contact-info .container {
  padding: 0;
}
