/* Prevent layout shift when scrollbar appears */
html {
  overflow-y: scroll;
}

/* Toggle switch — Tailwind can't do this cleanly inline */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #404040;
  border-radius: 999px;
  transition: background-color 0.15s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #a3a3a3;
  border-radius: 50%;
  transition: transform 0.15s, background-color 0.15s;
}
.toggle-switch input:checked + .toggle-slider {
  background-color: #a3a3a3;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background-color: #171717;
}

/* Language dropdown items */
#lang-dropdown li {
  padding: 8px 12px;
  font-size: 0.875rem;
  cursor: pointer;
  color: #a3a3a3;
}
#lang-dropdown li:hover,
#lang-dropdown li.active {
  background-color: #262626;
  color: #f5f5f5;
}

/* Tag pills (languages + uploaders) */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #d4d4d4;
  color: #171717;
  font-size: 0.8125rem;
  padding: 3px 8px 3px 10px;
  border-radius: 6px;
  line-height: 1.5;
  white-space: nowrap;
}
.tag-pill button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
  margin-left: 2px;
}
.tag-pill button svg {
  width: 12px;
  height: 12px;
  stroke: #171717;
  stroke-width: 2.5;
  stroke-linecap: round;
}
.tag-pill button:hover svg {
  stroke: #171717;
}
.tag-pill button:hover {
  color: #171717;
  background-color: #b5b5b5;
}

/* Scrollbar for dropdown */
#lang-dropdown::-webkit-scrollbar {
  width: 6px;
}
#lang-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
#lang-dropdown::-webkit-scrollbar-thumb {
  background: #404040;
  border-radius: 3px;
}

/* Provider body expand/collapse transition */
.provider-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease, border-top-width 0s 0.25s;
}
.provider-body.provider-body-open {
  max-height: 200px;
  overflow: visible;
  opacity: 1;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
  border-top-width: 1px !important;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease, border-top-width 0s, overflow 0s 0.25s;
}

/* Exclude AI row expand/collapse */
#exclude-ai-row {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
#exclude-ai-row.exclude-ai-open {
  max-height: 120px;
  opacity: 1;
}

/* Disabled state for action buttons */
#btn-install:disabled,
#btn-copy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#btn-install:disabled:hover {
  background-color: #d4d4d4;
}
#btn-copy:disabled:hover {
  background-color: #171717;
}

/* Entrance animation */
.fade-in {
  opacity: 0;
  animation: fadeInUp 0.3s ease-out forwards;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* "How does this work?" disclosure */
#match-info-detail {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition: grid-template-rows 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              opacity 0.18s cubic-bezier(0.25, 0.1, 0.25, 1),
              margin-top 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}
#match-info-detail > .detail-inner {
  overflow: hidden;
}
#match-info-detail.detail-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0.5rem;
}
#match-info-arrow {
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Loading spinner for action buttons */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
