/* Rich Text Editor - Minimal styling to work with default ReactQuill Snow theme */

/* Main Container - Basic border and layout only */
.rich-text-editor-brand {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d1d5db;
  background: white;
}

.rich-text-editor-brand:focus-within {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}

/* Quill Editor Container - Let ReactQuill handle toolbar styling */
.quill-editor-brand {
  background: white;
  border: none;
}

.quill-editor-brand.disabled {
  background: #f9fafb;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Editor Content Area - Only essential styling with higher specificity */
.rich-text-editor-brand .quill-editor-brand .ql-container {
  border: none;
  height: auto;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: #ffffff;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor {
  padding: 16px;
  color: #1f2937;
  min-height: calc(var(--editor-height, 300px) - 60px);
  overflow-y: visible;
  border: none;
  outline: none;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor:focus {
  outline: none;
  box-shadow: none;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor.ql-blank::before {
  color: #9ca3af;
  font-style: normal;
  opacity: 1;
  font-weight: 400;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Disabled State */
.rich-text-editor-brand .quill-editor-brand.disabled .ql-toolbar {
  opacity: 0.6;
  pointer-events: none;
}

.quill-editor-brand.disabled .ql-editor {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

/* Error State */
.rich-text-editor-brand.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}
/* Rich Text Editor - Brand Colors (Red, Black, White, Gray) */

/* Main Container */
.rich-text-editor-brand {
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  background: white;
}

.rich-text-editor-brand:hover {
  border-color: #e9ecef;
}

.rich-text-editor-brand:focus-within {
  border-color: #e9ecef;
  box-shadow: none;
}

/* Quill Editor Container */
.quill-editor-brand {
  background: white;
  border: none;
}

.quill-editor-brand.disabled {
  background: #f8f9fa;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Toolbar Styling */
.quill-editor-brand .ql-toolbar {
  background: #f8f9fa;
  border: none;
  border-bottom: 1px solid #e9ecef;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.quill-editor-brand .ql-toolbar .ql-formats {
  margin-right: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.quill-editor-brand .ql-toolbar .ql-formats:last-child {
  margin-right: 0;
}

/* Toolbar Buttons */
.quill-editor-brand .ql-toolbar button {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #6c757d;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 1px;
}

.quill-editor-brand .ql-toolbar button:hover {
  background: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
  color: #dc3545;
}

.quill-editor-brand .ql-toolbar button.ql-active {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

.quill-editor-brand .ql-toolbar button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

/* Toolbar Icons */
.quill-editor-brand .ql-toolbar .ql-stroke {
  stroke: currentColor;
  stroke-width: 2;
}

.quill-editor-brand .ql-toolbar .ql-fill {
  fill: currentColor;
}

.quill-editor-brand .ql-toolbar .ql-even {
  fill-rule: evenodd;
}

/* Dropdown Styling */
.quill-editor-brand .ql-toolbar .ql-picker {
  color: #6c757d;
}

.quill-editor-brand .ql-toolbar .ql-picker-label {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  transition: all 0.2s ease;
  background: transparent;
  color: #6c757d;
  font-weight: 500;
  font-size: 14px;
}

.quill-editor-brand .ql-toolbar .ql-picker-label:hover {
  background: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
  color: #dc3545;
}

.quill-editor-brand .ql-toolbar .ql-picker.ql-expanded .ql-picker-label {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

.quill-editor-brand .ql-toolbar .ql-picker-options {
  background: white;
  border: 2px solid #dc3545;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  margin-top: 4px;
}

.quill-editor-brand .ql-toolbar .ql-picker-item {
  padding: 8px 16px;
  color: #1a1a1a;
  transition: background-color 0.2s ease;
}

.quill-editor-brand .ql-toolbar .ql-picker-item:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.quill-editor-brand .ql-toolbar .ql-picker-item.ql-selected {
  background: #dc3545;
  color: white;
}

/* Header Dropdown Specific Styling */
.quill-editor-brand .ql-toolbar .ql-header .ql-picker-label::before {
  content: 'Normal';
  font-weight: 500;
}

.quill-editor-brand .ql-toolbar .ql-header .ql-picker-label[data-value="1"]::before {
  content: 'Heading 1';
  font-weight: 700;
}

.quill-editor-brand .ql-toolbar .ql-header .ql-picker-label[data-value="2"]::before {
  content: 'Heading 2';
  font-weight: 600;
}

.quill-editor-brand .ql-toolbar .ql-header .ql-picker-label[data-value="3"]::before {
  content: 'Heading 3';
  font-weight: 600;
}

/* Color Picker Styling */
.quill-editor-brand .ql-toolbar .ql-color .ql-picker-options,
.quill-editor-brand .ql-toolbar .ql-background .ql-picker-options {
  width: 168px;
  padding: 12px;
}

.quill-editor-brand .ql-toolbar .ql-color .ql-picker-item,
.quill-editor-brand .ql-toolbar .ql-background .ql-picker-item {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  margin: 2px;
  border: 1px solid #e9ecef;
}

.quill-editor-brand .ql-toolbar .ql-color .ql-picker-item:hover,
.quill-editor-brand .ql-toolbar .ql-background .ql-picker-item:hover {
  border-color: #dc3545;
  transform: scale(1.1);
}

/* Editor Content Area - Using Montserrat with higher specificity */
.rich-text-editor-brand .quill-editor-brand .ql-container {
  border: none;
  height: auto;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5715;
  background: #ffffff;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor {
  padding: 16px;
  color: #000000d9;
  min-height: calc(var(--editor-height, 300px) - 60px);
  overflow-y: visible;
  border: none;
  outline: none;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor:focus {
  outline: none;
  box-shadow: none;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor.ql-blank::before {
  color: #00000040;
  font-style: normal;
  opacity: 1;
  font-weight: 400;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Content Styling with higher specificity */
.rich-text-editor-brand .quill-editor-brand .ql-editor h1,
.rich-text-editor-brand .quill-editor-brand .ql-editor h2,
.rich-text-editor-brand .quill-editor-brand .ql-editor h3 {
  color: #1a1a1a;
  font-weight: 700;
  margin: 16px 0 8px 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor h1 {
  font-size: 24px;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor h2 {
  font-size: 20px;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor h3 {
  font-size: 18px;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor p {
  margin: 8px 0;
  color: #1a1a1a;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor ul,
.rich-text-editor-brand .quill-editor-brand .ql-editor ol {
  margin: 12px 0;
  padding-left: 24px;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor li {
  margin: 4px 0;
  color: #1a1a1a;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor blockquote {
  border-left: 4px solid #dc3545;
  background: rgba(220, 53, 69, 0.05);
  margin: 16px 0;
  padding: 12px 16px;
  font-style: italic;
  color: #6c757d;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.quill-editor-brand .ql-editor code {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  color: #dc3545;
}

.quill-editor-brand .ql-editor pre {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  overflow-x: auto;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  color: #1a1a1a;
}

.rich-text-editor-brand .quill-editor-brand .ql-editor a {
  color: #dc3545;
  text-decoration: underline;
  transition: color 0.2s ease;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.quill-editor-brand .ql-editor a:hover {
  color: #c82333;
}

/* Disabled State */
.quill-editor-brand.disabled .ql-toolbar {
  background: #f8f9fa;
  opacity: 0.6;
  pointer-events: none;
}

.quill-editor-brand.disabled .ql-editor {
  background: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
}

/* Scrollbar Styling */
.quill-editor-brand .ql-editor::-webkit-scrollbar {
  width: 6px;
}

.quill-editor-brand .ql-editor::-webkit-scrollbar-track {
  background: #f8f9fa;
  border-radius: 3px;
}

.quill-editor-brand .ql-editor::-webkit-scrollbar-thumb {
  background: #dc3545;
  border-radius: 3px;
}

.quill-editor-brand .ql-editor::-webkit-scrollbar-thumb:hover {
  background: #c82333;
}

/* Responsive Design */
@media (max-width: 768px) {
  .quill-editor-brand .ql-toolbar {
    padding: 8px 12px;
    gap: 2px;
  }

  .quill-editor-brand .ql-toolbar .ql-formats {
    margin-right: 8px;
    gap: 1px;
  }

  .quill-editor-brand .ql-toolbar button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
  }

  .quill-editor-brand .ql-toolbar .ql-picker-label {
    padding: 4px 6px;
    font-size: 12px;
  }

  .quill-editor-brand .ql-editor {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* Hide less essential toolbar items on mobile */
  .quill-editor-brand .ql-toolbar .ql-background,
  .quill-editor-brand .ql-toolbar .ql-code-block {
    display: none;
  }
}

@media (max-width: 480px) {
  .quill-editor-brand .ql-toolbar {
    padding: 6px 8px;
    flex-wrap: wrap;
  }

  .quill-editor-brand .ql-toolbar .ql-formats {
    margin-right: 6px;
    margin-bottom: 4px;
  }

  .quill-editor-brand .ql-toolbar button {
    width: 24px;
    height: 24px;
  }

  .quill-editor-brand .ql-editor {
    padding: 10px 12px;
    font-size: 14px;
    min-height: calc(var(--editor-height, 300px) - 80px);
  }

  /* Further simplify toolbar for very small screens */
  .quill-editor-brand .ql-toolbar .ql-color,
  .quill-editor-brand .ql-toolbar .ql-blockquote {
    display: none;
  }
}

/* Focus and Error States */
.rich-text-editor-brand.error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.rich-text-editor-brand.error .quill-editor-brand .ql-toolbar {
  border-bottom-color: #dc3545;
  background: rgba(220, 53, 69, 0.05);
}

/* Integration with Form Components */
.form-group .rich-text-editor-brand {
  width: 100%;
}

.form-group .rich-text-editor-brand.error + .text-danger {
  margin-top: 8px;
}

/* Course Wizard Integration */
.course-create-wizard .rich-text-editor-brand {
  margin-bottom: 0;
}

.course-create-wizard .rich-text-editor-brand .ql-editor {
  font-size: 15px;
  line-height: 1.6;
}

/* Enhanced Toolbar Grouping */
.quill-editor-brand .ql-toolbar .ql-formats + .ql-formats::before {
  content: '';
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #e9ecef;
  margin: 0 8px 0 4px;
  vertical-align: middle;
}

/* Tooltip Styling for Toolbar Buttons */
.quill-editor-brand .ql-toolbar button[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 4px;
}

.quill-editor-brand .ql-toolbar button[title]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1a1a1a;
  z-index: 1000;
}

/* Loading State */
.rich-text-editor-brand.loading {
  position: relative;
  pointer-events: none;
}

.rich-text-editor-brand.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Accessibility Improvements */
.quill-editor-brand .ql-toolbar button:focus-visible {
  outline: 2px solid #dc3545;
  outline-offset: 2px;
}

.quill-editor-brand .ql-editor:focus-visible {
  outline: 2px solid #dc3545;
  outline-offset: -2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .rich-text-editor-brand {
    border-width: 3px;
  }

  .quill-editor-brand .ql-toolbar button {
    border-width: 2px;
  }

  .quill-editor-brand .ql-toolbar button.ql-active {
    border-width: 3px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .rich-text-editor-brand,
  .quill-editor-brand .ql-toolbar button,
  .quill-editor-brand .ql-toolbar .ql-picker-label,
  .quill-editor-brand .ql-editor a {
    transition: none;
  }
}
