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

/* Smooth scrolling for anchor links (landing page only) */
html.smooth-scroll {
  scroll-behavior: smooth;
}

/* Custom Trix editor styling to match IdeaBadger design */
trix-editor {
  @apply retro-shadow;
  border: 2px solid theme('colors.border.subtle');
  border-radius: 6px;
  background: theme('colors.surface.sunken');
  color: theme('colors.foreground');
  font-family: theme('fontFamily.body');
  font-size: 1rem;
  line-height: 1.5;
  min-height: 8rem;
  padding: 0.75rem 1rem;
}

.dark trix-editor {
  background: theme('colors.stone.800');
  border-color: theme('colors.stone.700');
}

trix-toolbar {
  background: theme('colors.surface.elevated');
  border-bottom: 1px solid theme('colors.border.subtle');
  padding: 0.5rem 1rem;
}

trix-toolbar .trix-button-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.5rem;
}

.dark trix-toolbar {
  background: theme('colors.stone.800');
  border-bottom-color: theme('colors.stone.700');
}

/* Mobile toolbar: horizontal scroll instead of wrapping */
@media (max-width: 640px) {
  trix-toolbar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  trix-toolbar .trix-button-row {
    flex-wrap: nowrap !important;
    width: max-content !important;
  }

  trix-toolbar .trix-button-group[data-trix-button-group="file-tools"],
  trix-toolbar .trix-button-group[data-trix-button-group="history-tools"] {
    display: none !important;
  }
}

trix-toolbar .trix-button-group {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

trix-toolbar .trix-button {
  border: 1px solid theme('colors.border.subtle') !important;
  background: theme('colors.surface.sunken') !important;
  padding: 0.375rem 0.5rem !important;
  border-radius: 4px !important;
  font-size: 0.875rem !important;
  min-width: 2rem !important;
  height: 2rem !important;
  transition: all 0.15s ease !important;
  color: theme('colors.text.muted') !important;
}

/* Icon buttons: hide text labels, show SVG background via ::before */
trix-toolbar .trix-button--icon {
  text-indent: -9999px !important;
  position: relative !important;
  overflow: hidden !important;
  width: 2.25rem !important;
}

.dark trix-toolbar .trix-button {
  background: theme('colors.stone.700') !important;
  border-color: theme('colors.stone.600') !important;
  color: theme('colors.stone.50') !important;
  opacity: 1 !important;
}

.dark trix-toolbar .trix-button svg,
.dark trix-toolbar .trix-button::before,
.dark trix-toolbar .trix-button::after,
.dark trix-toolbar .trix-button * {
  color: theme('colors.stone.50') !important;
  fill: theme('colors.stone.50') !important;
  stroke: theme('colors.stone.50') !important;
  filter: brightness(0) invert(1) !important;
}

trix-toolbar .trix-button:hover {
  background: theme('colors.primary.50');
  border-color: theme('colors.primary.300');
}

.dark trix-toolbar .trix-button:hover {
  background: theme('colors.primary.900') / 0.3;
  border-color: theme('colors.primary.600');
  color: theme('colors.primary.200');
}

.dark trix-toolbar .trix-button:hover svg,
.dark trix-toolbar .trix-button:hover::before,
.dark trix-toolbar .trix-button:hover * {
  color: theme('colors.primary.200') !important;
  fill: theme('colors.primary.200') !important;
}

trix-toolbar .trix-button.trix-active {
  background: theme('colors.primary.500');
  color: white;
  border-color: theme('colors.primary.500');
}


.dark trix-toolbar .trix-button.trix-active svg,
.dark trix-toolbar .trix-button.trix-active::before,
.dark trix-toolbar .trix-button.trix-active * {
  color: white !important;
  fill: white !important;
}

trix-toolbar .trix-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px theme('colors.primary.500'), 0 0 0 4px transparent;
}

trix-toolbar .trix-button svg {
  width: 1rem;
  height: 1rem;
}

/* Trix editor content styles - restore basic formatting */
trix-editor ol {
  list-style-type: decimal !important;
  list-style-position: outside !important;
  padding-left: 2.5rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}

trix-editor ul {
  list-style-type: disc !important;
  list-style-position: outside !important;
  padding-left: 2.5rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}

trix-editor li {
  margin-bottom: 0.25rem !important;
}

trix-editor strong,
trix-editor b {
  font-weight: 600 !important;
}

trix-editor em,
trix-editor i {
  font-style: italic !important;
}

trix-editor a {
  color: theme('colors.primary.600') !important;
  text-decoration: underline !important;
}

.dark trix-editor a {
  color: theme('colors.primary.400') !important;
}

trix-editor blockquote {
  border-left: 4px solid theme('colors.border.subtle') !important;
  padding-left: 1rem !important;
  margin-left: 0 !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
  font-style: italic !important;
  color: theme('colors.text.muted') !important;
}

trix-editor pre {
  background: theme('colors.surface.sunken') !important;
  border: 1px solid theme('colors.border.subtle') !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
  overflow-x: auto !important;
  font-family: ui-monospace, monospace !important;
  font-size: 0.875rem !important;
}

/* Rendered Action Text content (read view) */
.prose ol {
  list-style-type: decimal !important;
  list-style-position: outside !important;
  padding-left: 2.5rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}

.prose ul {
  list-style-type: disc !important;
  list-style-position: outside !important;
  padding-left: 2.5rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
}

.prose li {
  margin-bottom: 0.25rem !important;
}

.prose strong,
.prose b {
  font-weight: 600 !important;
}

.prose em,
.prose i {
  font-style: italic !important;
}

.prose a {
  color: theme('colors.primary.600') !important;
  text-decoration: underline !important;
}

.dark .prose a {
  color: theme('colors.primary.400') !important;
}

.prose blockquote {
  border-left: 4px solid theme('colors.border.subtle') !important;
  padding-left: 1rem !important;
  margin-left: 0 !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
  font-style: italic !important;
  color: theme('colors.text.muted') !important;
}

.prose pre {
  background: theme('colors.surface.sunken') !important;
  border: 1px solid theme('colors.border.subtle') !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.75rem !important;
  overflow-x: auto !important;
  font-family: ui-monospace, monospace !important;
  font-size: 0.875rem !important;
}

/* Details chevron rotation */
details[open] .details-chevron {
  transform: rotate(-90deg);
}

/* Theme toggle icons - show based on current theme setting */
html[data-theme="light"] .theme-icon-light { display: block; }
html[data-theme="dark"] .theme-icon-dark { display: block; }
html[data-theme="auto"] .theme-icon-auto { display: block; }
/* Default to auto if no data-theme set */
html:not([data-theme]) .theme-icon-auto { display: block; }
