/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Tailwind CSS is built and served from builds/tailwind.css */

/* Custom Dialog Styles */
dialog {
  border: none;
  border-radius: 0.5rem;
  margin: auto;
  max-width: 90vw;
  max-height: 90vh;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

/* Dark mode support for dialog backdrop */
@media (prefers-color-scheme: dark) {
  dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.7);
  }
}

/* InstantSearch Component Styles */

/* Search box styling for refinement list filters */
.ais-RefinementList-searchBox {
  margin-bottom: 1rem;
}

.ais-SearchBox-form {
  position: relative;
}

.ais-SearchBox-input {
  display: block;
  width: 100%;
  padding: 0.625rem 2.25rem 0.625rem 2.25rem;
  border: 1px solid #D1D5DB;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
  background-color: #FFFFFF;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ais-SearchBox-input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.ais-SearchBox-input::placeholder {
  color: #9CA3AF;
}

.ais-SearchBox-submit {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  padding-left: 0.75rem;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.ais-SearchBox-reset {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  padding-right: 0.75rem;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.ais-SearchBox-reset:hover {
  color: #4B5563;
}

/* Custom checkbox styling */
.custom-checkbox {
  display: flex;
  height: 1.5rem;
  flex-shrink: 0;
  align-items: center;
}

.ais-ToggleRefinement-checkbox,
.ais-RefinementList-checkbox {
  position: relative;
  display: grid;
  width: 1rem;
  height: 1rem;
  grid-template-columns: 1fr;
  appearance: none;
  border-radius: 0.25rem;
  border: 1px solid #D1D5DB;
  background-color: white;
}

.ais-ToggleRefinement-checkbox:checked,
.ais-RefinementList-checkbox:checked {
  border-color: #4F46E5;
  background-color: #4F46E5;
}

.ais-ToggleRefinement-checkbox:focus-visible,
.ais-RefinementList-checkbox:focus-visible {
  outline: 2px solid #4F46E5;
  outline-offset: 2px;
}

/* Custom checkmark */
.ais-ToggleRefinement-checkbox::after,
.ais-RefinementList-checkbox::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.875rem;
  height: 0.875rem;
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M3 8L6 11L11 3.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transition: opacity 0.1s ease-in-out;
}

.ais-ToggleRefinement-checkbox:checked::after,
.ais-RefinementList-checkbox:checked::after {
  opacity: 1;
}

/* Wrapper adjustments */
.ais-ToggleRefinement-label,
.ais-RefinementList-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.ais-RefinementList-labelText {
  flex: 1;
}

/* Domain Search Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

/* Logo Scroll Animation */
@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Button System - Consistent button styles across the application */

/* Base button styles */
.btn-base,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-info,
.btn-ghost,
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  transition-property: color, background-color, border-color;
  transition-duration: 150ms;
}

.btn-base,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-info,
.btn-ghost {
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.btn-base:focus,
.btn-primary:focus,
.btn-secondary:focus,
.btn-danger:focus,
.btn-success:focus,
.btn-info:focus,
.btn-ghost:focus,
.btn-link:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary-600);
  color: rgb(255 255 255);
}

.btn-primary:hover {
  background-color: var(--color-primary-500);
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    background-color: var(--color-primary-500);
  }

  .btn-primary:hover {
    background-color: var(--color-primary-400);
  }
}

/* Secondary Button */
.btn-secondary {
  border-width: 1px;
  border-style: solid;
  border-color: rgb(228 228 231);
  background-color: rgb(255 255 255);
  color: rgb(63 63 70);
}

.btn-secondary:hover {
  background-color: rgb(250 250 250);
}

@media (prefers-color-scheme: dark) {
  .btn-secondary {
    border-color: rgb(63 63 70);
    background-color: rgb(39 39 42);
    color: rgb(212 212 216);
  }

  .btn-secondary:hover {
    background-color: rgba(39, 39, 42, 0.5);
  }
}

/* Danger Button */
.btn-danger {
  border-width: 1px;
  border-style: solid;
  border-color: rgb(254 202 202);
  background-color: rgb(254 242 242);
  color: rgb(185 28 28);
}

.btn-danger:hover {
  background-color: rgb(254 226 226);
}

@media (prefers-color-scheme: dark) {
  .btn-danger {
    border-color: rgb(153 27 27);
    background-color: rgba(127, 29, 29, 0.2);
    color: rgb(248 113 113);
  }

  .btn-danger:hover {
    background-color: rgba(127, 29, 29, 0.3);
  }
}

/* Success Button */
.btn-success {
  background-color: var(--color-envy-500);
  color: rgb(255 255 255);
}

.btn-success:hover {
  background-color: var(--color-envy-400);
}

@media (prefers-color-scheme: dark) {
  .btn-success {
    background-color: var(--color-envy-400);
  }

  .btn-success:hover {
    background-color: var(--color-envy-300);
  }
}

/* Info Button */
.btn-info {
  border-width: 1px;
  border-style: solid;
  border-color: rgb(191 219 254);
  background-color: rgb(239 246 255);
  color: rgb(29 78 216);
}

.btn-info:hover {
  background-color: rgb(219 234 254);
}

@media (prefers-color-scheme: dark) {
  .btn-info {
    border-color: rgb(30 64 175);
    background-color: rgba(30, 58, 138, 0.2);
    color: rgb(96 165 250);
  }

  .btn-info:hover {
    background-color: rgba(30, 58, 138, 0.3);
  }
}

/* Ghost Button */
.btn-ghost {
  background-color: rgb(243 244 246);
  color: rgb(55 65 81);
}

.btn-ghost:hover {
  background-color: rgb(249 250 251);
}

@media (prefers-color-scheme: dark) {
  .btn-ghost {
    background-color: rgb(31 41 55);
    color: rgb(209 213 219);
  }

  .btn-ghost:hover {
    background-color: rgb(55 65 81);
  }
}

/* Link Button */
.btn-link {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--color-primary-600);
}

.btn-link:hover {
  color: var(--color-primary-500);
}

@media (prefers-color-scheme: dark) {
  .btn-link {
    color: var(--color-primary-400);
  }

  .btn-link:hover {
    color: var(--color-primary-300);
  }
}

/* Size variants */
.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.btn-lg {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5rem;
}

/* Full width button */
.btn-block {
  width: 100%;
}
