/* Accessibility styles */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #007bff;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  font-weight: 600;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  body {
    background-color: #000;
    color: #fff;
  }

  .container {
    background-color: #000;
    border: 2px solid #fff;
  }

  .language-selector {
    border: 1px solid #fff;
    background-color: #000;
    color: #fff;
  }

  .bookmarklet {
    border: 2px solid #fff;
    background-color: #000;
    color: #fff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .spinner {
    animation: none;
  }
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background-color: #f0f2f5;
  color: #333;
  text-align: center;
}

.container {
  margin: 0.5rem;
  padding: 1.5rem 3rem;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 525px;
  position: relative;
}

h2 i {
  color: #007bff;
  margin-right: 8px;
}

p {
  font-size: 16px;
  line-height: 1.6;
}

ul {
  font-size: 14px;
}

.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.back-button:hover {
  color: #4a90e2;
  background-color: rgba(74, 144, 226, 0.1);
  transform: translateX(-2px);
}

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.title-container i {
  font-size: 1.5rem;
}

.title-container img {
  width: 46px;
  height: auto;
}

.title {
  font-size: 24px;
  font-weight: 600;
}

.language-selector {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 10;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;

  /* Remove default dropdown arrow */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.language-selector:focus-visible {
  outline: 2px solid #d5e9ffa9;
}

/* Custom language selector styles */
.custom-language-selector .fi {
  width: 20px;
  height: 15px;
  display: inline-block;
}

.language-display-button .fi {
  width: 18px;
  height: 13px;
}

.language-option:hover {
  background-color: #f5f5f5 !important;
}

.language-option .fi {
  width: 16px;
  height: 12px;
  flex-shrink: 0;
}

.bookmarklet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 30px;
  background-color: #007bff;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  font-size: 16px;
  height: 28px;
  border: 2px solid #007bff;
  transition:
    background-color 0.3s,
    color 0.3s,
    border-color 0.3s,
    transform 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
  margin: 5px;
  text-align: center;
  position: relative;
}

.bookmarklet i {
  margin-right: 8px;
  font-size: 14px;
  vertical-align: middle;
}

.bookmarklet:hover {
  background-color: #0056b3;
  border-color: #0056b3;
  cursor: grab;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.bookmarklet:active {
  transform: scale(0.96) translateY(0);
  background-color: #004494;
  border-color: #004494;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.4);
  transition:
    background-color 0.1s,
    color 0.1s,
    border-color 0.1s,
    transform 0.1s ease-out,
    box-shadow 0.1s ease-out;
}

/* Prevent bookmarklet hover/active effects when star button is being used */
.bookmarklet.star-button-hover:hover {
  background-color: #007bff;
  border-color: #007bff;
  cursor: default;
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.bookmarklet.star-button-active:active {
  transform: none;
  background-color: #007bff;
  border-color: #007bff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
  transition: none;
}

/* Star button styles */
.bookmarklet-star {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  z-index: 2;
  pointer-events: auto;
}

.bookmarklet-star:hover {
  color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.bookmarklet-star.favorite {
  color: rgba(255, 215, 0, 0.9);
}

.bookmarklet-star.favorite:hover {
  color: rgba(255, 215, 0, 1);
  transform: scale(1.1);
}

.bookmarklet-star i {
  margin-right: 0 !important;
}

.category {
  margin-top: 2.5rem;
  text-align: left;
}

.category h2 {
  font-size: 20px;
  font-weight: 500;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #007bff;
}

.category-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

.bookmarklets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.instructions {
  margin-top: 2.5rem;
  text-align: left;
  font-size: 14px;
  color: #555;
}

.footer {
  margin-top: 2.5rem;
  text-align: center;
  font-size: 12px;
  color: #999;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  color: inherit;
  text-decoration: none;
}

.donate-button-container {
  margin-bottom: 2.25rem;
}

.instruction-item {
  margin: 20px 0;
}

.instruction-item i {
  color: #007bff;
  margin-right: 6px;
}

.pp-paypal-button {
  text-align: center;
  border: none;
  border-radius: 0.25rem;
  min-width: 11.625rem;
  padding: 0 2rem;
  height: 2.625rem;
  font-weight: bold;
  background-color: #ffd140;
  color: #000000;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.25rem;
  cursor: pointer;
}

/* PayPal button styles - also applies to dynamically generated class names */
input[class^='pp-'] {
  text-align: center;
  border: none;
  border-radius: 0.25rem;
  min-width: 11.625rem;
  padding: 0 2rem;
  height: 2.625rem;
  font-weight: bold;
  background-color: #ffd140;
  color: #000000;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.25rem;
  cursor: pointer;
}

.pp-paypal-form {
  display: inline-grid;
  justify-items: center;
  align-content: start;
  gap: 0.5rem;
}

.pp-paypal-tech-section {
  font-size: 0.75rem;
}

.pp-paypal-logo {
  height: 0.875rem;
  vertical-align: middle;
}

/* Loading spinner and states */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(240, 242, 245, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Hide content during loading */
.loading-content {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.content-loaded {
  opacity: 1;
}

/* Bookmarklets loading state */
.bookmarklets-loading {
  min-height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
}

.bookmarklets-loading .spinner {
  width: 30px;
  height: 30px;
  border-width: 3px;
}

.bookmarklets-loading-text {
  margin-left: 15px;
  font-size: 14px;
  color: #666;
}
