/* RICH TEXT EDITOR */
.editor-modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: rgba(0, 0, 0, 0.4);
  /* Add a semi-transparent background*/
  justify-content: center;
  /* Center the editor horizontally */
  align-items: flex-start;
  /* Keep top of editor reachable when content expands */
  box-sizing: border-box;
}

.editor {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  /* Add a shadow effect */
  border: none;
  width: 60%;
  /* Adjust width as needed */
  margin: 20px auto;
  font-family: sans-serif;
  position: relative;
  /* Add positioning context for mobile close button */
}

/* Toolbar styles */

.toolbar {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-bottom: 1px solid #ccc;
  display: flex;
  /* Use flexbox for better layout control */
  align-items: center;
  /* Align items vertically in the center */
  position: relative;
  justify-content: space-between;
  /* Align items to opposite ends */
  border-radius: 10px;
  flex-wrap: wrap;
  /* Allow the toolbar to wrap to multiple lines */
}

.editor .toolbar .line:last-child {
  border-bottom: none;
}

.editor .toolbar .line .box {
  display: flex;
  border-left: 1px solid #e2e8f0;
}

.editor .toolbar .line .box .btn {
  display: block;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: 0.2s ease all;
}

.editor .toolbar .line .box .btn:hover,
.editor .toolbar .line .box .btn.active {
  background-color: #e1e1e1;
  cursor: pointer;
}

.editor .toolbar .line .box .btn.icon img {
  width: 15px;
  padding: 10px;
  box-sizing: content-box;
  /* Add this line */
}

.editor .toolbar .line .box .btn.icon.smaller img {
  width: 12px;
  box-sizing: content-box;
  /* Add this line */
}

.editor .toolbar .line .box .btn.has-submenu {
  width: 20px;
  padding: 0 10px;
}

.editor .toolbar .line .box .btn.has-submenu::after {
  content: '';
  width: 6px;
  height: 6px;
  position: absolute;
  background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTEyIDhMNyAxMyAxMiAxOCA3IDIzeiIvPjwvc3ZnPg==);
  /* Base64 encoded SVG */
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  right: 4px;
}

.editor .toolbar .line .box .btn.has-submenu .submenu {
  display: none;
  position: absolute;
  top: 36px;
  left: -1px;
  z-index: 10;
  background-color: #fff;
}

.toolbar .line {
  display: inline-flex;
  /* Keep the lines inline */
  border-left: none;
  /* Remove the extra border */
  margin-right: 10px;
  /* Add some space between lines */
  box-sizing: border-box;
  /* Include padding and border in width calculation */
}


#correction-error {
  display: none;
}

.correction-guidance-notice {
  background-color: #fcfcfd;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 10px;
}

.correction-guidance-notice p {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.45;
}

.correction-learn-more-button {
  margin-top: 8px;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.correction-learn-more-button:hover {
  color: #334155;
}

.correction-learn-more-container {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background-color: #fafafa;
}

.correction-learn-more-container p {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
}

.correction-learn-more-container p:last-child {
  margin-bottom: 0;
}

.correction-learn-more-section {
  margin-bottom: 10px;
}

.correction-learn-more-section:last-child {
  margin-bottom: 0;
}

.correction-learn-more-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.correction-learn-more-section ul {
  margin: 0;
  padding-left: 16px;
}

.correction-learn-more-section li {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}

.correction-learn-more-section li:last-child {
  margin-bottom: 0;
}


/* Media query for even smaller screens (e.g., tablets) */
@media (max-width: 768px) {
  .toolbar .line {
    flex-basis: 100%;
    /* Each line takes up 100% of the width */
  }
}

/* Mobile close button - only visible when toolbar is hidden */
.close-editor-mobile {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #ef4444;
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.close-editor-mobile:hover {
  background-color: #dc2626;
  transform: scale(1.05);
}

.close-editor-mobile:active {
  background-color: #b91c1c;
  transform: scale(0.95);
}

/* Media query for mobile screens */
@media (max-width: 480px) {
  .toolbar {
    display: none !important;
    /* Hide the toolbar on mobile screens */
  }

  .close-editor-mobile {
    display: flex !important;
    /* Show mobile close button when toolbar is hidden */
  }

  .correction-guidance-notice {
    padding: 9px 10px;
    margin: 6px 0 10px;
  }

  .correction-guidance-notice p {
    font-size: 12px;
  }

  .correction-learn-more-button {
    width: auto;
    min-height: auto;
    font-size: 12px;
  }
}

/* ===== RICH TEXT EDITOR RESPONSIVE MEDIA QUERIES ===== */

/* Large Desktop Screens (1440px and up) */
@media (min-width: 1440px) {
  .editor-modal {
    padding: 40px;
  }

  .editor {
    width: 70%;
    max-width: 1200px;
    padding: 32px;
    border-radius: 16px;
    margin: 40px auto;
  }

  .toolbar {
    padding: 16px;
    border-radius: 12px;
    gap: 12px;
  }

  .toolbar .btn {
    padding: 8px 14px;
  }

  .toolbar .btn img {
    width: 20px;
  }

  .visuell-view,
  .html-view {
    min-height: 400px;
    font-size: 16px;
    padding: 16px;
  }

  .link-modal-wrapper {
    width: 40%;
    max-width: 600px;
    padding: 32px;
  }
}

/* Desktop Screens (1025px to 1439px) */
@media (min-width: 1025px) and (max-width: 1439px) {
  .editor-modal {
    padding: 32px;
  }

  .editor {
    width: 75%;
    max-width: 1000px;
    padding: 28px;
    border-radius: 14px;
    margin: 32px auto;
  }

  .toolbar {
    padding: 14px;
    border-radius: 11px;
    gap: 10px;
  }

  .toolbar .btn {
    padding: 7px 12px;
  }

  .toolbar .btn img {
    width: 18px;
  }

  .visuell-view,
  .html-view {
    min-height: 350px;
    font-size: 15px;
    padding: 14px;
  }

  .link-modal-wrapper {
    width: 45%;
    max-width: 500px;
    padding: 28px;
  }
}

/* Large Tablets (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .editor-modal {
    padding: 24px;
  }

  .editor {
    width: 85%;
    max-width: 800px;
    padding: 24px;
    border-radius: 12px;
    margin: 24px auto;
  }

  .toolbar {
    padding: 12px;
    border-radius: 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .toolbar .line {
    flex-basis: auto;
    margin-right: 8px;
    margin-bottom: 8px;
  }

  .toolbar .btn {
    padding: 6px 10px;
  }

  .toolbar .btn img {
    width: 16px;
  }

  .visuell-view,
  .html-view {
    min-height: 300px;
    font-size: 14px;
    padding: 12px;
  }

  .link-modal-wrapper {
    width: 60%;
    max-width: 450px;
    padding: 24px;
    margin: 10% auto;
  }

  .close-editor {
    padding: 8px 16px;
    font-size: 14px;
  }
}

/* Small Tablets and Large Mobile (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .editor-modal {
    padding: 16px;
  }

  .editor {
    width: 95%;
    max-width: 100%;
    padding: 20px;
    border-radius: 10px;
    margin: 16px auto;
  }

  .toolbar {
    display: flex;
    padding: 10px;
    border-radius: 8px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .toolbar .line {
    flex-basis: auto;
    margin-right: 6px;
    margin-bottom: 6px;
  }

  .toolbar .btn {
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .toolbar .btn img {
    width: 18px;
  }

  .visuell-view,
  .html-view {
    min-height: 250px;
    font-size: 16px;
    padding: 12px;
    border-radius: 8px;
  }

  .link-modal-wrapper {
    width: 85%;
    max-width: 400px;
    padding: 20px;
    margin: 5% auto;
    border-radius: 16px;
  }

  .link-modal-content input[type="text"] {
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
  }

  .link-modal-content button {
    padding: 12px 24px;
    font-size: 16px;
    min-height: 44px;
    border-radius: 8px;
  }

  .close-editor {
    padding: 10px 20px;
    font-size: 16px;
    min-height: 44px;
    border-radius: 8px;
  }

  .attachment-file {
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .document-image-deleter-1 {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
    background-color: #ef4444 !important;
    color: white !important;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    cursor: pointer;
    touch-action: manipulation;
  }
}

/* Mobile Screens (320px to 480px) */
@media (max-width: 480px) {
  .editor-modal {
    padding: 8px;
    overflow-y: auto;
  }

  .editor {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    border-radius: 8px;
    margin: 8px auto;
    box-sizing: border-box;
  }

  .toolbar {
    display: none !important;
  }

  .content-area {
    padding: 8px;
  }

  .visuell-view,
  .html-view {
    min-height: 200px;
    font-size: 16px;
    padding: 12px;
    border-radius: 6px;
    /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }

  .link-modal-wrapper {
    width: 95%;
    max-width: 100%;
    padding: 16px;
    margin: 2% auto;
    border-radius: 12px;
  }

  .link-modal-content h3 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .link-modal-content input[type="text"] {
    padding: 14px;
    font-size: 16px;
    border-radius: 6px;
    /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }

  .link-modal-content .row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .link-modal-content .row label,
  .link-modal-content .row input {
    width: 100%;
  }

  .link-modal-content .row input[type="checkbox"] {
    width: 44px;
    height: 44px;
    align-self: center;
  }

  .link-modal-content button {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 6px;
    touch-action: manipulation;
  }

  .close-link-modal {
    font-size: 32px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .close-editor {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 6px;
    touch-action: manipulation;
    margin-top: 16px;
  }

  .attachment-file {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px;
    margin-bottom: 8px;
    gap: 6px;
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  .attachment-link-1 {
    margin-right: 0;
    margin-bottom: 0;
    word-break: break-word;
    color: #3b82f6 !important;
    text-decoration: underline;
    font-size: 14px;
    line-height: 1.3;
    padding: 2px 0;
  }

  .file-size-1 {
    margin-right: 0;
    font-size: 12px;
    color: #6b7280 !important;
    padding: 0;
    margin-top: -2px;
  }

  .document-image-deleter-1 {
    width: auto;
    align-self: center;
    padding: 4px 8px;
    font-size: 11px;
    min-height: 24px;
    touch-action: manipulation;
    background-color: #ef4444 !important;
    color: white !important;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    cursor: pointer;
    margin: 0;
  }

  .correct-request-div-success {
    padding: 16px;
    margin-top: 16px;
    border-radius: 8px;
  }

  .chat-wrapper {
    gap: 12px;
  }

  .request-corrections {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    min-height: 48px;
    margin-top: 16px;
    border-radius: 6px;
    touch-action: manipulation;
  }
}

/* Extra Small Mobile (below 320px) */
@media (max-width: 319px) {
  .editor-modal {
    padding: 4px;
  }

  .editor {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    margin: 4px auto;
  }

  .visuell-view,
  .html-view {
    min-height: 180px;
    font-size: 16px;
    padding: 10px;
    border-radius: 4px;
  }

  .link-modal-wrapper {
    width: 98%;
    padding: 12px;
    margin: 1% auto;
    border-radius: 8px;
  }

  .link-modal-content input[type="text"] {
    padding: 12px;
    font-size: 16px;
    border-radius: 4px;
  }

  .link-modal-content button {
    padding: 12px 16px;
    font-size: 15px;
    min-height: 44px;
    border-radius: 4px;
  }

  .close-editor {
    padding: 12px 16px;
    font-size: 15px;
    min-height: 44px;
    border-radius: 4px;
  }

  .attachment-file {
    padding: 12px;
    margin-bottom: 12px;
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .document-image-deleter-1 {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 42px;
    background-color: #ef4444 !important;
    color: white !important;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    cursor: pointer;
  }
}

/* Additional Mobile Optimizations */
@media (max-width: 768px) {

  /* Improve touch targets */
  .editor-modal {
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent horizontal scroll */
  .editor {
    overflow-x: hidden;
  }

  /* Better text area handling on mobile */
  .visuell-view,
  .html-view {
    resize: vertical;
    max-height: 60vh;
  }

  /* Ensure proper focus styles for accessibility */
  .visuell-view:focus,
  .html-view:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
  }

  /* Improve button spacing on mobile */
  .correct-request-div-success {
    gap: 16px;
  }

  /* Better attachment display on mobile */
  .attachment-list-item {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 8px;
    padding: 0;
    background: none;
    border-radius: 0;
  }

  /* Enhanced mobile attachment styling */
  .attachment-file {
    flex-direction: row;
    align-items: center;
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding: 8px 10px;
    gap: 10px;
  }

  .attachment-link-1 {
    color: #3b82f6 !important;
    text-decoration: underline;
    font-size: 14px;
    line-height: 1.3;
    flex: 1;
    margin: 0;
  }

  .file-size-1 {
    color: #6b7280 !important;
    font-size: 11px;
    white-space: nowrap;
    margin: 0 8px 0 0;
  }

  .document-image-deleter-1 {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-height: 24px !important;
    width: auto !important;
    flex-shrink: 0;
    margin: 0 !important;
    align-self: center;
  }
}

.toolbar .btn {
  padding: 5px 10px;
  /* Reduce padding for compactness */
  margin: 0;
  /* Remove default margin */
}

.toolbar .btn img {
  width: 16px;
  /* Adjust icon size as needed */
  vertical-align: middle;
  /* Align icons vertically */
  box-sizing: content-box;
  /* Add this line */
}

/* Content area styles */
.content-area {
  padding: 10px;
}

/* Other styles (adjust as needed) */
.visuell-view,
.html-view {
  width: 100%;
  min-height: 200px;
  border: none;
  resize: vertical;
  background-color: rgb(227, 227, 227);
  border-radius: 5px;
  /* add a vertical scrollbar */
  overflow-y: auto;
}

/* Modal styles */
.link-modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.link-modal-wrapper {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 30%;
  border-radius: 20px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.link-modal-content {
  text-align: center;
}

.link-modal-content h3 {
  margin-bottom: 10px;
}

.link-modal-content input[type="text"] {
  width: 100%;
  padding: 10px;
  margin: 5px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.link-modal-content .row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.link-modal-content .row label {
  width: 50%;
}

.link-modal-content .row input {
  width: 50%;
  /* make checkbox smaller */
  width: 30px;
  height: 30px;
}

.link-modal-content button {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px;
  margin: 10px 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;

}

.close-link-modal {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-link-modal:hover,
.close-link-modal:focus {
  color: rgb(247, 247, 247);
  text-decoration: none;
  cursor: pointer;
}

/* Attachments styles */
#attachments-container {
  margin-top: 10px;
}

#attachments-container ol {
  list-style: none;
  padding: 0;
}

.attachment-list-item {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.attachment-link-1 {
  margin-right: 10px;
  color: #333;
  /* Or your preferred color */
  text-decoration: none;
}

.file-size-1 {
  margin-right: 10px;
  font-size: 0.8em;
  color: #777;
  /* Or your preferred color */
}

.document-image-deleter-1 {
  background-color: #f44336;
  /* Red background color */
  border: none;
  color: white;
  padding: 5px 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

.attachment-file {
  display: flex;
  flex-direction: row;
  align-items: center;
  background-color: #272836;
  padding: 3px;
  padding-right: 5px;
  padding-left: 5px;
  border-radius: 10px;
}

.close-editor {
  /* ... other styles ... */
  padding: 5px 10px;
  cursor: pointer;
  color: black !important;
}

/* Hide desktop close button on mobile screens */
@media (max-width: 480px) {
  .close-editor {
    display: none !important;
  }
}

.request-corrections {
  background-image: linear-gradient(to right, #f34079, #fc894d) !important;
  margin-top: 15px;
}

.more-files-coming {
  background-image: linear-gradient(to right, #f34079, #fc894d) !important;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.correction-attachment {
  background-color: #126792;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.correction-attachment-input {
  display: none;
}

.chat-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* gap: 10px; */
}

.chat-attachments-container {
  margin-top: 10px;
}

.chat-attachments-container ol {
  list-style: none;
  padding: 0;
  color: lightgrey;
}

.correct-request-div-success {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  /* Add a shadow effect */
}

/* END OF TEXT EDITOR */

/* Rich text editor elements */
.editor {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  color: #374151 !important;
}

.toolbar {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

.editor,
.toolbar,
.modal-content {
  color: #374151 !important;
}