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


/* Custom ActionText styling */
.trix-editor {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  min-height: 120px;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: auto;
  max-height: 400px;
}

/* Ensure images in Trix editor are responsive but viewable */
.trix-editor img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem 0;
  cursor: pointer;
}

/* Ensure tables in editor are responsive */
.trix-editor table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}

.trix-editor:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.trix-button-group {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

.trix-button {
  border: none;
  padding: 0.5rem;
  background: white;
  color: #6b7280;
  font-size: 0.875rem;
}

.trix-button:hover {
  background: #f9fafb;
  color: #374151;
}

.trix-button.trix-active {
  background: #e5e7eb;
  color: #1f2937;
}

/* Better scrollbar styling for Trix editor */
.trix-editor::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.trix-editor::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.trix-editor::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.trix-editor::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Comment editing styles */
.comment-edit-form .trix-editor {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  min-height: 80px;
}

.comment-edit-form .trix-button-group {
  margin-bottom: 0.25rem;
}

.comment-edit-form .trix-button {
  padding: 0.375rem;
  font-size: 0.75rem;
}

/* Rich text content styling for better scrolling */
.prose {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Ensure images in rich text don't overflow */
.prose img {
  max-width: 100%;
  height: auto;
}

/* Better table styling in rich text */
.prose table {
  width: 100%;
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}

/* Scrollable content styling */
.prose.max-h-96,
.prose.max-h-64 {
  position: relative;
}

.prose.max-h-96::-webkit-scrollbar,
.prose.max-h-64::-webkit-scrollbar {
  width: 6px;
}

.prose.max-h-96::-webkit-scrollbar-track,
.prose.max-h-64::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.prose.max-h-96::-webkit-scrollbar-thumb,
.prose.max-h-64::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.prose.max-h-96::-webkit-scrollbar-thumb:hover,
.prose.max-h-64::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Link styling */
.prose a,
.text-gray-600 a,
.text-gray-700 a {
  color: #2563eb;
  text-decoration: underline;
  transition: all 0.2s ease-in-out;
}

.prose a:hover,
.text-gray-600 a:hover,
.text-gray-700 a:hover {
  color: #1d4ed8;
  text-decoration: none;
}

/* Ensure links are properly styled in truncated content */
.line-clamp-2 a,
.line-clamp-3 a {
  color: #2563eb;
  text-decoration: underline;
  transition: all 0.2s ease-in-out;
}

.line-clamp-2 a:hover,
.line-clamp-3 a:hover {
  color: #1d4ed8;
  text-decoration: none;
}

/* Custom styles for image selection UI */
.new-image {
  animation: slideInUp 0.3s ease-out;
}

.new-image .aspect-square {
  position: relative;
  overflow: hidden;
}

.new-image .aspect-square::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
  pointer-events: none;
  z-index: 1;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide spinner buttons on number inputs */
.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinner {
  -moz-appearance: textfield;
}
