/*
 * 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.
 */

/* Tom Select Pill Styling */
.ts-wrapper.plugin-remove_button:not(.rtl) .item {
  padding-right: 0.75rem !important;
}

.ts-wrapper.has-items .ts-control > .item {
  background: #3b82f6 !important;
  color: white !important;
  border-radius: 9999px !important;
  padding: 0.375rem 0.75rem !important;
  margin: 0.125rem !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  border: none !important;
}

.ts-wrapper.has-items .ts-control > .item .remove {
  border-left: none !important;
  background: transparent !important;
  color: white !important;
  opacity: 0.8 !important;
  padding: 0 !important;
  margin-left: 0.25rem !important;
  font-size: 1.125rem !important;
  line-height: 1 !important;
}

.ts-wrapper.has-items .ts-control > .item .remove:hover {
  opacity: 1 !important;
  background: transparent !important;
}

/* Dropzone Dark Mode */
@media (prefers-color-scheme: dark) {
  .dropzone {
    background-color: #1f2937 !important;
    border-color: #4b5563 !important;
  }

  .dropzone .dz-message {
    color: #e5e7eb !important;
  }

  .dropzone .dz-message .dz-button {
    color: #e5e7eb !important;
  }
}

/* Tom Select Dark Mode */
@media (prefers-color-scheme: dark) {
  .ts-wrapper .ts-control {
    background-color: #1f2937 !important;
    border-color: #4b5563 !important;
    color: #e5e7eb !important;
  }

  .ts-wrapper.single .ts-control {
    background-color: #1f2937 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  .ts-wrapper .ts-control input {
    color: #e5e7eb !important;
  }

  .ts-wrapper .ts-dropdown {
    background-color: #1f2937 !important;
    border-color: #4b5563 !important;
    color: #e5e7eb !important;
  }

  .ts-wrapper .ts-dropdown .option {
    color: #e5e7eb !important;
  }

  .ts-wrapper .ts-dropdown .option:hover,
  .ts-wrapper .ts-dropdown .option.active {
    background-color: #374151 !important;
    color: #e5e7eb !important;
  }

  .ts-wrapper .ts-dropdown .optgroup-header {
    background-color: #111827 !important;
    color: #9ca3af !important;
  }

  .ts-wrapper .ts-dropdown .no-results,
  .ts-wrapper .ts-dropdown .create {
    color: #9ca3af !important;
  }

  .ts-wrapper.single .ts-control::after {
    border-color: #9ca3af transparent transparent transparent !important;
  }

  .ts-wrapper.focus .ts-control {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1px #3b82f6 !important;
  }
}

/* Admin-only content visibility */
.admin-only {
  display: none;
}

.admin-layout .admin-only {
  display: block;
}

/* Flatten select elements on Safari */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Action Text Lists */
.trix-content ol,
trix-editor ol {
  list-style-type: decimal;
  margin-left: 2rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.trix-content ul,
trix-editor ul {
  list-style-type: disc;
  margin-left: 2rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.trix-content li,
trix-editor li {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  .trix-content ol,
  .trix-content ul,
  trix-editor ol,
  trix-editor ul {
    color: #e5e7eb;
  }
}

/* Trix Editor Headings */
.trix-content h1,
trix-editor h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.trix-content h2,
trix-editor h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 0.875rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.trix-content h3,
trix-editor h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.trix-content h4,
trix-editor h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

@media (prefers-color-scheme: dark) {
  .trix-content h1,
  .trix-content h2,
  .trix-content h3,
  .trix-content h4,
  trix-editor h1,
  trix-editor h2,
  trix-editor h3,
  trix-editor h4 {
    color: #e5e7eb;
  }

  /* Trix Editor Placeholder Dark Mode */
  trix-editor:empty::before {
    color: #9ca3af !important; /* gray-400 */
  }
}

/* Trix Toolbar Customization */
trix-toolbar .trix-button-group {
  border-radius: 0.375rem !important; /* Subtler radius for the group */
  overflow: hidden !important;
}

trix-toolbar .trix-button {
  width: 1.75rem !important; /* Smaller button size */
  height: 1.75rem !important;
  border-radius: 0 !important; /* Remove radius from individual buttons */
  padding: 0 !important;
}

/* Scale down the icons */
trix-toolbar .trix-button::before {
  transform: scale(0.85);
}

/* Animated lesson names - fade in/out */
@keyframes fade-in-out {
  0% {
    opacity: 0;
  }
  2% {
    opacity: 1;
  }
  8% {
    opacity: 1;
  }
  10% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.animate-scroll-0 {
  animation: fade-in-out 3s ease-in-out infinite;
}

.animate-scroll-1 {
  animation: fade-in-out 3s ease-in-out infinite;
}

.animate-scroll-2 {
  animation: fade-in-out 3s ease-in-out infinite;
}

/* Pulsing glow effect */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4), 0 0 30px rgba(147, 197, 253, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 40px rgba(147, 197, 253, 0.5);
  }
}

@keyframes pulse-glow-dark {
  0%, 100% {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 0 30px rgba(96, 165, 250, 0.25);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 0 40px rgba(96, 165, 250, 0.4);
  }
}

@keyframes pulse-glow-text {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4), 0 0 20px rgba(147, 197, 253, 0.3);
  }
  50% {
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6), 0 0 30px rgba(147, 197, 253, 0.5);
  }
}

@keyframes pulse-glow-text-dark {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3), 0 0 20px rgba(96, 165, 250, 0.25);
  }
  50% {
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5), 0 0 30px rgba(96, 165, 250, 0.4);
  }
}

.glow-pulse {
  animation: pulse-glow 2s ease-in-out infinite;
}

.glow-pulse-text {
  animation: pulse-glow-text 2s ease-in-out infinite;
}

@media (prefers-color-scheme: dark) {
  .glow-pulse {
    animation: pulse-glow-dark 2s ease-in-out infinite;
  }

  .glow-pulse-text {
    animation: pulse-glow-text-dark 2s ease-in-out infinite;
  }
}
