/* ===================================
   Studio Rizzi - Custom Styles
   =================================== */

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #3a7ab5;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1c4d8d;
}

/* Hero Slideshow */
.slide {
  will-change: opacity;
}

.slide-dot.active {
  background-color: rgba(255, 255, 255, 1);
  transform: scale(1.2);
}

/* Floating Animation */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Mobile Menu Animation */
.hamburger-line {
  transition: all 0.3s ease;
}

.menu-open .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.menu-open .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Card Hover Effects */
.service-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Counter Animation */
.counter {
  transition: all 0.3s ease;
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #3a7ab5 0%, #1c4d8d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Button Shine Effect */
.btn-shine {
  position: relative;
  overflow: hidden;
}

.btn-shine::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-shine:hover::before {
  left: 100%;
}

/* Section Fade In Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* Navbar Scroll Effect */
.navbar-scrolled {
  background-color: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Header Logo/Name Hide on Scroll (mobile only) */
.header-brand {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (max-width: 1023px) {
  .navbar-scrolled {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
  
  .navbar-scrolled .header-brand {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
  }
  
  .navbar-scrolled .hamburger-container {
    margin-left: auto;
  }
  
  /* Hamburger button styling when navbar is scrolled */
  .navbar-scrolled .hamburger-container button {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
  }
}

/* Mobile Menu Fullscreen Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0F2854 0%, #1C4D8D 100%);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow-y: auto;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-overlay .menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-overlay .menu-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-menu-overlay .menu-logo img {
  height: 40px;
  width: auto;
}

.mobile-menu-overlay .menu-logo span {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.mobile-menu-overlay .close-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.mobile-menu-overlay .close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-overlay .menu-links {
  padding: 2rem 1.5rem;
}

.mobile-menu-overlay .menu-links a {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: color 0.3s ease, padding-left 0.3s ease;
}

.mobile-menu-overlay .menu-links a:hover {
  color: #D97706;
  padding-left: 0.5rem;
}

.mobile-menu-overlay .menu-links a:last-child {
  border-bottom: none;
}

.mobile-menu-overlay .menu-cta {
  padding: 1.5rem;
  margin-top: auto;
}

.mobile-menu-overlay .menu-cta a {
  display: block;
  text-align: center;
  padding: 1rem 2rem;
  background: #D97706;
  color: white;
  font-weight: 600;
  border-radius: 9999px;
  transition: background 0.3s ease;
}

.mobile-menu-overlay .menu-cta a:hover {
  background: #b45309;
}

/* Body scroll lock when menu is open */
body.menu-open {
  overflow: hidden;
}

/* Image Hover Zoom */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-zoom:hover img {
  transform: scale(1.1);
}

/* Link Underline Animation */
.link-underline {
  position: relative;
}

.link-underline::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #d97706;
  transition: width 0.3s ease;
}

.link-underline:hover::after {
  width: 100%;
}

/* Form Styles */
.form-input {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.form-input:focus {
  border-color: #3a7ab5;
  box-shadow: 0 0 0 3px rgba(58, 122, 181, 0.1);
}

/* Service Icon Pulse */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pulse-hover:hover {
  animation: pulse 1s ease-in-out infinite;
}

/* Loading Spinner */
.spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #d97706;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Glassmorphism Card */
.glass-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Service Page Accordion */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-content.open {
  max-height: 1000px;
}

/* Map Container */
.map-container {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
}

.map-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid #bde8f5;
  border-radius: 1rem;
  pointer-events: none;
  z-index: 10;
}

/* ===================================
   SERVICES TAB NAVIGATION
   =================================== */

/* Tab Navigation Container */
.tab-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
  margin-bottom: 2rem;
}

/* Tab Buttons */
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1C4D8D;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  border-color: #3A7AB5;
  color: #3A7AB5;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(58, 122, 181, 0.15);
}

.tab-btn.active {
  background: linear-gradient(135deg, #0F2854 0%, #1C4D8D 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(15, 40, 84, 0.3);
}

.tab-btn .tab-icon {
  font-size: 1.125rem;
  transition: color 0.3s ease;
}

/* Custom Icon Colors */
.tab-btn[data-category="dichiarazioni"] .tab-icon { color: #0F2854; }
.tab-btn[data-category="contabilita"] .tab-icon { color: #D97706; }
.tab-btn[data-category="consulenza"] .tab-icon { color: #3A7AB5; }
.tab-btn[data-category="caf"] .tab-icon { color: #D97706; }
.tab-btn[data-category="amministrativi"] .tab-icon { color: #0F766E; }

/* Active state forces white icon */
.tab-btn.active .tab-icon { color: white; }

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Services Grid within Tab */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Base Service Item with left border */
.service-item {
  background: white;
  padding: 1.5rem;
  padding-left: 1.75rem;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #e5e7eb;
  transition: all 0.3s ease;
}

.service-item:hover {
  border-color: #3A7AB5;
  border-left-color: inherit;
  box-shadow: 0 10px 30px rgba(15, 40, 84, 0.1);
  transform: translateY(-4px);
}

/* Category-specific left border colors */
[data-category="dichiarazioni"] .service-item {
  border-left-color: #0F2854;
}

[data-category="dichiarazioni"] .service-item:hover {
  border-left-color: #0F2854;
}

[data-category="contabilita"] .service-item {
  border-left-color: #D97706;
}

[data-category="contabilita"] .service-item:hover {
  border-left-color: #D97706;
}

[data-category="amministrativi"] .service-item {
  border-left-color: #0F766E;
}

[data-category="amministrativi"] .service-item:hover {
  border-left-color: #0F766E;
}

[data-category="consulenza"] .service-item {
  border-left-color: #3A7AB5;
}

[data-category="consulenza"] .service-item:hover {
  border-left-color: #3A7AB5;
}

[data-category="caf"] .service-item {
  border-left-color: #D97706;
}

[data-category="caf"] .service-item:hover {
  border-left-color: #D97706;
}

/* Responsive Tab Navigation */
@media (max-width: 1024px) {
  .tab-navigation {
    gap: 0.5rem;
  }
  
  .tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .tab-navigation {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .tab-btn {
    justify-content: center;
    align-items: center;
    padding: 0.6rem 0.25rem;
    font-size: 0.8125rem;
    border-radius: 9999px;
    white-space: nowrap;
    gap: 0.35rem; /* Reduced gap for mobile */
  }
  
  .tab-btn .tab-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0; /* Remove redundant margin */
  }
  
  .services-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .section-title {
    font-size: 2rem;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    text-decoration: underline;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid #3a7ab5;
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
