/* Reset base */
* { 
  margin:0; 
  padding:0; 
  box-sizing:border-box; 
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* font-display swap per Font Awesome (evita testo invisibile durante caricamento) */
@font-face {
  font-family: 'Font Awesome 6 Free';
  font-display: swap;
}
@font-face {
  font-family: 'Font Awesome 6 Brands';
  font-display: swap;
}

:root {
  --primary-color: #4361ee;
  --primary-light: #4895ef;
  --secondary-color: #3f37c9;
  --accent-color: #f72585;
  --light-bg: #f8f9fa;
  --dark-bg: #121212;
  --card-light: #ffffff;
  --card-dark: #1e1e1e;
  --text-light: #333333;
  --text-dark: #f5f5f5;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 10px 30px rgba(0,0,0,0.15);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

body { 
  background: var(--light-bg); 
  color: var(--text-light);
  transition: background 0.4s ease, color 0.4s ease;
  line-height: 1.6;
}

a { 
  text-decoration:none; 
  color: inherit; 
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navbar */
.navbar { 
  display:flex; 
  justify-content: space-between; 
  align-items:center; 
  padding:1rem 2rem; 
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo { 
  font-weight:bold; 
  font-size:1.5rem; 
  display:flex; 
  align-items:center; 
  gap:0.5rem; 
}

/* Toggle tema — pill moderna */
.theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: var(--transition);
  white-space: nowrap;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}

.theme-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.theme-pill-label {
  line-height: 1;
}

/* Hero */
.hero { 
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 4rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="%23ffffff" opacity="0.1"><polygon points="0,0 1000,50 1000,100 0,100"/></svg>') no-repeat bottom;
  background-size: cover;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

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

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

.btn-hero {
  background: white;
  color: var(--primary-color);
  padding: 12px 32px;
  font-size: 1.1rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  margin: 1rem 0 2rem;
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn-hero:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255,255,255,0.2);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(5px);
}

/* Search and Filter */
.search-container {
  max-width: 800px;
  margin: 0 auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  pointer-events: none;
}

.search-bar {
  width: 100%;
  padding: 1rem 1.5rem 1rem 3.5rem; /* Aggiunto padding a sinistra per l'icona */
  font-size: 1.1rem;
  border-radius: 50px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.search-bar:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.suggestions-box {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-light);
  border-radius: 16px;
  box-shadow: var(--shadow-hover);
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  border: 1px solid rgba(0,0,0,0.08);
}

.suggestion-item {
  display: block;
  padding: 0.8rem 1.5rem;
  color: var(--text-light);
  text-decoration: none;
  transition: background 0.2s;
}

.suggestion-item:hover {
  background: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
}

.filter-container {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: #e9ecef;
  color: #495057;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}
.filter-btn:hover {
  background: #dee2e6;
}
.filter-btn.active {
  background: var(--primary-color);
  color: white;
}

/* Card container */
.card-container {
  padding: 4rem 1.5rem;
}

.section-title {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.section-subtitle {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 3rem;
  color: #666;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card-light);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
  width: 70px;
  border-radius: 50%;
  background: rgba(67, 97, 238, 0.1);
  transition: transform 0.3s ease;
}

.card:hover .card-icon {
  transform: translateY(-5px) rotate(-10deg);
}

.card-content {
  flex: 1;
}

.card h3 {
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
}

.card p {
  margin-bottom: 1rem;
  color: #666;
}

.feature-list {
  list-style: none;
  margin-top: 1rem;
}

.feature-list li {
  padding: 0.3rem 0;
  position: relative;
  padding-left: 1.5rem;
  color: #555;
}

.feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

.card-badge {
  background: var(--primary-light);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  align-self: flex-start;
  margin-top: 1rem;
}

/* Features section */
.features {
  padding: 4rem 1.5rem;
  background: rgba(67, 97, 238, 0.05);
}

.features h2 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 3rem;
  color: var(--primary-color);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.feature {
  text-align: center;
  padding: 2rem 1rem;
}

.feature i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  display: inline-block;
}

.feature h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.feature p {
  color: #666;
}

/* Footer */
footer {
  background: #222;
  color: white;
  padding: 3rem 1.5rem 1rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto 2rem;
}

.footer-section h3 {
  margin-bottom: 1rem;
  color: var(--primary-light);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #ccc;
  transition: var(--transition);
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid #444;
  max-width: 1200px;
  margin: 0 auto;
}

/* Tema scuro */
html.dark body {
  background: var(--dark-bg);
  color: var(--text-dark);
}

html.dark .card { 
  background: var(--card-dark);
  color: var(--text-dark);
}

html.dark .card p,
html.dark .feature p {
  color: #ccc;
}

html.dark .feature-list li {
  color: #ccc;
}

html.dark footer {
  background: #1e1e1e;
}
html.dark .navbar {
  background: var(--card-dark);
}

html.dark .features {
  background: rgba(30, 30, 30, 0.8);
}

html.dark .section-subtitle {
  color: #aaa;
}

html.dark .search-bar {
  background: var(--card-dark);
  border-color: rgba(255,255,255,0.1);
  color: var(--text-dark);
}
html.dark .filter-btn {
  background: #343a40;
  color: #f8f9fa;
}
html.dark .filter-btn:hover { background: #495057; }
html.dark .filter-btn.active { background: var(--primary-light); color: white; }
html.dark .search-icon { color: #666; }
html.dark .suggestions-box {
  background: var(--card-dark);
  border-color: rgba(255,255,255,0.1);
}
html.dark .suggestion-item { color: var(--text-dark); }
html.dark .suggestion-item:hover { background: rgba(72, 149, 239, 0.15); }

html.dark .hero,
html.dark .tool-hero,
html.dark .page-hero {
  background: var(--card-dark);
}

/* Animazioni */
@keyframes fadeIn { 
  from {opacity:0;} 
  to {opacity:1;} 
}

@keyframes fadeInUp { 
  from {opacity:0; transform:translateY(20px);} 
  to {opacity:1; transform:translateY(0);} 
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

/* Transizioni globali per cambio tema */
.navbar, .hero, .tool-hero, .page-hero, .card, .tool-card, .features, footer,
.btn, textarea, input, select {
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.2s ease;
}

/* Scroll-to-top button */
#scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary-color, #4361ee);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  transform: translateY(12px) scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s, box-shadow 0.3s ease;
  pointer-events: none;
}
#scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#scroll-top-btn:hover {
  background: var(--secondary-color, #3f37c9);
  transform: translateY(-2px) scale(1.05);
}
#scroll-top-btn:active {
  transform: scale(0.95);
}
@media (max-width: 600px) {
  #scroll-top-btn {
    bottom: 20px;
    right: 16px;
    width: 42px;
    height: 42px;
  }
}


/* Breadcrumb navigation */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  opacity: 0.9;
}
.breadcrumb-nav a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.breadcrumb-nav a:hover { opacity: 0.85; }
.breadcrumb-sep { opacity: 0.6; }

/* CookieYes banner — mobile safe area */
.cky-consent-container,
.cky-modal {
  max-width: 100vw !important;
}
@media (max-width: 600px) {
  .cky-consent-container {
    padding-bottom: env(safe-area-inset-bottom, 0) !important;
  }
  .cky-notice-btn-wrapper {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
  .hero p { font-size: 1.1rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .navbar { padding: 1rem; }
}
