/* ==================================
   MercalliMetelAI - CSS Globale
   Brand Colors: Navy Blue #003366, Red #E31E24
   Stile moderno, pulito e accessibile
   ================================== */

:root {
  --mercalli-navy: #003366;
  --mercalli-red: #E31E24;
  --mercalli-navy-dark: #002244;
  --mercalli-navy-light: #004488;
  --mercalli-red-light: #FF4444;
  --mercalli-gray: #f5f7fa;
  --mercalli-gray-dark: #e8eaed;
}

/* Typography */
html {
  font-size: 14px;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #212529;
  background-color: var(--mercalli-gray);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Focus styles per accessibilità */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--mercalli-red);
  outline: none;
}

.form-control:focus {
  border-color: var(--mercalli-red);
  box-shadow: 0 0 0 0.25rem rgba(227, 30, 36, 0.25);
}

/* Navbar Mercalli */
.navbar-mercalli {
  background: linear-gradient(135deg, var(--mercalli-navy) 0%, var(--mercalli-navy-dark) 100%);
  border-bottom: 3px solid var(--mercalli-red);
}

.navbar-mercalli .navbar-brand {
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
}

.navbar-mercalli .navbar-brand:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.navbar-mercalli .nav-link {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.3s ease;
  border-radius: 0.375rem;
}

.navbar-mercalli .nav-link:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.text-muted-navbar {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 0.75rem;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--mercalli-navy) 0%, var(--mercalli-navy-light) 100%);
  border-bottom: 4px solid var(--mercalli-red);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.03)"/></svg>');
  opacity: 0.5;
}

.hero-section > * {
  position: relative;
  z-index: 1;
}

/* Cards */
.card {
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  border: 1px solid var(--mercalli-gray-dark);
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 0.5rem 1.5rem rgba(0, 51, 102, 0.15);
  border-color: var(--mercalli-navy);
  transform: translateY(-4px);
}

.card-img-top img {
  transition: transform 0.3s ease;
}

.card:hover .card-img-top img {
  transform: scale(1.05);
}

.card .badge {
  background-color: var(--mercalli-red) !important;
}

/* Buttons */
.btn {
  border-radius: 0.375rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  transition: all 0.2s ease-in-out;
}

.btn-primary {
  background: linear-gradient(135deg, var(--mercalli-red) 0%, #c91920 100%);
  border-color: var(--mercalli-red);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #c91920 0%, #a01418 100%);
  border-color: #c91920;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(227, 30, 36, 0.4);
}

.btn-outline-primary {
  border-color: var(--mercalli-navy);
  color: var(--mercalli-navy);
}

.btn-outline-primary:hover {
  background-color: var(--mercalli-navy);
  border-color: var(--mercalli-navy);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

/* Forms */
.form-control {
  border-radius: 0.375rem;
  border: 1px solid #ced4da;
  padding: 0.625rem 1rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.input-group-lg .form-control {
  font-size: 1.125rem;
  padding: 0.75rem 1.25rem;
}

/* Search Form */
.search-form {
  margin: 0;
}

.search-form .input-group-text {
  border-right: none;
  background-color: white;
}

.search-form .form-control {
  border-left: none;
}

.search-form .form-control:focus {
  border-left: none;
}

/* Navigation */
.navbar {
  padding: 1rem 0;
}

.navbar-brand {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  font-weight: 500;
  transition: color 0.2s ease;
}

/* Footer */
.footer {
  margin-top: auto;
}

.bg-mercalli-footer {
  background: linear-gradient(to bottom, #ffffff 0%, var(--mercalli-gray) 100%);
  border-top: 3px solid var(--mercalli-red);
}

.text-mercalli-red {
  color: var(--mercalli-red) !important;
}

.text-mercalli-navy {
  color: var(--mercalli-navy) !important;
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 0.375em 0.75em;
  border-radius: 0.375rem;
}

/* Progress bars */
.progress {
  border-radius: 0.375rem;
  overflow: hidden;
}

/* Alerts */
.alert {
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.alert-danger {
  background-color: #f8d7da;
  color: #842029;
}

.alert-success {
  background-color: #d1e7dd;
  color: #0f5132;
}

.alert-info {
  background-color: #cff4fc;
  color: #055160;
}

/* Breadcrumb */
.breadcrumb {
  background-color: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #6c757d;
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  padding: 0.75rem 0.5rem;
}

/* Carousel */
.carousel-control-prev,
.carousel-control-next {
  width: 5%;
  opacity: 0.7;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
  opacity: 1;
}

.carousel-indicators {
  margin-bottom: 0.5rem;
}

.carousel-indicators [data-bs-target] {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Pagination */
.pagination {
  margin-bottom: 0;
}

.page-link {
  border-radius: 0.375rem;
  margin: 0 0.125rem;
  transition: all 0.2s ease;
}

.page-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-item.active .page-link {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

/* List group */
.list-group-item {
  border: 1px solid rgba(0, 0, 0, 0.125);
  transition: background-color 0.2s ease;
}

.list-group-item-action:hover {
  background-color: #f8f9fa;
}

/* Utilities */
.text-truncate-2 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Responsive */
@media (max-width: 767.98px) {
  .navbar-brand {
    font-size: 1.25rem;
  }

  .display-4 {
    font-size: 2.5rem;
  }

  .card-body {
    padding: 1rem;
  }

  .hero-section {
    padding: 2rem 0 !important;
  }
}

/* Accessibility improvements */
a:focus,
button:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Loading spinner */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.125em;
}

/* Print styles */
@media print {
  .navbar,
  .footer,
  .breadcrumb,
  .btn {
    display: none !important;
  }

  body {
    background-color: white;
  }

  .card {
    border: 1px solid #dee2e6;
    box-shadow: none;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  /* Uncomment per abilitare il supporto dark mode
  body {
    background-color: #212529;
    color: #f8f9fa;
  }

  .card {
    background-color: #343a40;
    border-color: #495057;
  }

  .form-control {
    background-color: #495057;
    border-color: #6c757d;
    color: #f8f9fa;
  }
  */
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}
