.sp-rich-text-editor {
  background-color: $white;

  .ProseMirror {
    padding: 10px 15px;
  }

  .ProseMirror-focused {
    outline: none;
  }
}

.bubble-menu {
  border-radius: 8px;
  padding: 4px;
  transition: all 0.2s ease;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  position: relative;
  
  &::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }

  &.fixed-menu {
    border-color: #e9ecef !important;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  &.shadow {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08) !important;
  }

  .btn-group {
    gap: 2px;
    flex-wrap: nowrap;
    min-width: min-content;
    position: relative;

    > .btn:not(:first-child),
    > .btn-group:not(:first-child) > .btn {
      border-top-left-radius: 6px !important;
      border-bottom-left-radius: 6px !important;
    }

    > .btn:not(:last-child),
    > .btn-group:not(:last-child) > .btn {
      border-top-right-radius: 6px !important;
      border-bottom-right-radius: 6px !important;
    }
  }

  .btn {
    border-radius: 6px !important;
    transition: all 0.15s ease;
    padding: 6px 10px;
    color: #495057;
    border: 1px solid transparent;
    white-space: nowrap;

    &:hover {
      background-color: #f1f3f5;
      color: #212529;
    }

    &.active {
      background-color: #e9ecef;
      color: #212529;
      font-weight: 500;
      border-color: transparent;
      box-shadow: none;
    }

    i {
      font-size: 1rem;
    }

    &.dropdown-toggle {
      &::after {
        margin-left: 6px;
        vertical-align: middle;
      }
    }
  }

  .dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 6px 0;
    max-width: 100vw;
    overflow-x: hidden;
    z-index: 1050;
    position: absolute;
    margin-top: 0.5rem;

    .dropdown-item {
      padding: 8px 16px;
      transition: background-color 0.15s ease;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      &:hover {
        background-color: #f8f9fa;
      }

      &.active {
        background-color: #e9ecef;
        color: #212529;
        font-weight: 500;
      }

      i {
        margin-right: 8px;
        width: 16px;
        text-align: center;
      }
    }
  }

  .divider {
    width: 1px;
    background-color: #e9ecef;
    margin: 0 6px;
    flex-shrink: 0;
  }

  .color-picker {
    width: 182px;
    padding: 8px;
    border-radius: 8px;
    max-width: calc(100vw - 32px);
    z-index: 1050;
    position: absolute;
    margin-top: 0.5rem;

    .color-grid {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      gap: 5px;

      .color-button {
        height: 30px;
        width: 30px;
        border: none;
        outline: none;
        border-radius: 4px;
        transition: transform 0.15s ease;
        cursor: pointer;
        flex-shrink: 0;

        &:hover {
          transform: scale(1.1);
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
      }
    }
  }
}
// Media queries for responsive design
@media (max-width: 768px) {
  .bubble-menu {
    .btn {
      padding: 4px 8px;
      
      i {
        font-size: 0.9rem;
      }
    }
    
    .divider {
      margin: 0 4px;
    }
  }
}

@media (max-width: 576px) {
  .bubble-menu {
    .btn {
      padding: 4px 6px;
      
      i {
        font-size: 0.85rem;
      }
    }
    
    .divider {
      margin: 0 2px;
    }
  }
}
