/*
 * 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;
}

/* Dark mode theme */
html.dark-mode body {
  background-color: #111827;
  color: #e5e7eb;
}

html.dark-mode .bg-white {
  background-color: #1f2937 !important;
}

html.dark-mode .bg-gray-50 {
  background-color: #111827 !important;
}

html.dark-mode .bg-gray-100 {
  background-color: #374151 !important;
}

html.dark-mode .text-gray-900 {
  color: #f3f4f6 !important;
}

html.dark-mode .text-gray-700,
html.dark-mode .text-gray-600 {
  color: #d1d5db !important;
}

html.dark-mode .text-gray-500,
html.dark-mode .text-gray-400 {
  color: #9ca3af !important;
}

html.dark-mode .border-gray-100,
html.dark-mode .border-gray-200 {
  border-color: #4b5563 !important;
}

html.dark-mode .border-gray-300 {
  border-color: #6b7280 !important;
}

html.dark-mode .bg-green-50 {
  background-color: #052e16 !important;
}

html.dark-mode .bg-green-100 {
  background-color: #14532d !important;
}

html.dark-mode .border-green-200 {
  border-color: #166534 !important;
}

html.dark-mode .bg-red-50 {
  background-color: #450a0a !important;
}

html.dark-mode .bg-red-100 {
  background-color: #7f1d1d !important;
}

html.dark-mode .border-red-200 {
  border-color: #991b1b !important;
}

html.dark-mode .bg-blue-50 {
  background-color: #172554 !important;
}

html.dark-mode .bg-blue-100 {
  background-color: #1e3a8a !important;
}

html.dark-mode .border-blue-200 {
  border-color: #1d4ed8 !important;
}

html.dark-mode .border-blue-300 {
  border-color: #2563eb !important;
}

html.dark-mode .bg-yellow-50 {
  background-color: #422006 !important;
}

html.dark-mode .bg-yellow-100 {
  background-color: #713f12 !important;
}

html.dark-mode .border-yellow-200 {
  border-color: #a16207 !important;
}

html.dark-mode .text-green-800,
html.dark-mode .text-green-700 {
  color: #bbf7d0 !important;
}

html.dark-mode .text-green-600 {
  color: #4ade80 !important;
}

html.dark-mode .text-red-800,
html.dark-mode .text-red-700 {
  color: #fecaca !important;
}

html.dark-mode .text-red-600 {
  color: #f87171 !important;
}

html.dark-mode .text-blue-800,
html.dark-mode .text-blue-700 {
  color: #bfdbfe !important;
}

html.dark-mode .text-blue-600 {
  color: #60a5fa !important;
}

html.dark-mode .text-yellow-800,
html.dark-mode .text-yellow-700 {
  color: #fef08a !important;
}

html.dark-mode .text-yellow-600 {
  color: #facc15 !important;
}

html.dark-mode .text-gray-800 {
  color: #e5e7eb !important;
}

html.dark-mode .text-orange-600 {
  color: #fb923c !important;
}

html.dark-mode .hover\:bg-green-200:hover {
  background-color: #166534 !important;
}

html.dark-mode .hover\:bg-red-200:hover {
  background-color: #991b1b !important;
}

html.dark-mode .hover\:bg-blue-200:hover {
  background-color: #1d4ed8 !important;
}

html.dark-mode .hover\:bg-blue-100:hover {
  background-color: #1e40af !important;
}

html.dark-mode .peer-checked\:bg-green-50 {
  background-color: #052e16 !important;
}

html.dark-mode .peer-checked\:bg-red-50 {
  background-color: #450a0a !important;
}

html.dark-mode .peer-checked\:bg-gray-50 {
  background-color: #1f2937 !important;
}

html.dark-mode .hover\:border-green-300:hover {
  border-color: #22c55e !important;
}

html.dark-mode .hover\:border-red-300:hover {
  border-color: #f87171 !important;
}

html.dark-mode .hover\:border-gray-300:hover {
  border-color: #9ca3af !important;
}

html.dark-mode .group-hover\:text-green-700:is(:where(.group):hover *) {
  color: #86efac !important;
}

html.dark-mode .group-hover\:text-red-700:is(:where(.group):hover *) {
  color: #fca5a5 !important;
}

html.dark-mode .hover\:bg-gray-50:hover,
html.dark-mode .hover\:bg-gray-100:hover {
  background-color: #374151 !important;
}

html.dark-mode .hover\:text-gray-900:hover {
  color: #f9fafb !important;
}

html.dark-mode .trix-editor,
html.dark-mode .comment-edit-form .trix-editor {
  border-color: #4b5563;
  background-color: #111827;
  color: #e5e7eb;
}

html.dark-mode trix-toolbar .trix-button-group {
  border-color: #4b5563;
}

html.dark-mode trix-toolbar .trix-button {
  background: #1f2937;
  color: #e5e7eb;
  border-bottom-color: #4b5563;
}

html.dark-mode trix-toolbar .trix-button:not(:first-child) {
  border-left-color: #4b5563;
}

html.dark-mode trix-toolbar .trix-button:hover {
  background: #374151;
  color: #f9fafb;
}

html.dark-mode trix-toolbar .trix-button.trix-active {
  background: #4b5563;
  color: #f9fafb;
}

html.dark-mode trix-toolbar .trix-button:disabled {
  color: rgba(255, 255, 255, 0.25);
}

html.dark-mode trix-toolbar .trix-button--icon::before {
  filter: invert(1) brightness(1.15);
  opacity: 0.85;
}

html.dark-mode trix-toolbar .trix-button--icon.trix-active::before,
html.dark-mode trix-toolbar .trix-button--icon:hover::before {
  opacity: 1;
}

html.dark-mode trix-toolbar .trix-button--icon:disabled::before {
  opacity: 0.3;
}

html.dark-mode trix-toolbar .trix-dialog {
  background: #1f2937;
  border-top-color: #6b7280;
  box-shadow: 0 0.3em 1em rgba(0, 0, 0, 0.45);
  color: #e5e7eb;
}

html.dark-mode trix-toolbar .trix-input--dialog {
  background-color: #111827;
  border-color: #4b5563;
  color: #e5e7eb;
}

html.dark-mode .trix-button-group {
  border-color: #4b5563;
}

html.dark-mode .trix-button {
  background: #1f2937;
  color: #d1d5db;
}

html.dark-mode .trix-button:hover {
  background: #374151;
  color: #f3f4f6;
}

html.dark-mode .trix-button.trix-active {
  background: #4b5563;
  color: #f9fafb;
}

/* Dark mode rendered rich text (comments, proposals) */
html.dark-mode .prose,
html.dark-mode .prose .trix-content,
html.dark-mode .trix-content {
  color: #e5e7eb;
}

html.dark-mode .prose .trix-content :where(p, div, li, h1, blockquote, strong, em, span):not(a),
html.dark-mode .trix-content :where(p, div, li, h1, blockquote, strong, em, span):not(a) {
  color: inherit;
}

html.dark-mode .trix-content blockquote {
  border-color: #6b7280;
}

html.dark-mode .trix-content pre {
  background-color: #374151;
  color: #f3f4f6;
}

html.dark-mode .trix-content .attachment--file {
  color: #e5e7eb;
  background-color: #374151;
  border-color: #6b7280;
}

html.dark-mode .trix-content .attachment--preview .attachment__caption {
  color: #9ca3af;
}

html.dark-mode .prose a,
html.dark-mode .prose .trix-content a,
html.dark-mode .trix-content a,
html.dark-mode .text-gray-600 a,
html.dark-mode .text-gray-700 a,
html.dark-mode .line-clamp-2 a,
html.dark-mode .line-clamp-3 a {
  color: #93c5fd;
}

html.dark-mode .prose a:hover,
html.dark-mode .prose .trix-content a:hover,
html.dark-mode .trix-content a:hover,
html.dark-mode .text-gray-600 a:hover,
html.dark-mode .text-gray-700 a:hover,
html.dark-mode .line-clamp-2 a:hover,
html.dark-mode .line-clamp-3 a:hover {
  color: #bfdbfe;
}

html.dark-mode .prose .trix-content [style*="color"],
html.dark-mode .trix-content [style*="color"] {
  color: inherit !important;
}
