/*
 * Custom styles for Trix editor to match the application design
 */

/* Make the editor match the application's design */
trix-editor {
  min-height: 400px;
  color: var(--primary-color, #0A1551);
  font-family: 'Geologica', sans-serif;
  font-weight: 200;
  line-height: 1.5;
}

/* Style the toolbar to match the application's color scheme */
trix-toolbar {
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 0.375rem 0.375rem 0 0;
  border: 1px solid #d1d5db;
  border-bottom: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

trix-toolbar .trix-button-group {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

trix-toolbar .trix-button {
  border-radius: 0.25rem;
  margin: 0.125rem;
}

trix-toolbar .trix-button.trix-active {
  background-color: var(--primary-color, #0A1551);
  color: white;
}

/* Make toolbar responsive */
@media (max-width: 768px) {
  trix-toolbar {
    flex-direction: column;
  }
  
  trix-toolbar .trix-button-group {
    margin-bottom: 0.5rem;
  }
}

/* Style the content area */
.trix-content {
  font-family: 'Geologica', sans-serif;
  font-weight: 200;
  line-height: 1.5;
}

.trix-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 25px;
  margin-bottom: 10px;
  color: var(--primary-color, #0A1551);
}

.trix-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--primary-color, #0A1551);
}

.trix-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color, #0A1551);
}

.trix-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color, #0A1551);
}

.trix-content blockquote {
  border-left: 3px solid var(--primary-color, #0A1551);
  padding-left: 1rem;
  font-style: italic;
  color: #4b5563;
}

.trix-content ul, .trix-content ol {
  padding-left: 1.5rem;
}

.trix-content a {
  color: var(--accent-color, #00AAAD);
  text-decoration: underline;
}

/* Style the attachment previews */
.trix-content .attachment--preview {
  margin: 0.5rem 0;
}

.trix-content .attachment--preview img {
  border-radius: 0.375rem;
}

/* Video styling */
.trix-content video.attachment {
  display: block;
  max-width: 100%;
  margin: 0.5rem 0;
  border-radius: 0.375rem;
}

.trix-content .attachment--preview video {
  max-height: 80vh;
  width: auto;
  max-width: 100%;
}

/* Image alignment styles */
.trix-content [style*="text-align: left"] {
  text-align: left !important;
}

.trix-content [style*="text-align: center"] {
  text-align: center !important;
}

.trix-content [style*="text-align: right"] {
  text-align: right !important;
}

/* Style the alignment toolbar */
.trix-button-group--alignment-tools {
  display: flex;
  margin-left: 0.25rem;
}

.trix-button-group--alignment-tools .trix-button {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 0.125rem;
}

.trix-button-group--alignment-tools .trix-button svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Make alignment buttons visible by default */
.trix-button-group--alignment-tools {
  display: flex !important;
}

/* Highlight active alignment button */
.trix-button-group--alignment-tools .trix-button.trix-active {
  background-color: var(--primary-color, #0A1551);
}

.trix-button-group--alignment-tools .trix-button.trix-active svg {
  stroke: white;
}

/* Hide image captions */
.trix-content figure.attachment figcaption {
  display: none;
}

/* Alignment classes for images */
.trix-content figure.attachment[data-trix-attributes*="alignLeft"] {
  float: left;
  margin-right: 1rem;
  margin-bottom: 1rem;
}

.trix-content figure.attachment[data-trix-attributes*="alignCenter"] {
  margin-left: auto;
  margin-right: auto;
  display: block;
  clear: both;
}

.trix-content figure.attachment[data-trix-attributes*="alignRight"] {
  float: right;
  margin-left: 1rem;
  margin-bottom: 1rem;
}

/* Ensure proper spacing after floating images */
.trix-content::after {
  content: "";
  display: table;
  clear: both;
}

/* Ensure proper spacing between elements */
.trix-content p {
  margin-bottom: 1rem;
}
