.service-card {
  transition: all 0.3s ease;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px -8px rgba(0, 102, 204, 0.2) !important;
}

.service-card .card-body {
  padding: 1.25rem 1rem;
}

.service-card .icon-wrapper {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #cc0700ff 0%, #cc0700ff 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.service-card .icon-wrapper .icon {
  width: 20px;
  height: 20px;
  fill: white;
}

.service-card .category-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: rgba(0, 102, 204, 0.08);
  color: #cc0700ff;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.service-card h3 {
  font-size: 1rem; /* Ridotto da 1.25rem */
  font-weight: 600;
  margin-bottom: 0.5rem; /* Ridotto da 0.75rem */
  color: #17324d;
  line-height: 1.4;
}

.service-card .card-text {
  color: #5b6f8c;
  font-size: 0.8rem; /* Ridotto da 0.9rem */
  line-height: 1.4; /* Leggermente ridotto */
  margin-bottom: 1rem; /* Ridotto da 1.5rem */
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limita a 2 righe */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-card .service-link {
  display: inline-flex;
  align-items: center;
  color: #0066cc;
  font-weight: 500;
  text-decoration: none;
  gap: 0.35rem; /* Ridotto da 0.5rem */
  transition: gap 0.3s ease;
  font-size: 0.85rem; /* Testo più piccolo */
}

.service-card .service-link:hover {
  gap: 0.5rem;
  color: #004080;
}

.service-card .service-link .icon {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
}

.service-card .service-link:hover .icon {
  transform: translateX(4px);
}

/* Hero section migliorata */
.hero-wrapper {
  position: relative;
  min-height: 400px;
  border-radius: 0 0 32px 32px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  display: flex;
  align-items: center;
}

.hero-content {
  max-width: 600px;
  padding: 3rem;
  color: white;
}

.hero-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-content p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 2rem;
}

.hero-stats-item {
  display: flex;
  flex-direction: column;
}

.hero-stats-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffc107;
}

.hero-stats-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Sezione titolo */
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #17324d;
  margin-bottom: 0.5rem;
}

.section-title p {
  color: #5b6f8c;
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.section-title .title-decoration {
  width: 60px;
  height: 4px;
  background: #0066cc;
  border-radius: 2px;
  margin: 1rem auto;
}

/* Grid layout */
/* Layout per griglie compatte */
.services-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(240px, 1fr)
  ); /* Colonne più strette */
  gap: 1rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(180px, 1fr)
  ); /* Colonne molto strette */
  gap: 0.75rem;
}

/* Utility per griglie flessibili */
@media (max-width: 768px) {
  .services-grid-sm,
  .services-grid-xs {
    grid-template-columns: repeat(2, 1fr); /* 2 colonne su mobile */
  }
}

@media (max-width: 480px) {
  .services-grid-sm,
  .services-grid-xs {
    grid-template-columns: 1fr; /* 1 colonna su mobile piccolo */
  }
}

/* Cookiebar moderna */
.cookiebar-modern {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1200px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 102, 204, 0.1);
  z-index: 1050;
  padding: 1.25rem;
}

.cookiebar-modern .cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.cookiebar-modern p {
  margin: 0;
  color: #17324d;
  flex: 1;
}

.cookiebar-modern .cookie-buttons {
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .hero-content {
    padding: 2rem;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .cookiebar-modern {
    bottom: 1rem;
    width: 95%;
  }

  .cookiebar-modern .cookie-content {
    flex-direction: column;
    text-align: center;
  }
}

.markdown-body {
  font-size: 1rem;
  line-height: 1.6;
  color: #33485c;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: #17324d;
  scroll-margin-top: 2rem;
}

.markdown-body h1 {
  font-size: 2rem;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 0.5rem;
}

.markdown-body h2 {
  font-size: 1.5rem;
}

.markdown-body h3 {
  font-size: 1.25rem;
}

.markdown-body p {
  margin-bottom: 1.2rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.8rem;
  margin-bottom: 1.2rem;
}

.markdown-body li {
  margin-bottom: 0.3rem;
}

.markdown-body a {
  color: #0066cc;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.markdown-body a:hover {
  color: #004080;
  text-decoration: none;
}

.markdown-body table {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
}

.markdown-body th {
  background-color: #f8f9fa;
  font-weight: 600;
}

.markdown-body blockquote {
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid #0066cc;
  background-color: #f8f9fa;
  font-style: italic;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
}

.markdown-body pre {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  overflow-x: auto;
}

.markdown-body code {
  padding: 0.2rem 0.4rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Miglioramenti accessibilità */
.btn:focus-visible,
a:focus-visible {
  outline: 3px solid #ff8c00;
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0066cc;
  color: white;
  padding: 8px;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

@media print {
  .btn,
  .cookiebar,
  footer,
  header {
    display: none !important;
  }
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  text-align: left;
}

.markdown-body th {
  background-color: #f8f9fa;
  font-weight: 600;
}

/* Mobile-first impilato */
@media (max-width: 768px) {
  .markdown-body table,
  .markdown-body thead,
  .markdown-body tbody,
  .markdown-body th,
  .markdown-body td,
  .markdown-body tr {
    display: block;
    width: 100%;
  }

  .markdown-body thead {
    display: none; /* Nasconde le intestazioni originali */
  }

  .markdown-body tr {
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    background: #fdfdfd;
  }

  .markdown-body td {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border: none;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    padding-left: 50%;
    text-align: left;
  }

  .markdown-body td:last-child {
    border-bottom: none;
  }

  .markdown-body td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    position: absolute;
    left: 0;
  }
}
