/* Import Bootstrap Icons */
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css");

/*
 * Base structure
 */

html,
body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Margin bottom by footer height */
  margin-bottom: 60px;
  /* Pad top for fixed navbar */
  padding-top: 70px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#map-container {
  height: 500px;
  border-radius: 0.375rem;
  border: 1px solid #dee2e6;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.main-flex-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.filters-flex {
  display: flex;
  flex-direction: column;
}

.map-flex {
  display: flex;
  flex-direction: column;
}

.activities-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: stretch;
}

.activities-flex>div {
  flex: 1 1 0;
  min-width: 300px;
  max-width: 33.3333%;
  display: flex;
}

@media (max-width: 991.98px) {
  .activities-flex>div {
    max-width: 50%;
  }
}

@media (max-width: 767.98px) {
  .activities-flex>div {
    max-width: 100%;
  }
}

/* Card image height consistency */
.card-img-top,
.card-img-placeholder {
  height: 360px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.card-img-top:hover,
.card-img-placeholder:hover {
  opacity: 0.85;
}

/* Card title emphasis */
.card-title.fw-bold {
  font-size: 1.15rem;
  line-height: 1.3;
}

/* Card text truncation for location */
.card-text a {
  word-break: break-word;
}

/* Modal cover image - larger and responsive */
.modal-cover-img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
  .modal-cover-img {
    max-height: none;
    border-radius: 0;
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
  }
}

.calendar-flex {
  display: flex;
  flex-direction: column;
}

/* Responsive calendar styling */
#calendar {
  height: auto;
  min-height: 400px;
}

/* Mobile calendar adjustments */
@media (max-width: 767.98px) {
  #calendar {
    height: calc(100vh - 200px);
    /* Adjust for navbar, filters, and padding */
    min-height: 300px;
  }

  /* Ensure calendar content fits properly */
  #calendar .fc-view-harness {
    height: 100% !important;
  }

  /* Adjust calendar header for mobile */
  #calendar .fc-header-toolbar {
    flex-direction: column;
    gap: 0.5rem;
  }

  #calendar .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  /* Make calendar cells more touch-friendly */
  #calendar .fc-daygrid-day {
    min-height: 2.5rem;
  }

  #calendar .fc-daygrid-day-number {
    font-size: 0.9rem;
    padding: 0.25rem;
  }
}

/* Tablet calendar adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
  #calendar {
    height: calc(100vh - 250px);
    min-height: 350px;
  }
}

/* Stile per l'effetto flash (una sola animazione) */
.highlight-event {
  position: relative;
  overflow: hidden;
}

.highlight-event::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
  animation: flash-overlay 0.7s ease-out;
  z-index: 2;
}

@keyframes flash-overlay {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

#whatsapp-summary-content {
  white-space: pre-wrap;
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 1rem;
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  max-height: 50vh;
  overflow-y: auto;
}

/* Logo theme switching */
[data-bs-theme="light"] .light-logo {
  display: inline-block !important;
}

[data-bs-theme="light"] .dark-logo {
  display: none !important;
}

[data-bs-theme="dark"] .light-logo {
  display: none !important;
}

[data-bs-theme="dark"] .dark-logo {
  display: inline-block !important;
}

/* Auto theme handling */
[data-bs-theme="auto"] .light-logo {
  display: inline-block !important;
}

[data-bs-theme="auto"] .dark-logo {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  [data-bs-theme="auto"] .light-logo {
    display: none !important;
  }

  [data-bs-theme="auto"] .dark-logo {
    display: inline-block !important;
  }
}

/* Allinea a sinistra le voci della navbar anche su mobile */
@media (max-width: 991.98px) {
  .navbar-nav {
    align-items: flex-start !important;
  }

  .navbar-nav .nav-link,
  .navbar-nav .btn-link {
    justify-content: flex-start !important;
    text-align: left !important;
  }
}