/* Prevent horizontal overflow */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Ensure all containers respect viewport width */
* {
  box-sizing: border-box;
}

/* Improve horizontal scroll affordance for mobile filter bars */
@media (max-width: 640px) {
  .scrollbar-thin {
    scrollbar-width: thin;
  }
}

/* Sidebar animation */
.sidebar-transition {
  transition: transform 0.3s ease-in-out;
}

/* Dropdown contrast fix */
select option {
  background-color: white;
  color: #111827;
}
.dark select option {
  background-color: #374151;
  color: #f9fafb;
}

/* Video modal styles */
.video-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.video-modal.active {
  display: flex;
}
.video-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}
.video-modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  z-index: 10000;
}
.video-modal-body {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}
.video-modal-body iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.video-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 4px;
  z-index: 10001;
}
.video-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Dropdown contrast fix - ensure options are readable */
select {
  color: #111827;
}
.dark select {
  color: #f9fafb;
}
select option {
  background-color: white !important;
  color: #111827 !important;
  padding: 0.5rem;
}
.dark select option {
  background-color: #374151 !important;
  color: #f9fafb !important;
}

/* HTMX Loading States */
.htmx-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.htmx-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-top-color: rgb(59, 130, 246);
  border-radius: 50%;
  animation: htmx-spin 0.8s linear infinite;
  z-index: 1000;
}

@keyframes htmx-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* HTMX Indicator */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* HTMX Swapping */
.htmx-swapping {
  opacity: 0;
  transition: opacity 100ms ease-out;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 100ms ease-in;
}
